Libriscv Versions Save

C++20 RISC-V RV32/64/128 userspace emulator library

v1.3

1 week ago

This release stabilizes binary translations. They should now be possible to use with all programs that libriscv can normally run.

PRs

What's Changed

  • General binary translation performance and reliability improvements
  • Full C-extension (compressed instructions) support in binary translations
  • Support for using pre-built binary translations on platforms that we can cross-compile to
  • MinGW and MSVC on Windows now has support for loading pre-built binary translations
  • Binary translation now passes unit test suite with both Newlib- and glibc-based toolchains

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v1.2...v1.3

v1.2

2 weeks ago

PRs

What's Changed

  • Binary translation has been improved, now matching native binaries for the STREAM benchmark.
  • double vmcall arguments are no longer forgotten: They can be used when making function calls into the VM
  • When retrieving system call arguments, we can now use std::span, pointers* and std::array.
    • std::span uses 2 registers and is a zero-copy view into guest memory
    • Pointers use 1 register and are also zero-copy
    • std::array uses 1 register and produces an array by value
  • There is now a large 3-part example in examples/gamedev with:
    • A C++ program example
    • A Nelua program example
    • A Nim program example
  • ROR.W is no longer treated as unimplemented (even though it was always there)!
  • Unknown CSRRCI instructions no longer result in illegal operation - instead calls on_unknown_csr correctly

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v1.1...v1.2

v1.1

5 months ago

This release is about sandboxing. I have spent some time this past few weeks fuzzing and tinkering with sandbox safety. I have also removed a bunch of code that was not used a lot, reducing attack surface. Some effort has been made to use pointers less. For example, an execute segment is now required at all times, passed only by reference. Instead of a null-check, the default execute segment is an empty segment. I've also added more modes to the fuzzer in an attempt to fuzz APIs I consider part of (or potentially part of) a safe sandboxing configuration. More fuzzing is needed, of course, but I'm happy with the progress.

The C API has been getting some improvements too. There is now enough API to make function calls into the guest programs.

What's Changed

  • The C API has expanded to cover VM function calls
  • Added SECURITY.md which documents a safe sandbox configuration
  • Added a Nelua example program
  • 32- and 64-bit can be individually disabled in CMake in order to reduce build times
  • A new tiny templated ELF header has replaced the old long version
  • Added a benchmark against Luau

PRs

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v1.0...v1.1

v1.0

6 months ago

The 1.0 release is finally here, with dynamic ELF loading support. Note that the libriscv Machine will not attempt to find an interpreter, and instead the programmer should find an interpreter locally, load it into the Machine, and then provide the real program as the first argument, with the programs arguments right after that.

Example: ./myprogram myarg0 myarg1 --> /usr/riscv64/lib/ld-linux.so ./myprogram myarg0 myarg1.

You can test the dynamic loading, which should work out-of-the-box with the CLI.

  • The B-extension is now considered stable and reliable
  • There is now support for mapping files to memory (one-way). Used by the dynamic linker loader.
  • An HTTPS request was finally made from the emulator using Zig.

There is still work to be done with the C API, which while working well is not fully fleshed out, and Debian packing may need additional testing. As usual the emulator has been fuzzed and tested a bit before the release.

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v0.24...v1.0

v0.24

6 months ago

What's Changed

  • C++20 is now required, as many features related to B-extension required it on Windows, eg. <bit> and designated initializers.
  • With this release there is now full Windows MSVC w/CMake support (Clang-cl) with support for 32- and 64-bit IMAFDC + B-extension. There is enough system call emulation to run simple Linux C/C++, Zig, Rust and Go programs .. on Windows!
  • CPack support has been added so that it is possible to generate a .deb file that installs a static library, the build settings and the include headers.
  • The flat read-write arena has been made default enabled.
  • Machine serialization has been improved to be usable with regular memory arena.

PRs

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v0.23...v0.24

v0.23

7 months ago

What's Changed

  • Complete support for B-extension in all dispatch modes and binary translation
    • Zba, Zbb, Zbc, Zbs adds 43 new instructions
  • There is now a C API for the emulator, which you can find here
  • Add GitHub workflow for C API by @fwsGonzo in https://github.com/fwsGonzo/libriscv/pull/100
  • Many small performance increases through new bytecodes and various tweaks (eg. 3f8ce9f7b23297aaf27bf1387654b037a4779afb)
  • A few integrity fixes based on fuzzing

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v0.22...v0.23

v0.22

7 months ago

What's Changed

  • Binary translation is no longer experimental
  • Improve binary translation performance
  • Binary translation instruction counting is now very accurate
  • Lower binary translation footprint
  • Tail-call dispatch is no longer experimental, w/compressed instructions support, tests
  • Add new experimental read-write arena mode, adding performance
  • Add new experimental libtcc binary translation mode
  • Add some speculation safety to memory operations
  • Compressed instructions now passes fuzzing tests
  • Add quite a bit more B-extension instructions
  • Tons of small improvements and fixes!

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v0.21...v0.22

v0.21

7 months ago

What's Changed

  • Support binary translation for run-time execute segments, enabling it for RISC-V that is generated on-the-fly
  • Implement most B-extension instructions generated by GCC (so far), including for binary translation
  • Use real instruction count to avoid exiting binary translation loops by @fwsGonzo in https://github.com/fwsGonzo/libriscv/pull/93
  • Simplify instruction counting in binary translation by @fwsGonzo in https://github.com/fwsGonzo/libriscv/pull/94
  • Tons of small improvements and fixes!

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v0.20...v0.21

v0.20

1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v0.19...v0.20

v0.19

1 year ago

This release contains bugfixes and performance improvements along with initial Clang-CL support. libriscv can now be used in Visual Studio with Clang.

What's Changed

  • Implement experimental tailcall dispatch by @fwsGonzo in https://github.com/fwsGonzo/libriscv/pull/88
  • Custom instructions can be implemented, compatible with all simulation modes
  • Add CMake option for enabling RV128I, which increased build times
  • Performance improvements when running programs with compressed instructions
  • Added a Rust hello world example
  • mmap()-backed arena for faster emulation
  • You can now embed libriscv using FetchContent in VisualStudio with Clang-cl

Full Changelog: https://github.com/fwsGonzo/libriscv/compare/v0.18...v0.19