Commit Graph

125 Commits

Author SHA1 Message Date
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
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
Takacs, Philipp
e96ac42b2e Remove MMU hacks
Unicorn has included some ugly hacks to provide a envirement where vaddr == paddr.
These hacks where to use the full 64 bit mappings on x86 without init the mmu
and some memory redirect for MIPS.

The UC_TLB_CPU mode defaults to vaddr == paddr, therfor these hacks aren't
required anymore.
2023-03-28 14:02:17 +02:00
Takacs, Philipp
e25419bb2d add virtuall tlb
this virtuall tlb allows to use mmu indipendent of the architectur
2023-03-28 13:50:11 +02:00
Takacs, Philipp
b7b1a4d6b4 difference between stop_request and quit_request
quit_request is for internal use. This means the IP register was updated and
qemu needs to rebuild the translation blocks.

stop_request is set by the user (uc_emu_stop) to indecate that unicorn sould
stop emulating.
2023-03-07 14:38:49 +01:00
Nguyen Anh Quynh
eb118528b1 rename memory_mapping() to find_memory_region() and simplify mem_map() 2023-02-06 17:59:16 +08:00
mio
19d8876e23
Deep copy for arm cpu state 2022-10-01 00:14:08 +02:00
lazymio
6d61aec82f
Format code 2022-06-02 14:46:26 +02:00
lazymio
fdd129fd30
Remember the regions a hook has intrumented and clear cache on deletion 2022-06-02 14:46:02 +02:00
lazymio
b827ebf4c3
Format code 2022-05-07 00:30:18 +02:00
lazymio
345b63ee96
Only exit TB if pc is within the memory range 2022-05-07 00:16:31 +02:00
Eric Poole
cfee2139a0
TriCore Support (#1568)
* TriCore Support

python sample

* Update sample_tricore.py

Correct attribution

* Update sample_tricore.py

Fixed byte code to execute properly.

* Update sample_tricore.py

Removed testing artifact

* Added tricore msvc config-file.h

* Added STATIC to tricore config and added helper methods to symbol file generation.

* Update op_helper.c

Use built in crc32

* Fix tricore samples and small code blocks are now handled properly

* Add CPU types

* Generate bindings

* Format code

Co-authored-by: lazymio <mio@lazym.io>
2022-04-29 23:11:34 +02:00
lazymio
4e22744679
Support flushing translation blocks and flush when we don't need count hook 2022-04-26 01:17:58 +02:00
lazymio
1eeab7bb02
Format code 2022-03-06 23:40:50 +01:00
lazymio
09b15e9071
Fix exits wrongly cleared in nested uc_emu_start 2022-03-06 23:40:34 +01:00
lazymio
58fc952230
Remove armeb-softmmu and aarch64eb-softmmu 2022-02-12 14:15:54 +01:00
mio
7095605607
Merge branch 'dev' into systemz 2022-01-18 21:10:55 +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
lazymio
a5ceca6d51
Remove the static variable in flatviews_init
Or we may get an invalid old (and free-ed) uc instance reference
2022-01-15 22:11:14 +01:00
mio
faa689c0f0
Merge systemz to the latest uc2 codebase 2021-12-26 22:58:32 +01:00
Nguyen Anh Quynh
97b92d8861 initial systemz support 2021-12-06 04:19:37 +08:00
lazymio
78e0ddbc4d
Fix mmio unmap 2021-11-24 00:18:19 +01:00
lazymio
cb33fb2570
Format code 2021-11-23 23:23:02 +01:00
lazymio
7a1de17f37
Fix UC_HOOK_EDGE_GENERATED to work with indirect jump
For an indirect jump (lookup_tb_ptr), last_tb would be NULL
2021-11-23 00:25:55 +01:00
lazymio
87a391d549
Inline uc_tracecode when there is only exactly one hook 2021-11-21 16:44:39 +01:00
lazymio
8c2bc394bc
No need to save jmp_buf and uc in contexts
This reverts #1335 in fact
2021-11-16 21:18:27 +01:00
lazymio
247ffbe0e8
Support nested uc_emu_start calls 2021-11-16 21:07:03 +01:00
lazymio
dfbffa44ec
Support changing cpu model for ARM 2021-11-04 18:37:10 +01:00
lazymio
3e4b4af7d3
Support change page size 2021-11-04 17:03:30 +01:00
lazymio
bcf85be86d
Add a new hook type UC_HOOK_TCG_OPCODE 2021-11-03 01:46:24 +01:00
lazymio
c11b9aa5c3
Add a new hook type UC_HOOK_EDGE_GENERATED and corresponding sample 2021-11-01 23:27:35 +01:00
lazymio
b7e82d460c
Expose more TB related stuff 2021-11-01 22:11:43 +01:00
lazymio
fb45b287ba
Add multiple exits mechanism and tests&samples 2021-11-01 14:00:43 +01:00
lazymio
3dd2e0f95d
Basic implementation of uc_ctl 2021-11-01 00:39:36 +01:00
lazymio
e62b0ef255
Add clang-format and format code to qemu code style 2021-10-29 12:44:49 +02:00
lazymio
e695686c15
Remove AFL Integration by reverting 2021-10-26 11:22:21 +02:00
lazymio
1fa2eb688b
Fix UC_MODE_AFL and update config 2021-10-25 14:39:40 +02:00
lazymio
d965c0f159
Use UCLOG and fix uc_afl_fuzz 2021-10-25 10:46:52 +02:00
lazymio
dd7476a9bd
Initial import unicornafl 2021-10-25 00:51:16 +02:00
Nguyen Anh Quynh
aaaea14214 import Unicorn2 2021-10-03 22:14:44 +08:00
w4kfu-synacktiv
21ec6e8f83
Add ARM BE8 support (#1369)
Co-authored-by: w4kfu <gw4kfu@gmail.com>
2021-03-31 21:22:35 +08:00
lazymio
1044403d38
Implement uc_context_free (#1336)
* Implement uc_context_free

* Use uc_context_free for python bindings

* Format code

* Simplify code

* Move next,context inside while loop

* Add my name to CREDITS.TXT
2020-09-24 22:28:55 +08:00
Sunho Kim
abe452babc
Fix enabled hooks even after deleting them (#1315) 2020-09-10 10:03:36 +08:00
Nguyen Anh Quynh
2e0f753e6f save cpu->jmp_env in saving context, so uc_emu_start() can be reentrant. also improved Python binding on handling context 2020-06-05 20:12:44 +08:00
BrunoPujos
6cad700b69
fix recursive UC_HOOK_MEM callbacks for cross pages access (#1113)
Co-authored-by: bruno <bruno>
Co-authored-by: Nguyen Anh Quynh <aquynh@gmail.com>
2020-05-25 16:22:28 +08:00
Nguyen Anh Quynh
fbef45b18f remove UC_ERR_TIMEOUT, so timeout on uc_emu_start() is not considered error. added UC_QUERY_TIMEOUT to query exit reason 2020-05-24 23:54:45 +08:00
BAYET
881e08da01
Fix UAF when deleting hook while in hook callback #1127 (#1130)
* Handle the cpu context save in a more pythonic way, so the context can be serialized and reuse in an other process using the same emulator architecture and modes

* Fix type error ; mistakes a size_t uint64_t ; breaks in 32bit...

* Fix the UAF situation when deleting a hook while being in a hook callback. Added an attribute 'to_delete' to hooks, and a list hooks_to_del to delay the free of the hooks

* Minor fixes ; forgot return type of clear_deleted_hooks ; do not declare variable in for predicate
2020-05-07 14:24:48 +08:00
Charles Ferguson
f0b509c176
Ensure that hooks are unaffected by a request to stop emulation. (#1154)
This change removes the check for stop requests from the hook loop
macro.

Requests to stop emulation (uc_emu_stop) should only affect whether
the emulation stops. This isn't the case at present for the invocation
of hooks. If emulation is requested to be stopped (which is indicated
by `uc->stop_request`), the hooks will skip all execution. This means
that when the emulation stop is requested, some expected operations
may not occur before the emulation exits - leaving the system in an
inconsistent or broken state.

This is particularly obvious in the case where a CPU interrupt is
required, and a hook has been registered for such cases. The expected
operation is that the hook be called, and no CPU exception be raised
(because the hook has handled it). However, because of the short-cut
in the case where the `uc_emu_stop` function has been called out of
band (eg on another thread), this hook would not be called. In such
cases the execution would terminate with an error that an 'unhandled
CPU exception' occurred, and the hook would never have been called.

This probably affects other parts of the system, such as hooks which
handle remapping of memory on demand (UC_HOOK_MEM_READ_UNMAPPED and
friends) where the remap would not happen and instead an error about
the unmapped memory would be raised.

In all cases, it makes sense that execution continue normally until
the outer loop which controls the execution determines that the
emulation should stop. This will mean that for any given sequence of
events all the emulation operations are completed deterministically
regardless of when the stop request was received.
2020-05-05 08:36:50 +08:00