🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #374

Re: BC 3.0 and 386's

#374
From: Dave Stampe-Psy+Eng
Date: Tue, 11 Aug 1992 14:50
41 lines
2512 bytes
Ross Ridge <ross@zooid.guild.org> writes:
>Ross Ridge <ross@zooid.guild.org> writes:
>>I've always understood that under MS-DOS you can't depend on any
>>of the '386 registers being preserved.  Anytime I've seen the 32bit
>>registers used (eax, edi, ...) it's always been protected inside
>>"sti ... cli" instructions to in case some ISR mucks with them.
>
>dstamp@watserv1.uwaterloo.ca (Dave Stampe-Psy+Eng) writes:
>>But those are the top bits of a 32-bit register, not a segment register!
>>And the loading with a null segment really cannot be anything but 
>>deliberate.  It takes about 15 lines of assembley, and switching in
>>and out of protected mode to reload a segment descriptor.  So I doubt
>>its accidental.
>
>What difference does it make?  All the registers should be saved,
>the top bits and the segment registers, but obviously they're not.
>It's the same stupid assumption that no other routine will be using
>them so there is no need to preserve them.

*Sigh*  Obviously you don't understand 386 protected mode programming.
The selector is *not* a segment.  To get a null selector in real mode
(which the IDE runs in) you must:
- stop all interrupts (including NMI's)
- Create and load a GDT
- Enter protected mode and flush queues
- Load a 0 into the FS and GS registers
- Exit protected mode.

It is impossible to do this by accident or any other means from real mode.
And I doubt anyone would load 0 into _segment_ registers in protected mode
except maliciously.  I expect that BC may want to reserve these registers for
accessing extended memory, but no, the GDT is the original boot GDT.  Oh
well...


--------------------------------------------------------------------------
| My life is Hardware,                    |                              | 
| my destiny is Software,                 |         Dave Stampe          |
| my CPU is Wetware...                    |                              | 
| Anybody got a SDB I can borrow?         | dstamp@watserv1.uwaterloo.ca |
__________________________________________________________________________
Technical Details
Message-ID: <BstqKG.Fu5@watserv1.uwaterloo.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!dstamp
References: <1992Aug11.084512.7600@zooid.guild.org>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!dstamp
From: dstamp@watserv1.uwaterloo.ca (Dave Stampe-Psy+Eng)
Subject: Re: BC 3.0 and 386's
Message-ID: <BstqKG.Fu5@watserv1.uwaterloo.ca>
Organization: University of Waterloo
References: <1992Aug11.084512.7600@zooid.guild.org>
Date: Tue, 11 Aug 1992 14:50:39 GMT
Lines: 42