delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/01/16/18:17:18

From: ptan AT compudyn DOT com (ptan)
Date: Sun, 16 Jan 1994 17:22:12 -0500
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: IDTR and GDTR bases in go32
Organization: Compudyn Systems Ltd.
Lines: 47

I've been going through the go32 code and got a little bit confused as to where
exactly the IDT and GDT resides in physical memory.  I wrote a quick little 
program to check where they are and they revealed that both the IDTR and
the GDTR point to the same base of 0x00000004!  I don't understand why this
is so.  The GDTR had a limit of 0x00b8 and the IDTR had a limit of 0x0800.

Does this mean that the first 23 interrupt map directly into the GDT???
(btw, this is with DJGPP 1.10... I'm still trying to get the rest of 1.11).

Code follows:

#include <stdio.h>

unsigned long int temp;
typedef struct {
    unsigned short int limit;
    unsigned long int  base;
} IDTR;
typedef struct {
    unsigned short int limit;
    unsigned long int  base;
} GDTR;
typedef struct {
    unsigned short int limit;
    unsigned long int  base;
} LDTR;

IDTR idtr;
GDTR gdtr;
LDTR ldtr;

void
main()
{
    asm ("sidt _idtr");
    asm ("sgdt _gdtr");
    asm ("sldt _ldtr");
    printf("idtr base = 0x%08x, limit = 0x%04x\n",idtr.base,idtr.limit);
    printf("gdtr base = 0x%08x, limit = 0x%04x\n",gdtr.base,gdtr.limit);
    printf("ldtr base = 0x%08x, limit = 0x%04x\n",ldtr.base,ldtr.limit);
}

-- 
============================================================================
ptan AT compudyn DOT com, ptan AT dmntor DOT UUCP, 72057 DOT 3430 AT compuserve DOT com, BIX: ptan
paul DOT tan AT canrem DOT com, .... I never know where to look for mail anymore... 
============================================================================

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019