On 04/09/15 10:59, Jon Doe wrote:
On Thu, Apr 9, 2015 at 4:32 AM, Kevin O'Connor kevin@koconnor.net wrote:
On Wed, Apr 08, 2015 at 08:48:11PM +0200, Peter Stuge wrote:
Kevin O'Connor wrote:
(Specifically, the "leal" instruction is not properly implemented.)
Unfortunately, there isn't much that can be done about this on the vga bios side.
Really? Impossible to save flags, use other opcodes, and restore flags?
lea isn't used in vgasrc/ besides in the trap that triggers the fault.
In src/romlayout.S lea is used in two places to bump esp before calls. If those code paths are used also by SeaVGABIOS then maybe they could be rewritten with simpler instructions?
The problem is not with leal in hand written assembler - the problem is with leal instructions generated by gcc. To see the assembler gcc produces for the vgabios one can look at out/vgaccode16.raw.s . Or, alternatively, one can run: objdump -m i386 -M i8086 -M suffix -ldr out/vgarom.o
We've fixed up gcc assembler in the past (see scripts/vgafixup.py) to work around x86emu. However, the leal instruction seems painful to patch out - particularly so when %esp is one of the registers read or written in the leal instruction. If anyone wants to take a stab at a workaround, feel free to submit a patch.
-Kevin
Might be instructive to look at how vmware and virtualbox BIOSes is able to work around this problem. Surely their BIOS code is written in C?
Not sure about virtualbox, but vmware certainly have full control of the compiler (and any postprocessors) they build their releases with. I think users / distributors won't (can't) recompile vmware's C-language BIOS, possibly giving rise to instructions that trip up NTVDM, x86emu etc.
Laszlo
Fixing this in x86emu is probably the right thing to do (just checked, PCBSD 10.1's x86emu is still broken), but this won't help if you're stuck with an old release.
SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios