You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
sameo
changed the title
The Core crate is missing a fetch implementation
Missing instruction fetching
Mar 19, 2021
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:
Note that the instruction executions step (step 4) could modify RIP as well (branches and jumps).
The text was updated successfully, but these errors were encountered: