X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: Re: DS and ESP Date: Tue, 19 Feb 2002 11:01:15 CST Organization: Rice University, Houston TX Lines: 34 Message-ID: <3c7284db.sandmann@clio.rice.edu> References: NNTP-Posting-Host: clio.rice.edu X-Trace: joe.rice.edu 1014138624 1439 128.42.105.3 (19 Feb 2002 17:10:24 GMT) X-Complaints-To: abuse AT rice DOT edu NNTP-Posting-Date: 19 Feb 2002 17:10:24 GMT X-NewsEditor: ED-1.5.9 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > I'm developing some kind of simple API (as a library) to install > protected mode interrupts under DJGPP. I dont't use standard DPMI > functions to install interrupts. Instead i create some alias > descriptors in LDT and install my service routines directly in IDT > (it works under DOS and CWSDPMI only but its sufficient for me). Interesting that you are using this feature. I allowed users to put anything into the LDT so they could also set up protected mode services - such as a ring 0 routine which could be called from their ring 3 program. But I never knew if anyone had done anthing with it. Interesting. > In this stub routine I assume 2 things: > a) ds segment always contains selector for .data segment. You should probably load ds_alias instead, but since you have control of when people call your interrupt, this could also be an interface requrirement. > b) similar problem is about esp (I belive that ss is valid ). > My stub routine assumes that valid program data on stack are > pointed by esp and higher values. If this is really important to you have your routine run at a different priv level so you get swapped to a different stack. This might be a case you want to use the DPMI facilities, since CWSDPMI will swap stacks for you and not touch the user stack on an exception or a fault. > I belive that GCC doesn't generate code like above and > there is no such incoherenties in DJGPP's libc. There were some a long time ago in the library, but I believe they all have been fixed.