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
Copy file name to clipboardExpand all lines: README.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,22 +67,26 @@ cargo run
67
67
68
68
## Future Improvements plans for the 16-bit VM
69
69
70
-
Implement runtime
71
-
72
-
Run eBPF-inspired programs: Support a small subset of eBPF instructions (arithmetic, logic, memory access, branching) adapted to 16-bit registers.
73
-
74
-
Enhanced stack and memory: Add bounds-checked stack and simple memory model to handle eBPF-like program execution safely.
75
-
76
-
Syscalls / helpers: Implement basic runtime functions such as logging or debug output for program interaction.
77
-
78
-
Instruction decoding and execution: Support immediate values, relative jumps, and conditional branching for richer eBPF-style logic.
79
-
80
-
Debugging and verification: Add execution logs, stack/register inspection, and basic safety checks (overflow, invalid jumps).
70
+
Right now, my 16-bit Rust VM is a pure-interpreter.
71
+
It reads my VM instructions (Read, decode, executes, one instruction at a time) in the software on the host CPU. Nothing gets translated to native instructions.
72
+
- The host CPU executes Rust code that implements the operations, not the ADD itself.
73
+
- VM registers live in Rust memory, not in actual CPU registers.
74
+
75
+
Adding a runtime with JIT will allow me:
76
+
- Translate my 16-bit VM into host CPU instructions (ARM64)
77
+
- Execute them natively instead of interpreting them one by one
78
+
- Get much higher performance for “heavy work”
79
+
- Keep safety and control over execution because the VM still manages correctness
80
+
81
+
The goal is to make my VM run eBPF programs with runtime + JIT:
82
+
- Define a mapping from eBPF instructions to your VM structures (Implement the eBPF Interpreter), adding verifier is optional (probably will not implement)
83
+
- Add a eBPF VM runtime -> program execution manager
84
+
- Implement JIT Compilation -> translate eBPF instructions to host CPU instructions at runtime
81
85
82
86
## Resources & Inspiration
83
87
-[Writing an LC-3 VM in C](https://www.jmeiners.com/lc3-vm/)
84
88
-[Writing a VM (Stephen Gream)](https://stephengream.com/writing-a-vm-part-one/)
0 commit comments