Hi,

I found that running with the FreeDOS kernel (tested on build 2038 from  
2008-03-08 as available on Rugxulo's site) my program sometimes  
mysteriously enabled the Trace Flag when returning from a child process.  
This does not happen in MS-DOS. MS-DOS (tested 6.22 and 7.10) apparently  
does not use the flags on the parent's stack frame when returning, it  
instead sets some default flags. These default flags ignore the Carry Flag  
and Trace Flag as stored on the parent's stack frame, both are always  
cleared. The stored Interrupt Flag is ignored too, it's always set.

During execution of my program's child process, my program fails to  
properly preserve its own stack for DOS to use. To be clear, the stack  
contents are lost - the stack itself is free and usable at the time the  
child process terminates. This is not a problem in MS-DOS, because cs:ip  
and the flags are properly set (with the Trace Flag always off) and my  
program does not depend on any of the registers to be preserved.

The appropriate place for a patch would be in the function return_user()  
in task.c, near the end, where cs:ip on the parent's stack is reset to the  
stored Int22 handler. Adding this line might be sufficient:

irp->FLAGS = 0x200;             /* clear the Trace Flag and Carry Flag. set the 
 
Interrupt Flag */

(There's no definition FLG_INTERRUPT in pcb.h so I used the immediate  
value.)

Regards,
Christian

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Freedos-kernel mailing list
Freedos-kernel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to