Commit Graph

102 Commits

Author SHA1 Message Date
Aubrey
07e8162cca improve aarch64 feature gate in rust bindings (#2069) 2024-12-29 22:21:43 +08:00
Sai Ashwin
3a01515367 Rust Bindings: reg_read_batch and reg_write_batch (#2060)
* Added binding for rust reg_{read,write}_batch

* Fix reg_write_batch values pointer
2024-12-07 14:49:23 +08:00
Martin Atkins
7d8fe2ab11 riscv: Expose privilege level as pseudo-register PRIV (#1989)
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.
2024-11-11 21:09:45 +08:00
mio
867770c7ef Tag and release 2.1.1 2024-09-26 18:44:51 +08:00
mio
67f08b1c27 Bump version and generate bindings 2024-09-21 23:00:57 +08:00
lockbox
c850db1125 Inherit architecture support from cfg features
While the bindings conditionally compile code based on the cfg
flags, we still include the architecture support in emitted rust
code. This patch removes the ability to refer to architectures
that cannot possibly be supported.
2024-03-27 17:30:53 -04:00
lockbox
30b99601d2 apply default rust 2021 formatting 2024-03-27 16:54:51 -04:00
227ff1d8bd Merge pull request #1928 from mlgiraud/feat/add_start_end_to_hook
Feature: Bindings: add start end to block hook
2024-03-11 19:50:46 +08:00
0bca8df694 Merge pull request #1796 from bet4it/dylib
Fix dynamic linkage on msvc
2024-03-08 15:16:36 +08:00
Mark Giraud
00680412d3 feat: Add start and end address to rust block hook binding 2024-02-26 11:20:27 +01:00
Mark Giraud
ce1ee5ac4d refactor: Make clippy happy 2023-08-25 15:40:00 +02:00
Mark Giraud
fbe1b4421a feat: Add ctl_context_mode to rust bindings 2023-08-16 14:13:50 +02:00
Mark Giraud
fd3b7082b4 refactor: Make rust bindings more rusty 2023-08-15 11:04:50 +02:00
Mark Giraud
5fd12af68a formating: Use rustfmt style for rust bindings 2023-08-14 13:55:24 +02:00
Mark Giraud
5318fcda33 fix: Make from handle function unsafe 2023-08-14 13:38:26 +02:00
Mark Giraud
bb7df65a1c fix: Wrap uc_hook to not expose ffi types in public api 2023-08-14 10:38:27 +02:00
Mark Giraud
4e194a54d9 fix: Make functions that deref ptr unsafe 2023-08-11 13:18:04 +02:00
Mark Giraud
c43ab92326 fix: Add missing Copy derive 2023-07-26 09:58:09 +02:00
Mark Giraud
5a5b1bbb05 fix: update bitflags dependency and fix flippy warnings 2023-07-26 09:55:04 +02:00
239766aa66 Merge pull request #1849 from mlgiraud/fix/rust_compiler_warnings
Fix rust compiler warnings
2023-07-26 15:35:33 +08:00
Mark Giraud
546561f3cc fix: Remove unnecessary use statement that causes warnings 2023-07-18 11:49:18 +02:00
lockbox
2f2bf8d96f add cpu model to architectures for rust bindings 2023-07-13 13:58:14 -04:00
lockbox
84fe5d1756 expose ffi in rust bindings 2023-07-13 13:57:04 -04:00
Philipp Takacs
a9f0dabc64 rust add tlb callback 2023-04-05 18:57:22 +02:00
Philipp Takacs
0729dc0312 rust update uc_ctl_flush_tlb and add uc_ctl_tlb_mode 2023-04-05 18:57:15 +02:00
Kevin Schneider
5ff654c77b add rust bindings for uc_ctl 2023-04-05 18:48:39 +02:00
Bet4
243e9c8339 Fix dynamic linkage on msvc 2023-03-02 03:34:33 +08:00
7e4754ad00 Merge pull request #1754 from edsky/master
Add arch list feature control in Rust
2023-01-24 21:49:18 +01:00
a07a83ac75 Merge pull request #1767 from PhilippTakacs/rustcallback
rust only add mmio callback funktion, if callback is requested
2023-01-24 21:46:40 +01:00
Takacs, Philipp
ed9164e47a rust only add mmio callback funktion, if callback is requested
The C function uc_mmio_map() allows to add seperate callback functions
and userdata for read and write. When the callback functions are NULL
unicorn don't try to call this functions.

Previous this patch, when i.e. read_callback was None the callback was set
to mmio_read_callback_proxy and the userdata was set to NULL. On a callback
the mmio_read_callback_proxy then tried to dereference the userdata and
caused a segfault.

fixes #1762
2023-01-23 13:22:55 +01:00
Luca Gladiator
aded30f5a8 Fix insn_in_hook_proxy return type 2023-01-21 13:50:11 +01:00
Luca Gladiator
014cee5bd1 Fix Rust binding memory leak 2023-01-18 10:52:35 +01:00
deadash
ca74497911 Add arch list feature control in Rust
Signed-off-by: deadash <dead.ash@hotmail.com>
2022-12-29 15:13:31 +08:00
Mio
af1c661a12 Update bindings 2022-07-06 09:33:45 +08:00
Bet4
3cc9005a47 Add TriCore constants to Rust bindings 2022-05-11 17:29:03 +08:00
20c0a4b643 Remove use_system_unicorn and build_with_cmake 2022-05-06 14:47:15 +02:00
Bet4
dafdcd3f06 Fix outdated version 2022-05-04 21:31:53 +08:00
a8e602801d Merge pull request #1569 from AfoHT/rustbindreadme
Fix Rust bindings readme example code
2022-04-30 11:12:31 +02:00
6d5000fe42 Format code 2022-04-30 11:07:48 +02:00
b9e7c78ae8 Revert to rc7 behaviour 2022-04-30 11:07:23 +02:00
ba132b974d Move tests to root directory
Reference: https://doc.rust-lang.org/stable/cargo/guide/project-layout.html
2022-04-29 23:40:03 +02:00
f49f62ecef Add dynamic_linage feature 2022-04-28 15:35:06 +02:00
1cce884c40 Format 2022-04-23 22:41:59 +02:00
f4ab42d930 By default try to find global installed unicorn if not specified 2022-04-23 22:41:34 +02:00
shuffle2
2912cd1e29 fix rust bindings build on windows (#1584)
Refine rust bindings.
2022-04-16 13:40:04 +02:00
a6f9fd17d5 Search cmake build root directory 2022-04-12 21:05:46 +02:00
e26953c06c Fix rust static build 2022-04-12 19:15:14 +02:00
Henrik Tjäder
d1372c28eb Make README code example compile 2022-04-06 13:31:12 +02:00
2f113b11d1 Fix symbol clash on bunlded static libs 2022-04-04 11:24:59 +02:00
ca81d46ad5 Merge pull request #1574 from nviennot/dev
Rust bindings for insn_invalid_hook
2022-04-03 10:27:00 +02:00