Commit Graph

38 Commits

Author SHA1 Message Date
958ed09153 No longer need SPRR and probe it runtime 2024-12-07 23:33:34 +08:00
PhilippTakacs
ab23d4ceb0 Optimize Notdirty write (#2031)
* enable notdirty_write for snapshots when possible

Snapshots only happens when the priority of the memory region is smaller
then the snapshot_level. After a snapshot notdirty can be set.

* disable notdirty_write for self modifying code

When SMC access the memory region more then once the
tb must be rebuild multible times.

fixes #2029

* notdirty_write better hook check

Check all relevant memory hooks before enabling notdirty write.
This also checks if the memory hook is registered for the affected
region. So it is possible to use notdirty write and have some hooks
on different addresses.

* notdirty_write check for addr_write in snapshot case

* self modifying code clear recursive mem access

when self modifying code does unaligned memory accese sometimes
uc->size_recur_mem is changed but for notdirty write not changed back.
This causes mem_hooks to be missed. To fix this uc->size_recur_mem is
set to 0 before each cpu_exec() call.
2024-11-01 00:02:11 +08:00
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
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
71c729a9d7 Define HAVE_SPRR 2024-02-13 19:09:35 +08:00
78ea3c8301 Fix m1 defines 2024-02-13 11:52:10 +08:00
a6fb2a6870 Save jit state before/after callback 2024-02-13 11:13:01 +08:00
822bb527f3 M1 W^X fully supported 2024-02-12 00:10:44 +08:00
mio
49ccbde2d0 Leave out essential files
Co-authored-by: ζeh Matt <5415177+ZehMatt@users.noreply.github.com>
2023-06-10 23:44:05 +02:00
mio
8dffbc159c Add uc_ctl_get/set_tcg_buffer_size
We still need this API because the virtual memory address space of

32 bits os is only 4GB and we default need 1G per instance

Credits to @ZehMatt for original idea

Co-authored-by: ζeh Matt <5415177+ZehMatt@users.noreply.github.com>
2023-06-10 23:36:02 +02:00
mio
f8c7969d65 Revert "Add uc_ctl_get/set_tcg_buffer_size"
This reverts commit 3145e3c426 because not
properly co-authoer-ed.
2023-06-10 23:29:56 +02:00
mio
3145e3c426 Add uc_ctl_get/set_tcg_buffer_size 2023-06-10 16:08:29 +02:00
mio
5057f9925b Fix typo 2023-06-10 15:26:29 +02:00
mio
9de80cb625 Correct calling convention 2023-06-10 15:03:59 +02:00
mio
3d5b2643f0 Support demand paging via closures and seh
Reverts 12a79192ee which exploits normal tcg mechanism

This uses a trampoline to pass extra data to seh handlers
2023-06-10 14:04:56 +02:00
Choongwoo Han
cfaa5be912 Comment out more unused page lock functions 2023-05-26 12:52:25 -07:00
Choongwoo Han
75d26b7707 Ignore page_collection_lock 2023-05-23 13:11:36 -07:00
Mio
bbbc7856ac Invalidate tb cache once mapping is removed 2023-04-12 20:56:54 +08:00
mio
a25adf84f0 Rename flags to avoid confusion 2023-01-28 22:18:39 +01:00
mio
12a79192ee Demand paging on Windows 2023-01-28 22:04:43 +01:00
mio
2c00546c6e Merge rhelmot's fix 2022-08-14 13:35:54 +02:00
4e22744679 Support flushing translation blocks and flush when we don't need count hook 2022-04-26 01:17:58 +02:00
7e6d21d27c Fix memory leak in code_gen_buffer 2022-04-03 21:44:09 +02:00
d0de673208 Fix the undefined lshift negative numbers 2022-02-12 17:47:57 +01:00
mio
28e791a37f Add debug tracing feature
It's disabled by default, use -DUNICORN_TRACER=on to enable it
2022-01-18 19:35:43 +01:00
be7fbf1306 Handle CPU fault when invalidating TB cache 2022-01-08 22:10:17 +01:00
c733bbada3 Fix wrong offset used in split_region 2021-11-23 23:22:53 +01:00
87a391d549 Inline uc_tracecode when there is only exactly one hook 2021-11-21 16:44:39 +01:00
43c643d4af Fix #1488 2021-11-16 09:41:21 +01:00
94a82ed94d Ensure JIT protection is disabled when generating TB 2021-11-07 20:23:25 +01:00
eb75d459f0 Add a regression test for invalidating empty TB and have a better solution 2021-11-03 01:07:06 +01:00
c11b9aa5c3 Add a new hook type UC_HOOK_EDGE_GENERATED and corresponding sample 2021-11-01 23:27:35 +01:00
b7e82d460c Expose more TB related stuff 2021-11-01 22:11:43 +01:00
0a3e46bf4f Format 2021-11-01 09:41:25 +01:00
3dd2e0f95d Basic implementation of uc_ctl 2021-11-01 00:39:36 +01:00
84abf1d3a4 A stronger test and handle addr_end = 0 2021-10-31 21:01:55 +01:00
Nguyen Anh Quynh
aaaea14214 import Unicorn2 2021-10-03 22:14:44 +08:00