bob@dhw68k.cts.com (Bob Best) (11/11/88)
In article <BROMAN.88Nov8110617@schroeder.nosc.mil> broman@nosc.mil writes: >While converting the v1.3 klib88.s into a Turbo-C klib88.c, I came upon some >mysteries that someone may be able to explain. > >1. em_xfer() does a PUSHF and an INT 0x15 around line 696, although >the procedure comments explain why the INT is impossible and must >be simulated with a long jump. Perhaps we do not have the code >really used to compile the AT configuration? > 1) in main() (kernel/main.c - line 174) restore the original bios int 0x15. Hence, int 0x15 does not vector to unexpected interrupt handler. phys_copy(phys_b + 4L*EM_VEC, 4L*EM_VEC, 4L); /* extended mem vec */ 2) BUG in em_xfer() (kernel/klib88.s) the registers are restored to improper values. pushf BUG - flags are pushed by int instruction and popped by iret. This corrupts registers popped below! int 0x15 | Do a far call to BIOS routine This comment is wrong. | | All done, return to caller. | pop cx | restore registers cx takes value of flag register from pushf prior to int 0x15 call pop es es takes value of cx on entry to em_xfer() pop si si takes value of es on entry to em_xfer() mov sp,bp restore original stack pointer from entry to em_xfer() proper stack addressing is now restored! pop bp restore original bp from entry to em_xfer() ret Evidently, this register corruption has not caused problems with the C compiler. To fix, simply remove the 'pushf' instruction. Bob -- Bob Best uucp: {spsd, zardoz, felix}!dhw68k!bob InterNet: bob@dhw68k.cts.com