It has been a while since I have posted something on this forum but the time has arrived for me to start asking questions again. Lately I have been working on writing a installer/setup program for my OS. With this installer it is possible to install the operating system onto a hard drive so that it is possible to boot without a live-CD. Lets start with the good news shall we. The installer is working as expected and the operating system is actually able to boot from a hard disk. The problem comes when using bios functions from vm86 mode that include buffer access. This is perhaps a bit vague so here is a example:
Code: Select all
// Enable power management for all devices
MemoryOperations::memset(&args, 0, sizeof(VM86Arguments));
args.AX = (uint16_t)0x5300 | (uint16_t)APM_FUNC_ENABLE_POWER_MANAGEMENT;
args.BX = APM_ALL_DEVICE; //All Devices
args.CX = 0x1; //Enable power control by APM BIOS
System::vm86Manager->CallInterrupt(0x15, &args);
Code: Select all
Log(Info, "Probing For Controller Information");
VM86Arguments regs;
MemoryOperations::memset(®s, 0, sizeof(VM86Arguments));
regs.AX = 0x4F00;
regs.DI = (uint16_t)vesaInfo; //This buffer does not get modified
virtual8086Manager->CallInterrupt(0x10, ®s);
The buffer (in this case vesaInfo) remains the same which results in a error. This behavior is not only present in the VBE functions but also when using the bios to receive the EDID information. The weird thing is that these functions work perfect when running the liveCD.
I have run the above code in a debugger and there everything seems to be fine as well, it does not look like memory corruption or something like that. I have also checked that the executable executed by grub is the same as on the liveCD and this is indeed the case. I have faced a lot of issues over the years but those at least seemed to make sense. I have no idea what is causing this behavior and I would really like any help.
My OS can be found at: https://github.com/Remco123/CactusOS
Virtual8068 Source: https://github.com/Remco123/CactusOS/tr ... irtual8086
Code that is causing problems: https://github.com/Remco123/CactusOS/bl ... id.cpp#L58 and https://github.com/Remco123/CactusOS/bl ... sa.cpp#L63
Hard drive image (7 days link): https://send.firefox.com/download/bd7f1 ... kFmDpgvKMg
Thanks for reading, I look forward to your suggestions