A simple rust (micro-)'virtual machine'.
RVM run binary and provide a securited run-time environment for userspace programs.
- cargo
Assured by our servitor cargo
.
cargo build
caro run $BINARY
where $BINARY
is the executable path you want run.
Directory | Ref |
---|---|
src/arch |
ref |
src/loader |
ref |
src/mem |
ref |
Scoped architecture: x86_64
Juste a sample of x64 assembly code to test the VM.
global _start
section .text
called:
mov rax, 0x1
mov rdi, 0x1
lea rsi, [metoo]
mov rdx, 0xF
syscall
ret
_start:
lea rax, [wrme]
inc BYTE [rax]
mov rax, called
call rax
mov rcx, 0x4
re:
mov rax, 0x1
mov rdi, 0x1
lea rsi, [wrme]
mov rdx, 0xD
push rcx
syscall
pop rcx
dec rcx
cmp rcx, 0x0
jne re
mov rax, 0x3C
mov rdi, 0x0
syscall
section .data
wrme DB 'gello world!', 0xA
metoo DB 'called routine', 0xA
[anywhere/RVM]$ sample/asm.sh sampe/s
[anywhere/RVM]$ cargo run sample/s
Then the given output:
called routine
hello world!
hello world!
hello world!
hello world!
Program exit with code: 0
To learn rust language.
Feel free to fork, use, improve.