Acorn Emu
Appearance
Acorn Emu is an x86 emulation project.
Key Concepts
These are all defined in src/config/config.h
Memory Map
We need to know where things need to live in memory - a BIOS expects to live in a certain place and the bootloader is expecting to find itself at 0x7C00.
- 0x00000000 - 0x000003FF - real mode interrupt vector table
- 0x00007C00 - this is where the bootloader will be loaded (512 bytes)
- 0x000F0000 - BIOS ROM space (64KB)
- 0x00100000 - 1 MB mark - this is where protected mode starts
- Beyond this - this is where the OS kernel will live and space for application memory
Max Interrupts
x86 supports 256 interrupt vectors (indexed 0-255)
CPU Ring Levels
We'll be defining two ring levels for the CPU:
- Level 0 - this is where the kernel operates - no userspace code will be allowed to run here.
- Level 3 - this is where the userspace code will live.
x86 Instruction Lengths
- x86 instructions have a maximum length of 15 (made up of prefix + opcode + operands)
- REX prefix extends instructions to 64-bit
Directory Structure
- src - the source code
- config - system wide constants like memory sizes, addresses etc.
- cpu - this is the CPU core - registers, flags, execution
- memory - memory management systems
- decoder - instruction decoding (reading x86 bytecode)
- io - input and output devices
- include - public headers
- tests - test files