X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Date: Wed, 6 Feb 2002 10:00:41 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Antti Koskipaa cc: djgpp AT delorie DOT com Subject: Re: FSDB and descriptor tables In-Reply-To: <3C60EF52.7070303@edu.stadia.fi> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.