Work / Virtual Machine / Overview
2012-01-15 03:11:50
Architecture
Registers
Since this VM is stack-based; opting to use the stack instead of registers for passing values around, there are no general purpose registers available to programs.
There are 6 registers used internally by the runtime.
| EIP | Instruction Pointer |
| EBP | Stack Frame Base Pointer |
| ESP | Stack Top Pointer |
| CS | Code Segment |
| DS | Data Segment |
| SS | Stack Segment |
Segments
Each loaded program is represented by three blocks of data:
| Code Segment | Holds the executable program code |
| Data Segment | Stores constant data and preallocated buffers for runtime use |
| Stack Segment | The stack contains the runtime context/state of the program |
Symbol Table
When a program is loaded, the symbols it exports are added to the symbol table in the runtime context of the program.