Commit Graph

823 Commits

Author SHA1 Message Date
lazymio
9167ab8671
Set riscv_get_pc for uc->get_pc 2022-05-21 00:02:22 +02:00
lazymio
cc4ed6ee50
Merge pull request #1621 from ondryaso/dev-registers
Support reads and writes over all Arm SIMD registers
2022-05-20 14:48:59 +02:00
lazymio
5d37e21db5
Don't call hooks if there is already an unhandled exception 2022-05-20 13:15:23 +02:00
Ondřej Ondryáš
f3b776dd7d Support reads and writes over all Arm SIMD registers 2022-05-20 00:30:11 +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
8fb4b45f57
Resume CPU for writing PC 2022-04-26 01:53:02 +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
656dde9f60
Fix MSVC build 2022-04-16 23:37:52 +02:00
lazymio
3d3deac5e6
Fix crash when mapping a big memory and calling uc_close 2022-04-16 19:17:41 +02:00
lazymio
b136f08f2d
Check CPU model for uc_ctl 2022-04-16 17:49:47 +02:00
shuffle2
2912cd1e29
fix rust bindings build on windows (#1584)
Refine rust bindings.
2022-04-16 13:40:04 +02:00
lazymio
e3d0a33ab8
Fix BE32 usermode address XOR 2022-04-05 11:55:58 +02:00
lazymio
7e64e620d2
Remove unassigned_io_write from ioport.c 2022-04-04 11:25:40 +02:00
lazymio
2f113b11d1
Fix symbol clash on bunlded static libs 2022-04-04 11:24:59 +02:00
rose
fc0d9a82a5 Fix clang-cl compile with CONFIG_INT128 in qemu 2022-04-03 16:30:26 -04:00
lazymio
7e6d21d27c
Fix memory leak in code_gen_buffer 2022-04-03 21:44:09 +02:00
Ilya Leoshkevich
7de130a5d7 s390x/tcg: Fix BRASL and BRCL with large negative offsets
This is a backport of the following upstream commits:
- commit fc3dd86a290a ("s390x/tcg: Fix BRASL with a large negative offset")
- commit 16ed5f14215b ("s390x/tcg: Fix BRCL with a large negative offset")

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
2022-03-17 14:23:57 +01:00
lazymio
09b15e9071
Fix exits wrongly cleared in nested uc_emu_start 2022-03-06 23:40:34 +01:00
lazymio
12fa73f2b6
Generate check_exit_request for the first tb
Consider this case:

   t:inc ecx,
     inc edx,
     jmp t

It would generate exactly one block and TB chain will generate an inline
jump. If we don't check exit at the entry of the block, we will never be
terminated.

This test case is recorded in the commit message since it's a bit
painful to write multithread related code that builds on all platforms.
2022-03-05 22:42:41 +01:00
lazymio
b7bc13650c
Sync PC after we exit
We should sync PC if there is no UC_HOOK_CODE hook
2022-03-05 22:42:41 +01:00
lazymio
9f62c71094
Sync PC for SYS instruction hook 2022-02-27 15:30:27 +01:00
lazymio
e5207a1363
Implement UC_HOOK_INSN for aarch64 MRS/MSR/SYS/SYSL 2022-02-27 15:28:31 +01:00
lazymio
8e2f70a35b
Merge pull request #1559 from yrashk/aarch64-use-map-jit
Problem: Could not allocate dynamic translator buffer
2022-02-25 22:46:19 +01:00
lazymio
d946114dfe
Set EFLAGS correctly on startup 2022-02-25 22:44:42 +01:00
lazymio
84e796494f
Format code 2022-02-25 22:24:25 +01:00
lazymio
caf2fe1ddb
Clear state when exiting from uc_emu_start
This may cause unexpected result when we are in a nested uc_emu_start
2022-02-25 22:23:44 +01:00
lazymio
ad4b56ad54
Remove armeb and aarcheb in configure 2022-02-22 15:28:16 +01:00
Yurii Rashkovskii
f652340bec Problem: Could not allocate dynamic translator buffer
`Could not allocate dynamic translator buffer` error while
trying to perform any memory-related operation.

This happens on aarch64 (MacBook Pro M1)

Solution: ensure aarch64 architecture is properly checked against

Fixes #1556
2022-02-20 07:46:30 -08:00
Bet4
d96083d4d1 Fix pc after ppc sc inst 2022-02-20 20:42:46 +08:00
lazymio
8d9ca1ce84
Format 2022-02-17 10:37:34 +01:00
lazymio
27ef63cc8d
Add UC_PPC_REG_CR 2022-02-15 22:07:53 +01:00
lazymio
73e4a90d3a
Manually revert 63a445cbba 2022-02-13 10:13:01 +01:00
lazymio
4266196b2d
Fix the divergence with master. 2022-02-13 10:08:58 +01:00
lazymio
e382ca102a
Fix the regression bug 2022-02-13 09:52:00 +01:00
lazymio
05b9a021dc
Merge pull request #1453 from scribam/reg-read-write-fpscr
unicorn_arm: add reg_read/write operations for FPSCR and FPSID
2022-02-13 09:02:32 +01:00
lazymio
52e0963cc7
Backward compatibility to enable full 64bits address space 2022-02-12 22:54:21 +01:00
lazymio
81eb7da837
Backward compatibility for c13_c0_3 2022-02-12 22:31:10 +01:00
lazymio
3c4477d622
Fix another undefined shift found by sanitizer 2022-02-12 19:57:19 +01:00
lazymio
93c602ead1
FIx anohter undefined shift 2022-02-12 19:47:51 +01:00
lazymio
e38b1c8af3
Fix the undefined shift 2022-02-12 19:37:32 +01:00
lazymio
e548cd9eb1
Fix the undefined shift 2022-02-12 18:22:56 +01:00
lazymio
d0de673208
Fix the undefined lshift negative numbers 2022-02-12 17:47:57 +01:00
lazymio
9ff335efdc
Fix memory leak of the empty_view 2022-02-12 15:47:25 +01:00
lazymio
c2bb5c8838
Fix ns and s in cp reg encoding 2022-02-12 14:29:42 +01:00
lazymio
58fc952230
Remove armeb-softmmu and aarch64eb-softmmu 2022-02-12 14:15:54 +01:00
lazymio
f511d4a807
Also return error for context read/write 2022-02-11 22:19:03 +01:00
lazymio
3e6665db00
Implement coprocessor register read/write for arm64 2022-02-11 22:13:01 +01:00
lazymio
8bc1489210
Implement coprocessor register read/write for arm 2022-02-11 21:45:37 +01:00
Nguyen Anh Quynh
141a558dd8 fix conflicts 2022-01-28 10:30:51 +08:00
Ilya Leoshkevich
ad984b9366 s390x TCG shift instruction fixes
Cherry-pick the following upstream commits:

521130f267 target/s390x: Fix SLDA sign bit index
57556b28af target/s390x: Fix SRDA CC calculation
df103c09bc target/s390x: Fix cc_calc_sla_64() missing overflows
6da170beda target/s390x: Fix shifting 32-bit values for more than 31 bits
2022-01-27 13:15:54 +01:00
lazymio
5f89981a3c
Free info->name on demand 2022-01-20 21:34:21 +01:00
lazymio
55b4865945
Fix memory leak of custom helpers 2022-01-20 19:50:57 +01:00
mio
7095605607
Merge branch 'dev' into systemz 2022-01-18 21:10:55 +01:00
mio
218bddc0e0
Only use MAP_JIT on Apple Silicon
MAP_JIT causes performance regression for fork()

See https://github.com/desktop/desktop/issues/12978
2022-01-18 21:01:49 +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
ea9c7425b0
Fix the wrong PC when arm translation fectches unmapped memory
This behavior keeps the same with Unicorn1, though, different from arm doc
2022-01-16 16:42:38 +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
lazymio
459a595a98
Merge branch 'dev' into s390x
Mostly for bindings update.
2022-01-15 20:56:39 +01:00
lazymio
6ed2214399
Rebuilt hflags when swithing modes
Or we may get the wrong mode during translation
2022-01-14 19:37:48 +01:00
lazymio
33afdcf872
Save CC at the end of emulation 2022-01-10 21:48:03 +01:00
lazymio
9ac796531a
Don't cache S390SkeyState and S390SkeysClass 2022-01-10 19:18:52 +01:00
lazymio
980eae7f44
Sync PC at the end of emulation 2022-01-10 15:45:56 +01:00
lazymio
441afe17e6
Add psw.mask register 2022-01-10 15:34:04 +01:00
lazymio
71f044ca50
Merge branch 'dev' into s390x 2022-01-10 15:17:42 +01:00
lazymio
36afa1022c
More PPC registers
Add FPR0-31, CR0-7, LR, CTR, MSR, XER, FPSCR for PPC

Add a test for ppc32 float point
2022-01-10 15:16:10 +01:00
lazymio
be7fbf1306
Handle CPU fault when invalidating TB cache 2022-01-08 22:10:17 +01:00
lazymio
8ad9f8ecb1
This reverts Hack 05ba21160619724033ec83469bbb66bda9e3f5fb and applies the correct fix
And enable experimental v8 support for arm max cpu
2022-01-05 21:58:40 +01:00
lazymio
c3a49766d8
Fix #1522 2022-01-05 20:02:41 +01:00
lazymio
7a886f59df
Fix #1525 2022-01-05 19:38:22 +01:00
lazymio
6fabf30537
Fix a invalid memory access
Note: This probably addresses the ramdom failed CI on mingw64
2022-01-05 19:12:36 +01:00
lazymio
d854e22301
Add x87 FPU registers #1524 2022-01-04 21:12:12 +01:00
lazymio
47097b55b7
Fix #1520 2022-01-04 21:01:20 +01:00
scribam
039cd50187 unicorn_arm: add reg_read/write operations for FPSCR and FPSID 2022-01-04 11:36:06 +01:00
Nguyen Anh Quynh
e55b76f057 s390x: cleanup & re-enable some skey code 2021-12-31 10:05:05 +08:00
Nguyen Anh Quynh
1a0f0d0768 s390x: remove some unused fields in S390CPU 2021-12-31 09:48:16 +08:00
lazymio
a06563ecdd
Fix memory leak 2021-12-31 00:24:18 +01:00
lazymio
3b667338cf
Fix s390x warnings 2021-12-31 00:10:50 +01:00
Nguyen Anh Quynh
fa3fb82c9c s390x: fix warning on commented code 2021-12-30 17:17:49 +08:00
mio
085ee07c73
No more hard-coded cpu models 2021-12-30 01:05:10 +01:00
mio
fdbd743c21
Remove hard-coded cpu model 2021-12-30 00:54:55 +01:00
mio
a72cbda6de
Initialize empty structs explictly to build on MSVC 2021-12-30 00:51:07 +01:00
mio
03f9dd8b61
Expand case ranges to build on MSVC 2021-12-30 00:42:13 +01:00
mio
dc402d78ec
Ignore QEMU_BUILD_BUG_MSG on MSVC 2021-12-30 00:28:24 +01:00
mio
ab4ef2e1de
Fix MSVC build and remove warning about unused functions 2021-12-30 00:26:25 +01:00
mio
298795a9f8
Fix build on MSVC 2021-12-29 23:18:49 +01:00
mio
034a1aa5f2
Make s390x stopping mechanism work 2021-12-27 23:48:20 +01:00
mio
a38151bf77
Make s390x skey work 2021-12-27 23:19:17 +01:00
mio
e977f81813
Make s390x build 2021-12-26 23:09:25 +01:00
mio
faa689c0f0
Merge systemz to the latest uc2 codebase 2021-12-26 22:58:32 +01:00
lazymio
cddc9cf2ed
Fix arm post init 2021-12-25 00:16:51 +01:00
lazymio
4f73d75ea8
Fix #1500 2021-12-23 21:46:27 +01:00
lazymio
ef6f8a2427
Fix x86 CPUID 2021-12-22 23:39:41 +01:00
lazymio
7bb756249a
Better design of cpuid instruction hook 2021-12-22 20:36:56 +01:00
Dimitris Glynos
63a445cbba
fxsave / fxsave64 should store the floating point instruction pointer (fpip) (#1467)
* fxsave / fxsave64 should store the floating point instruction pointer (fpip)
- fxsave / fxsave64 happen to be used as GetPC code in exploits

* unit tests for the storage of FPIP in fxsave (x86) and fxsave64 (x64)
2021-12-13 08:40:32 +08:00
Nguyen Anh Quynh
09b0c66f11 move all static vars in translate.c to tcg.h 2021-12-07 04:53:32 +08:00
Fedor Nis'kov
4059906e78 Bug fix for LUI instruction (MIPS) 2021-12-06 19:15:00 +03:00
Nguyen Anh Quynh
b042a6a01d add missing files 2021-12-06 04:28:13 +08:00
Nguyen Anh Quynh
97b92d8861 initial systemz support 2021-12-06 04:19:37 +08:00
lazymio
8a0ca8715e
Fix SR read/write and a test 2021-12-04 23:22:28 +01:00
Brandon Miller
d204dc6374
Added SR to M68K reg_read and reg_write (#1507) 2021-12-02 14:12:49 +08:00
lazymio
221cde18df
Write CPSR as it is initiated from instructions to allow regs switch 2021-11-24 17:10:51 +01:00
lazymio
78e0ddbc4d
Fix mmio unmap 2021-11-24 00:18:19 +01:00
lazymio
c733bbada3
Fix wrong offset used in split_region 2021-11-23 23:22:53 +01:00
lazymio
c1c5f72918
Fix the sizemask for inline hooking 2021-11-23 21:18:21 +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
083ccf160b
Use fprintf 2021-11-22 21:22:21 +01:00
lazymio
87a391d549
Inline uc_tracecode when there is only exactly one hook 2021-11-21 16:44:39 +01:00
lazymio
c1106b811b
Fix a memory leak in mmio 2021-11-16 22:44:03 +01:00
lazymio
fc467edbc6
Fix 32bit target getting wrong offset for mmio 2021-11-16 22:40:57 +01:00
lazymio
247ffbe0e8
Support nested uc_emu_start calls 2021-11-16 21:07:03 +01:00
lazymio
43c643d4af
Fix #1488 2021-11-16 09:41:21 +01:00
lazymio
7e244f87b4
Fix UC_HOOK_EDGE_GENERATED implementation 2021-11-11 22:15:15 +01:00
lazymio
23ef5da491
Merge pull request #1481 from bet4it/cp15
Restore cp15 registers
2021-11-09 16:50:31 +01:00
Bet4
acaed986b5 Restore cp15 registers 2021-11-09 13:13:08 +08:00
lazymio
640251e1aa
Leave out size parameter in callback 2021-11-09 00:21:34 +01:00
lazymio
2f61592ff9
Fix uc_mem_protect 2021-11-07 20:37:58 +01:00
lazymio
c6fdbb3735
Add RISCV CSR registers 2021-11-07 20:36:04 +01:00
George Hotz
7268c2a19b
mips: support reading and writing of hi/lo regs 2021-11-07 20:27:02 +01:00
lazymio
94a82ed94d
Ensure JIT protection is disabled when generating TB 2021-11-07 20:23:25 +01:00
lazymio
613ddf0985
Format 2021-11-04 19:58:44 +01:00
lazymio
871de4ad65
Split mips cpu to 32 and 64 2021-11-04 19:58:32 +01:00
lazymio
0555095388
Support changing cpu model for ppc 2021-11-04 19:53:02 +01:00
lazymio
e5a2eae173
Add comment for default cpu model 2021-11-04 19:22:50 +01:00
lazymio
64452e249d
Support changing cpu model for sparc 2021-11-04 19:22:08 +01:00
lazymio
b0280f5e55
Support changing cpu model for m68k 2021-11-04 19:16:35 +01:00
lazymio
172a2fbe6d
Support changing cpu model for riscv 2021-11-04 19:13:53 +01:00
lazymio
435ac71f47
Support changing cpu model for x86 2021-11-04 19:10:29 +01:00
lazymio
837c3be347
Support changing cpu model for MIPS 2021-11-04 19:05:56 +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
3ead1731fe
Also instrument sub2
In this case, users don't need to care about the stuble difference inside tcg opcode
2021-11-03 23:48:09 +01:00
lazymio
67e2386da6
Add test and close #1477 2021-11-03 21:40:13 +01:00
lazymio
6b5529fcb7
Merge pull request #1458 from bet4it/patch
Port some patches from Unicorn1 to Unicorn2
2021-11-03 20:59:42 +01:00
lazymio
9818840f4e
Add tests for UC_HOOK_TCG_OPCODE 2021-11-03 20:56:45 +01:00
lazymio
09aa0f944f
Merge QDucasse:riscv_extension_d
Fix and close #1469

Fix test for riscv float points

Fix the riscv cpu config we left out
2021-11-03 13:20:46 +01:00
lazymio
bcf85be86d
Add a new hook type UC_HOOK_TCG_OPCODE 2021-11-03 01:46:24 +01:00
lazymio
eb75d459f0
Add a regression test for invalidating empty TB and have a better solution 2021-11-03 01:07:06 +01:00
Bet4
aaf340d9e4 Merge branch 'dev' into patch 2021-11-02 18:36:22 +08: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
6c3960242b
Format unicorn_arm and unicorn_aarch64 2021-11-01 10:17:58 +01:00
lazymio
0a3e46bf4f
Format 2021-11-01 09:41:25 +01:00
lazymio
3dd2e0f95d
Basic implementation of uc_ctl 2021-11-01 00:39:36 +01:00
lazymio
84abf1d3a4
A stronger test and handle addr_end = 0 2021-10-31 21:01:55 +01:00
lazymio
4bcf1c4a7c
Flush TB at exit with a better approach instead of flushing tlb in uc1 2021-10-31 19:43:56 +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
7ac7c23c12
Fix Windows build for AFL integration 2021-10-25 16:11:58 +02:00