Commit Graph

3068 Commits

Author SHA1 Message Date
mio
920d076e51
Remove page-collection-locs 2024-09-21 22:03:44 +08:00
mio
6cc7e1d431
Also only reset if hooks are installed 2024-09-21 21:52:38 +08:00
mio
8816883bb3
Fix TLB for snapshots 2024-09-21 21:49:01 +08:00
mio
2cd227f804
Update symbols for tlb_reset_dirty_by_vaddr 2024-09-21 20:54:24 +08:00
mio
8f74405031
Update symbols 2024-09-21 20:51:35 +08:00
Andrei Warkentin
d01035767e
notdirty_write: fix store-related performance problems
Every store would always cause the tb_invalidate_phys_page_fast path to be invoked,
amounting to a 40x slowdown of stores compared to loads.

Change this code to only worry about TB invalidation for regions marked as
executable (i.e. emulated executable).

Even without uc_set_native_thunks, this change fixes most of the performance
issues seen with thunking to native calls.

Signed-off-by: Andrei Warkentin <andrei.warkentin@intel.com>
2024-09-21 20:50:43 +08:00
mio
9f21566b53
Also update macos 2024-09-21 20:48:51 +08:00
mio
7fb38e0e66
Avoid failure of pushing to github 2024-09-21 20:48:51 +08:00
lazymio
0d26efd07e
Merge pull request #2003 from elicn/dev
Misc. Python binding re-arrangements
2024-09-21 18:43:02 +08:00
lazymio
9427f0a553
Merge pull request #1991 from apparentlymart/b-riscv-invalidinsn-pcadj
riscv: Invalid 32-bit instruction should not decrement pc
2024-09-21 18:26:59 +08:00
mio
96bf47dd7a
Update CI 2024-09-21 18:24:46 +08:00
lazymio
22d6febff1
Merge pull request #1985 from atipls/dev
Update zig bindings to 0.13.0
2024-09-21 18:01:11 +08:00
mio
87c0b86248
Format code 2024-09-21 17:59:23 +08:00
mio
a5fa548049
Fix qemu_vfree implementation on MINGW
Also correctly release bounce.buffer
2024-09-21 17:58:15 +08:00
elicn
386e0ed575 Include networking auditing sample in script 2024-09-19 17:17:04 +03:00
elicn
5cc2d80916 Adjust import path to new path 2024-09-19 17:16:21 +03:00
elicn
f573356a8b Add initial support for batch operations 2024-09-19 17:15:24 +03:00
elicn
4471377b77 Styling fixes 2024-09-19 17:13:36 +03:00
elicn
754194c7e8 Improve documentation 2024-09-19 17:04:21 +03:00
elicn
2da154721b Remove repr surplus method 2024-09-19 17:00:33 +03:00
elicn
7deb613a3c Reduce namespace clutter 2024-09-19 16:58:03 +03:00
lazymio
379791ad56
Merge pull request #1995 from apparentlymart/f-qemu-backport-wfi-umode
[QEMU backport] riscv: fix wfi exception behavior
2024-09-04 15:36:00 +08:00
Jose Martins
58f1a612e8 target/riscv: fix wfi exception behavior
The wfi exception trigger behavior should take into account user mode,
hstatus.vtw, and the fact the an wfi might raise different types of
exceptions depending on various factors:

If supervisor mode is not present:

- an illegal instruction exception should be generated if user mode
executes and wfi instruction and mstatus.tw = 1.

If supervisor mode is present:

- when a wfi instruction is executed, an illegal exception should be triggered
if either the current mode is user or the mode is supervisor and mstatus.tw is
set.

Plus, if the hypervisor extensions are enabled:

- a virtual instruction exception should be raised when a wfi is executed from
virtual-user or virtual-supervisor and hstatus.vtw is set.

Signed-off-by: Jose Martins <josemartins90@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210420213656.85148-1-josemartins90@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2024-09-03 13:44:55 -07:00
Martin Atkins
ac1b37421d riscv: Invalid 32-bit instruction should not decrement pc
This line appears to be trying to undo the effect of adding 4 to pc above,
but does so incorrectly and so ends up returning with next_pc earlier than
it was prior to decoding.

This causes the translator to malfunction because it does not expect
pc_next to decrease during decoding: this is effectively reporting that
the invalid construction has a negative size, which is impossible. The
decoder uses the increase in next_pc to decide the translation block size,
but converts it to uint16_t thereby causing a block containing _only_ an
invalid instruction to be treated as having size 65532 (reinterpreted -4)
and therefore the translation loop tries to find the next translation block
at 65532 bytes after the invalid instruction, which can cause a spurious
instruction access/page fault if the page containing that address is not
mapped as executable.

