I found x86emu from X.org, copyrighted to SciTech Software.
And it worked!
After memory and port io hooks, it has successfully set the mode. I also tried other BIOS interrupts, all worked.
I think that is the best way for BIOS interrupts, it works both on protected and long mode, fast and portable.
That is code:
Code:
portfuncs.outb = (void*) outb;
portfuncs.outw = (void*) outw;
portfuncs.outl = (void*) outl;
portfuncs.inb = (void*) inb;
portfuncs.inw = (void*) inw;
portfuncs.inl = (void*) inl;
memfuncs.rdb = (void*) mem_read_byte;
memfuncs.rdw = (void*) mem_read_word;
memfuncs.rdl = (void*) mem_read_long;
memfuncs.wrb = (void*) mem_write_byte;
memfuncs.wrw = (void*) mem_write_word;
memfuncs.wrl = (void*) mem_write_long;
memset(&M, 0, sizeof(M));
X86EMU_setupMemFuncs(&memfuncs);
X86EMU_setupPioFuncs(&portfuncs);
M.x86.gen.A.I16_reg.x_reg = 0x4F02;
M.x86.gen.B.I16_reg.x_reg = 0x4107;
X86EMU_prepareForInt(0x10);
X86EMU_exec();
And that is the screenshot
But, it is really old. Modern version of x86emu is libx86emu, used by openSUSE and hwinfo. And I want to use it instead of x86emu.
And, it is hard to set up its memory and port io hook.
https://github.com/wfeldt/libx86emu#x86 ... _handler_t is way to do it, and I've almost finished it.
X86EMU_MEMIO_R is read from memory,
X86EMU_MEMIO_W is write to memory,
X86EMU_MEMIO_I is read from port,
X86EMU_MEMIO_O is write to port.
But what is X86EMU_MEMIO_X? Everything works except that.
I couldn't understand what is X86EMU_MEMIO_X for, and it gets called many times, so I need to implement it, too.
Thanks in advance.