Skip to content

Repository files navigation

jplcz_microvm

jplcz_microvm is a tiny, zero-allocation bytecode stack machine, code generator, and compiled C-like scripting language for register/memory expressions. It is built on top of jplcz_microfmt's inspector primitives (address_space_ref, register_context_ref) for fault-safe target access and formatted output.

It was split out of jplcz_microfmt into its own repository so it can evolve and version independently.

See docs/micro-vm.md for the full guide.

Getting the code

External users should clone over HTTPS:

git clone https://github.com/jplcz/microvm.git

Building

cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure

By default the build fetches jplcz_microfmt via CMake FetchContent, preferring a sibling ../microfmt checkout if one exists, otherwise cloning it from GitHub. JPLCZ_MICROVM_BUILD_TESTS and JPLCZ_MICROVM_BUILD_EXAMPLES control the test suite and example programs (both default on for top-level builds).

Examples

examples/vm_code_gen_demo.cpp and examples/vm_compiler_demo.cpp are built as part of the default CMake build above and run on the host.

examples/bare_metal/qemu-virt-arm32/ is a standalone, freestanding 32-bit ARM (ARMv7-A) kernel that runs jplcz_microvm bytecode on QEMU's virt machine and streams its output over the ARM PL011 UART via microfmt::pl011_sink. It has its own CMake toolchain file and is not part of the host build - see its README for details.

Using it as a dependency

The CMake package name is jplcz_microvm, exposing a single target:

target_link_libraries(your_target PRIVATE jplcz_microvm::microvm)

About

Micro VM for my Micro Fmt library

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages