www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/06/03:01:41

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 <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Antti Koskipaa <antti DOT koskipaa AT edu DOT stadia DOT fi>
cc: djgpp AT delorie DOT com
Subject: Re: FSDB and descriptor tables
In-Reply-To: <3C60EF52.7070303@edu.stadia.fi>
Message-ID: <Pine.SUN.3.91.1020206095936.1770G-100000@is>
MIME-Version: 1.0
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

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 -


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