Article View: comp.os.msdos.programmer
Article #2988Re: Porting UNIX apps. to MS-DOS
From: Tom Hill
Date: Sun, 11 Nov 1990 00:58
Date: Sun, 11 Nov 1990 00:58
27 lines
1850 bytes
1850 bytes
In article <1990Nov10.223333.4628@rti.rti.org> bcw@rti.rti.org (Bruce Wright) writes: ... >> > oldSS = _SS; >> >> You *MUST* disable interrupts during this operation. If an interrupt >> occures during the stack segment transition, you will not return >> from the interrupt correctly and crash the machine. > >This is misleading. It's not necessary to disable interrupts when >swapping stack segments if you do it right! The point is that the >80x86 processors disable interrupts for one instruction after loading >the SS register (some of them disable interrupts for one instruction >after loading ANY segment register, but later processors limited it >to SS - I forget the exact details of which processors behave which >way because it's usually not important). So if the next instruction >IMMEDIATELY after loading the new value into SS loads the new value >into SP, then you're golden and don't need to mess around with manually >disabling interrupts. Sorry, but this is only correct for the later intel processors. The original 8088s did not disable the interrupts after a load of SS, thus requiring thta interrupts be disabled. If you know your code will only run on ATs & up, sequential loads of SS & SP work fine. If you want to be sure your code will run on your occasional original PC, disable the interrupts. Tom Hill
Technical Details
Message-ID:
<16602@netcom.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!netcom!hillReferences:
<1990Oct26.223541.26634@NCoast.ORG> <1990Oct31.190520.11526@Octopus.COM> <1990Nov10.223333.4628@rti.rti.org>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!netcom!hill
From: hill@netcom.UUCP (Tom Hill)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Porting UNIX apps. to MS-DOS
Message-ID: <16602@netcom.UUCP>
Date: 11 Nov 90 00:58:22 GMT
References: <1990Oct26.223541.26634@NCoast.ORG> <1990Oct31.190520.11526@Octopus.COM> <1990Nov10.223333.4628@rti.rti.org>
Organization: Netcom- The Bay Area's Public Access Unix System {408 241-9760 guest}
Lines: 27