In practice we don't need to readjust the pc at all here because it is
correct to report that the invalid instruction is four bytes long. This
allows the translation loop to correctly find the next instruction, and
to avoid producing spurious TLB fills that might cause incorrect exceptions.
2024-08-28 14:06:17 -07:00
atipls
da9b95501c Update zig bindings to 0.13.0 2024-08-08 10:15:50 +02:00
Duncan Ogilvie
87610baa3f
Fix emulator detection (#1966)
* Add a quick test helper macro to test_x86.c

* Add regression tests for bswap and rex prefixes

* Properly ignore REX prefixes when appropriate

* Fix bswap ax emulator detection
2024-07-19 11:11:21 +08:00
BitMaskMixer
8e6499fb0b
gcc compiler warning fixes (#1977)
* fix for enum-int-mismatch

* fix for unused-variable
2024-07-19 11:09:57 +08:00
scribam
1ed4c43ff3
Update cmake minimum required to version 3.5 (#1976) 2024-07-19 11:08:13 +08:00
scribam
feb166d475
Update github workflows (#1975) 2024-07-19 11:06:53 +08:00
PhilippTakacs
7d8b06b704
snapshot restore don't remove terminating regions (#1968) 2024-06-29 22:36:02 +08:00
Arsenii es3n1n
ddd6b7c254
build: allow CMAKE_MSVC_RUNTIME_LIBRARY #1958 (#1960) 2024-06-12 14:46:13 +08:00
Bet4
abefcb2f89
Remove using of distutils (#1964)
* Remove using of distutils

* Upgrade setuptools to fix CI

* Use Python 3.7 in build_wheel.sh
2024-06-12 14:45:23 +08:00
Jordan Moore
c39e80231c
Update Zig bindings to Zig 0.12.0 (#1951)
* update zig bindings to Zig 0.12.0

* support zig package manager

* Fix zig macos ci build

* Make the macos build use 1 process instead of hitting the macos
  process limit immediately, utilize the build.zig `-Dparallel
  false` option for macos ci
* Split the macos ci into a new build stage (out of the ubuntu,
  macos build maxtrix), to allow for multiple architecture builds
  in the future after the zig bindings improve
2024-05-06 21:02:24 +08:00
Nguyen Anh Quynh
751a4d0f03 compile warning: remove some unused vars 2024-05-02 16:26:41 +08:00
mio
85b289d074
Use correct lib path 2024-04-30 18:06:30 +08:00
mio
da84208d89
Hide symbols for unicorn-common 2024-04-29 11:55:06 +08:00
Nguyễn Anh Khoa
38091b3046
Add unicorn_py3 folder to setup.py (#1942)
* Add unicorn_py3 folder to setup.py

* Run sample in CI

* Fix pip install & py2 breakage

---------

Co-authored-by: mio <mio@lazym.io>
2024-04-28 00:11:05 +08:00
Nguyen Anh Quynh
c136b6b2bf fix some compiler warnings 2024-04-22 20:03:07 +08:00
Charles Ferguson
ef34d92b2f
Add hooks doc written by @gerph 2024-04-19 18:41:28 +08:00
lazymio
cff94a4a56
Merge pull request #1932 from lockbox/rust-conditional-compilation
Rust conditional compilation
2024-03-28 19:29:23 +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
lazymio
b4f2ac9aab
Merge pull request #1930 from lockbox/address-typo
Address typo in documentation of address in memory event callbacks
2024-03-20 13:52:31 +08:00
lockbox
321de00f36 [typo]: Correctly document address parameter in mem hook callbacks 2024-03-18 17:51:35 -04:00
lazymio
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
Mark Giraud
d4f5bf1be2
fix: Fix rust test that was missing a parameter 2024-03-11 12:31:54 +01:00
mio
e03109d8c9
Respect users' decision for UC_ERR_INSN_INVALID 2024-03-08 17:31:27 +08:00
mio
a9a54aed2f
Fix for xcode build 2024-03-08 17:28:46 +08:00
mio
4c4d582fcb
Also add _repr_ for UcReg 2024-03-08 17:07:08 +08:00
mio
13f17e5b3f
Apply repr for C structs 2024-03-08 16:48:31 +08:00