Hi,
How is x86emu broken? I'm assuming it ignores the prefix for call, so it'll push a 16bit return address instead of a 32bit return address to the stack?
I think so. Might be safer to save/restore %esp though. This sequence might be simpler:
pushl %eax movl %esp, %eax pushl $1f retl 1: cmpl %esp, %eax jne broken_x86emu popl %eax
...
broken_x86emu: movl %eax, %esp popl %eax iretw
Ah, fixup the stack without assuming specific behavior. Neat trick.
Note, though, in addition to checking for broken x86emu, the assembler entry code would also have to check that the last mode was not set via a vesa call (to avoid the "skifree" bug).
Ok, Is there some easy way to access the BDA from assembler code (specifically the video_mode field)? Guess I must set a segment register for that. Maybe it's easier to just place an additional flag in the fseg which we can easily reach via cs override ...
cheers, Gerd