HackerTrans
トップ新着トレンドコメント過去質問紹介求人

trj

no profile record

投稿

Show HN: Tiny VM sandbox in C with apps in Rust, C and Zig

github.com
196 ポイント·投稿者 trj·7 か月前·12 コメント

コメント

trj
·7 か月前·議論
This could be easily done. The emulator core supports memory mapped IO, but uvm32 only uses this to map an extra block of RAM from the host (for a framebuffer, or a separare memory heap). You can trap the writes here: https://github.com/ringtailsoftware/uvm32/blob/main/uvm32/uv... and the reads here https://github.com/ringtailsoftware/uvm32/blob/main/uvm32/uv...
trj
·7 か月前·議論
libriscv looks amazing but its's much larger. It says "Less than 40kB total memory usage". My first version (unpublished) of uvm32 was called uvm80 and emulated a Zilog Z80 CPU. My aim is to have a safe, embeddable sandbox for any device, rather than the best performance.
trj
·7 か月前·議論
Thanks for the link, Wasefire looks interesting. I suspect that their design goals are very different to mine. https://github.com/ringtailsoftware/uvm32?tab=readme-ov-file...
trj
·7 か月前·議論
"Just add rats" https://github.com/ringtailsoftware/uvm32/tree/main/apps/zig...
trj
·7 か月前·議論
I'm working on an embeddable mini VM (RISC-V rather than WASM) and am considering this. In my model, there's something akin to a hardware watchdog where the VM is considered hung if it executes too many instructions without calling a yield() function in the host, then there's the ability to set a maximum number of instructions to execute before returning to the caller.

This lets it be handled asynchronously at the pace the host code chooses https://github.com/ringtailsoftware/uvm32