I have integrated libx86emu into my OS so that I can run the BIOS under emulation.
I am able to call int 10h for normal VGA and for SVGA functions. The returned results are good. For example I can list SVGA video modes, set one using 0x4F02 and I get "success".
But, for some reason the video mode will not actually change (tried both QEmu and Bochs). Nothing in the logs. I suspect something is wrong with my VM setup, but I'm not sure what. I tried both VGA modes (0x0013) and SVGA modes (0x4f02).
Anyone has any experience doing this?
My emulation code lives here:
https://github.com/kiznit/kiznix/blob/m ... x86/bios.c
x86emu setup here:
https://github.com/kiznit/kiznix/blob/m ... ios.c#L164
test code here:
https://github.com/kiznit/kiznix/blob/m ... ios.c#L233
Note that my first 1 MB of physical memory (DOS/BIOS area) is mapped at ISA_IO_BASE (which is 0xC0000000 VMA).
Thanks!
Emulating real mode and video modes
Re: Emulating real mode and video modes
I don't see where you pass IO port access from and to the VM to and from the real HW.kiznit wrote:Anyone has any experience doing this?!
Look for "x86emu_set_memio_handler".
Re: Emulating real mode and video modes
My understanding is that libx86emu will use the in*/out* functions in sys/io.h by default:Artlav wrote:I don't see where you pass IO port access from and to the VM to and from the real HW.
Look for "x86emu_set_memio_handler".
https://github.com/kiznit/kiznix/blob/m ... e/sys/io.h
In my case, the functions are simply redirected to:
https://github.com/kiznit/kiznix/blob/m ... l/x86/io.h
I'll double check that this is indeed the case.
Re: Emulating real mode and video modes
Yes, it looks like the emulator isn't calling my in*/out* port functions. Thanks!
EDIT: I tracked down the problem to M.io.iopl_ok being false.
#defining WITH_IOPL to 0 in x86emu_int.h fixed the problems. Ports are now accessed and stuff is crashing in the BIOS ROM. Thanks again!
EDIT: I tracked down the problem to M.io.iopl_ok being false.
#defining WITH_IOPL to 0 in x86emu_int.h fixed the problems. Ports are now accessed and stuff is crashing in the BIOS ROM. Thanks again!