|Bona Fide OS Development
|x86 CPU Emulator for directing Real Hardware
|Page 1 of 1|
|Author:||~ [ Thu Oct 31, 2019 10:58 pm ]|
|Post subject:||x86 CPU Emulator for directing Real Hardware|
It emulates around 98% of 8086/8088 instructions.
It's based in a loop that resolves instruction prefixes and opcodes to the end for each individual instruction.
It has a table-based function array where each prefix/opcode byte 0-255 has a direct corresponding pointer with the function to execute.
Implementing it in x86 assembler itself will be much easier. I only need to resolve functions from the prefix/opcode byte indexes and wrap the real instructions/registers/memory access with a given base address/I/O ports to the emulator functions.
This emulator has the capability of accessing 32-bit memory from Unreal Mode (always enabled in it), which I will need for being able to emulate things like VESA video with high PCI addresses and maybe ACPI/APM.
At the end of the project I need to be able to have a full log of the addresses read/written to and the values written, all in sequence, so that I can repeat those sequences with native code. Then I won't need to emulate those calls anymore, only repeating them from the binary execution logs. The effect will be like having native drivers from video, ACPI, APM..., but based on the functions that the emulated BIOS for each machine indicate me at boot time (cache of execution logs refreshed at every boot).
The most tedious will be writing functions to log structured, typed events (to/from RAM or ports) to disk, and displaying debug information to string.
The funniest will be seeing how the emulator works in pure Unreal Mode without any other drivers like DPMI, XMS, EMS. If possible, from a simple COM or DOS EXE file (if the Unreal Mode CPU doesn't fit), and finally having the clean logs for things like enabling every single VGA and Super VGA mode in the current video card natively.
|Page 1 of 1||All times are UTC - 6 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group