Mail Archives: djgpp/2002/02/06/03:01:41
On Wed, 6 Feb 2002, Antti Koskipaa wrote:
> How can DJGPP's FSDB (full screen debugger) read the descriptor
> tables? I mean when you press alt-g or alt-i.
The sources of FSDB are freely available for studying (get
djlsr203.zip, and look there in src/debug/fsdb/ directory).
> I want my own
> program to display stuff from them, but doing a sidt/sgdt to
> a struct { ushort limit; ulong address; } and the referring
> to the address just crashes under Win98.
Something is wrong with your code. The following works for me, both
on DOS and in all versions of Windows, including 9X, NT, and W2K:
struct {
unsigned short limit __attribute__((packed));
unsigned long base __attribute__((packed));
} gdtr;
unsigned short ldtr;
__asm__ __volatile__ ("sgdt %0" : "=m" (gdtr) : /* no inputs */ );
__asm__ __volatile__ ("sldt %0" : "=m" (ldtr) : /* no inputs */ );
> Well, that's what I expected, since those tables are (should be?)
> protected by the OS, and are probably mapped differently anyway.
No, you are wrong: SGDT and SLDT are not privileged instructions, as
they only read the tables, but not modify them. And there's nothing
special about how those tables are mapped.
- Raw text -