-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
The Core crate decodes and executes instructions, but does not fetch instructions from memory.
In order to fetch instructions, a core needs to know where the code is actually loaded in memory.
This could be overwritten by the still missing executable format, but I propose that the default code section starts at 0x100 in memory. Unless overwritten, $RIP should be initially set to that value, and this is where the first instruction will live (a.k.a. as the reset vector).
The fetch-decode-execute loop should then be as simple as:
- Read 32 bits from $RIP, that's the next instruction to decode and execute
- Increase RIP by 4 (next instruction, 32 bits further)
- Decode the instruction
- Execute the instruction
- goto step 1
Note that the instruction executions step (step 4) could modify RIP as well (branches and jumps).
Metadata
Metadata
Assignees
Labels
No labels