Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!sun-barr!newstop!sun!imagen!qmsseq!pipkins From: pipkins@qmsseq.imagen.com (Jeff Pipkins) Newsgroups: comp.sys.ibm.pc Subject: Re: i/o redirection in msdos (DOS BUG IN EXEC) Message-ID: <65@qmsseq.imagen.com> Date: 13 Dec 89 16:29:30 GMT References: <8157@cg-atla.UUCP> Reply-To: pipkins@imagen.com (Jeff Pipkins) Organization: QMS Inc., Mobile, Alabama Lines: 26 It sounds like the problem may actually be with the way you are spawning the child process. There is a small bug in some versions of MS-DOS in the EXEC function call that causes ALL the registers to be destroyed on return, even the stack registers SS & SP. < Set up all other registers for EXEC call > < Save all registers here > Mov CS:SaveSS, SS ; Save SS in code segment. Mov CS:SaveSP, SP ; Save SP in code segment. Int 21h ; Do the EXEC call CLI ; Compensate for bug in some early 8088s. Mov SS, CS:SaveSS ; Restore SS Mov SP, CS:SaveSP ; Restore SP < Stack is okay now. Restore other registers.> Some ancient MS-DOS manuscripts recommend calling DOS via a long indirect call to your PSP at offset 50h. It is best to NEVER DO THIS. Always use the Int 21h method. If you are using the MSC library functions to spawn it, I doubt you will have to worry about this bug at all. But since you didn't say, I thought it would be worthwhile to post this for other unsuspecting assembly-language programmers. -Jeff pipkins@imagen.com