7d8fe2ab11
Unlike some other architectures, RISC-V does not expose the current privilege mode in any architecturally-defined register. That is intentional to make it easier to implement virtualization in software, but a Unicorn caller operates outside of the emulated hart and so it can and should be able to observe and change the current privilege mode in order to properly emulate certain behaviors of a real CPU. The current privilege level is therefore now exposed as a new pseudo-register using the name "priv", which matches the name of the virtual register used by RISC-V's debug extension to allow the debugger to read and change the privilege mode while the hart is halted. Unicorn's use of it is conceptually similar to a debugger. The bit encoding of this register is the same as specified in RISC-V Debug Specification v1.0-rc3 Section 4.10.1. It's defined as a "virtual" register exposing a subset of fields from the dcsr register, although here it's implemented directly inside the Unicorn code because QEMU doesn't currently have explicit support for the CSRs from the debug specification. If it supports "dcsr" in a future release then this implementation could change to wrap reading and writing that CSR and then projecting the "prv" and "v" bitfields into the correct locations for the virtual register. |
||
---|---|---|
.. | ||
dotnet | ||
go | ||
haskell | ||
java | ||
pascal | ||
python | ||
ruby | ||
rust | ||
vb6 | ||
zig | ||
const_generator.py | ||
Makefile | ||
README |
This directory contains bindings & test code for Python, Java, Go and .NET. See <language>/README or <language>/README.TXT or <language>/README.md for how to install each binding. The following bindings are contributed by community. - Java binding: by Chris Eagle. - Go binding: by Ryan Hileman. - .NET binding: by Antonio Parata. - Ruby binding: by Sascha Schirra - Haskell binding: by Adrian Herrera. - VB6 binding: David Zimmer. - FreePascal/Delphi binding: Mohamed Osama. More bindings created & maintained externally by community are available as follows. - UnicornPascal: Delphi/Free Pascal binding (by Stievie). https://github.com/stievie/UnicornPascal - Unicorn-Rs: Rust binding (by Sébastien Duquette) https://github.com/ekse/unicorn-rs - UnicornEngine: Perl binding (by Vikas Naresh Kumar) https://metacpan.org/pod/UnicornEngine - Unicorn.CR: Crystal binding (by Benoit Côté-Jodoin) https://github.com/Becojo/unicorn.cr - Deimos/unicorn: D binding (by Vladimir Panteleev) https://github.com/D-Programming-Deimos/unicorn - Unicorn-Lua: Lua binding (by Diego Argueta) https://github.com/dargueta/unicorn-lua - pharo-unicorn: Pharo binding (by Guille Polito) https://github.com/guillep/pharo-unicorn - Unicorn.js: JavaScript binding (by Alexandro Sanchez) https://github.com/AlexAltea/unicorn.js