Commit Graph

730 Commits

Author SHA1 Message Date
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
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
mio
567bd08b86
Update riscv pc and fix #1465 2021-10-19 23:22:13 +02:00
Bet4
c400924fe1
Merge branch 'dev' into patch 2021-10-17 18:18:09 +08:00
mio
6d0d0897f8
Fix Rust build and CI.
Add a test for ppc and fix ppc on windows.
2021-10-17 02:11:38 +02:00
Sven Almgren
f27c6fa655 X86 instruction FTST was incorrectly overwriting ST0 instead of FT0 (#1372)
* X86 instruction FTST was incorrectly overwriting ST0 instead of FT0

* credits update
2021-10-12 08:41:57 +08:00
Bet4
5f40667d91 Support querying architecture mode besides arm (#1389) 2021-10-11 11:39:23 +08:00
David CARLIER
e2a924a32b qemu_getauxval FreeBSD implementation backport (#1366) 2021-10-11 11:22:16 +08:00
lazymio
8ab7e0626d
To make dockcross-x86 happy 2021-10-06 11:53:34 +02:00
lazymio
76a1b4661c
Fix a memory leak due to wrong free order 2021-10-06 10:11:04 +02:00
mio
ae1b6ad89b
Support building on Android arm aarch64 x86 x86_64
1. Add cmake support in CMakeLists.txt according to https://developer.android.com/ndk/guides/other_build_systems

2. Resolve symbols errors

3. Backport fixes from 438ed42311

   > QEMU relies on two optimization for ppc64 and arm:
   >
   > 1. if(0) /* optimized code */
   > 2. assert(0); /* optimized code */
   >
   > But the assert on mingw32 doesn't have noreturn attribute which prevents
   > the second optimization and some code is reverted to the original code
   > to fit in the first optimization.
   >
   > The assert implementation is copied from glib as qemu did.

   Unfortunately, NDK also doesn't have an assert implementation qemu prefers.
2021-10-06 04:42:44 +08:00
mio
9d8a309fbf
Allow user to instrument cpuid instruction 2021-10-05 17:15:49 +02:00
mio
bccc7f2fb7
Remove NULL tcg arg and add a test for sysenter 2021-10-04 18:50:42 +02:00
mio
ebb468d042
Fix msvc build 2021-10-04 10:44:30 +02:00
mio
81942e9097
Manually fix for #1232 2021-10-03 23:23:55 +02:00
mio
2d043d387d
Change mips model to add DSP 2021-10-03 23:10:39 +02:00
Nguyen Anh Quynh
aaaea14214 import Unicorn2 2021-10-03 22:14:44 +08:00
lazymio
225d387325
Fix wrong sync after UC_ERR_[READ, WRITE, FETCH]_[UNMAPPED, PROT] (#1368)
* Fix wrong sync after UC_ERR_[READ, WRITE, FETCH]_[UNMAPPED, PROT]

Note that:
1. We only guarantee the pc (and other internal states) is correct
if and only of `uc_emu_start` returns without any error (or errors
have been handled in callbacks.).
2. If memory read/write error isn't handled by hooks, the state is
undefined and the pc is probably wrong if no hook is installed.

This fixes #1323.

* Rename variables

* Add note in unicorn.h

* Refine test_i386_invalid_mem_read_in_tb
2021-05-12 00:10:45 +08:00
Sven Almgren
58c50c4be7
X86 instruction FTST was incorrectly overwriting ST0 instead of FT0 (#1372)
* X86 instruction FTST was incorrectly overwriting ST0 instead of FT0

* credits update
2021-05-08 18:45:14 +08:00
lazymio
b0f1e46f61
Fix fpip (#1385)
* Revert partial #74

* Import fix from https://lists.nongnu.org/archive/html/qemu-devel/2021-04/msg02868.html

* Fix capstone usage
2021-04-26 00:32:42 +08:00
Bet4
811e77c7aa
Support querying architecture mode besides arm (#1389) 2021-04-26 00:31:29 +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
Rami Ali
34ddafcbcf
Fix pausing within Thumb2 ITE blocks (#853) (#880)
Co-authored-by: Rami Ali <flowergrass@users.noreply.github.com>
2021-03-29 22:54:45 +08:00
David CARLIER
7ca7e8a79d
qemu_getauxval FreeBSD implementation backport (#1366) 2020-12-31 18:53:36 +08:00
Carlo Bramini
4b34042e02
Make Unicorn buildable with MinGW (#1364)
* [WIN32] Allow to build also with MinGW

* [WIN32] Fix build for MinGW
2020-12-23 13:27:06 +08:00
pkubaj
95bc0bdc21
Fix build with LLVM on powerpc64(le) (#1347)
Conflicting symbols need to be undefined before including altivec.h.
2020-10-25 07:34:57 +08:00
lazymio
644da9babc
Fix setjmp/longjmp on native Windows (#1331)
* Add setjmp wrapper

* Add to projects

* Use wrapper on x64

* Always build on x64 and exclude on win32

* Fix signature

* Add comments

* Add comments for os-win32.h

* Add extern decleration

* Support cmake Windows build

* Fix for MinGW
2020-09-22 02:02:43 +08:00
liangjs
225f6f2889
Return 'indefinite integer value' for invalid SSE fp->int conversions (#1306)
Merge from qemu commit 1e8a98b53867f61da9ca09f411288e2085d323c4.
1e8a98b538
2020-09-21 10:39:00 +08:00
mogoreanu
748aceb760
Add qemu_ prefix to bitmap_set and bitmap_clear to avoid conflicts. (#1326)
When unicorn and systemd are combined into a single binary the 2
libraries conflict on bitmap_set and bitmap_clear functions which breaks
unicorn.

Co-authored-by: Nicolae Mogoreanu <mogo@google.com>
2020-09-16 17:09:10 +08:00
lazymio
c1c0baec7d
Fix IP value for UC_MODE_16 (#1321) 2020-09-10 10:02:22 +08:00
h01G3r
a9025c58a4
fixes an issue with ARM APSR register handling: (#1317)
- Q flag / GE flag were not included in APSR register (read/write)
  - UC_ARM_REG_APSR_NZCV register constant was ignored completely.
  - regression test added
2020-08-20 23:24:04 +08:00
liangjs
3134f33029
fix 64-bit fstenv (#1300)
* fix 64-bit fstenv

* fix fstenv
2020-06-28 01:43:14 +08:00
Nguyen Anh Quynh
7ea04acbdc fix some uninitialized vars in fpu 2020-06-07 11:22:18 +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
Dominik Maier
a4784cc96c
fix error handling of mmap() calls (#1283) 2020-06-05 10:30:23 +08:00
Catena cyber
71a4ab4a6f
Removes some bugs found by oss-fuzz (#1266)
Leak on breakpoints
Undefined shift in ARM
2020-05-26 20:52:40 +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
Catena cyber
690ada5f6a
Oss-fuzz ideal integration (#1265)
* Adds oss-fuzz badge

* Generic fix for watchpoints leak
2020-05-23 09:59:30 +08:00
Chen Huitao
17cfef0e56
fix some oss-fuzz (#1259)
* fix oss-fuzz 22107.

* fix oss-fuzz 22112.

* clean up build target.

* fix oss-fuzz 22226.

* fix oss-fuzz 22227.

* fix oss-fuzz 11640.

* fix oss-fuzz 20772.

* remove warning.

* fix oss-fuzz 10459.
2020-05-22 21:58:39 +08:00
Catena cyber
216c348c35
Oss-fuzz ideal integration (#1262)
* Fix watchpoint leak in ARM

* Builds fuzz targets with sanitizer support

* Builds fuzz targets with directory driver

* Adds script to dowlonad public corpus

* Adds CIfuzz

To checks Pull Requests with fuzzing

* Use static library for fuzz targets

* Less verbose logs for fuzz driver directory
2020-05-21 16:15:12 +08:00
Chen Huitao
2c66acf4ee
fix #1246 (#1254)
* fix finding python path which only has python3.

* fix #1246, arm host issue.

* skip assembler tests on non-x86 host.

* update macro of dummy value.

* fix MSVC macro.

* update dummy array value macro.

* restore to original qemu code.
2020-05-18 19:57:44 +08:00
Chen Huitao
08240d5453
fix some oss-fuzz (#1258)
* fix oss-fuzz 22107.

* fix oss-fuzz 22112.

* clean up build target.

* fix oss-fuzz 22226.

* fix oss-fuzz 22227.

* fix oss-fuzz 11640.

* fix oss-fuzz 20772.
2020-05-16 10:38:16 +08:00
Chen Huitao
18a187b8f8
fix some oss-fuzz (#1255)
* fix oss-fuzz 22107.

* fix oss-fuzz 22112.

* clean up build target.
2020-05-12 01:27:47 +08:00
Nguyen Anh Quynh
f988a41369 x86: support read/write to ST registers 2020-05-11 00:24:58 +08:00
el poto rico
149121539b
[arm64] Add some cool registers (#1253)
I've added the following registers to the API:

 * PSTATE
 * Exception link registers (ELR_ELx)
 * Stack pointers registers (SP_ELx)
 * MMU (TTBRn_EL1)
 * Exception syndrom registers (ESR_ELx)
 * Faulting virtual address registers (FAR_ELx)
 * PAR (PAR_EL1)
 * MAIR (MAIR_EL1)
 * Vector base address registers (VBAR_ELx)
2020-05-10 21:50:00 +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
Chen Huitao
f435efd4a7
fix some oss-fuzz (#1249)
* fix oss-fuzz 21012.

* fix oss-fuzz 21741.

* fix oss-fuzz 21743.
2020-05-05 11:11:59 +08:00
Dominik Maier
625399774c
X64 base regs (#1166)
* x86: setup FS & GS base

* Fixed base register writes for x64, removed then for x16/x32 (the don't exist there?)

* FS reg comes before GS so the base regs do so, too

* added shebang to const_generator.py

* Added base regs to and added 'all' support to const_generator

Co-authored-by: naq <aquynh@gmail.com>
2020-05-05 08:34:51 +08:00
Charles Ferguson
b7e64f3c99
Fix block hooks being called twice after an early exit from execution. (#1194)
Ensure the TCG exit flag is cleared at the end of cpu_exec. This ensures
that subsequent calls are not polluted by the prior call to request an
early exit. The symptoms of the problem being addressed here are that
after a cpu_exit call triggered within a hook there may still be a
pending tcg_exit_req flag set. This then causes a block to start its
execution and then be aborted (from which point it'll continue because
there's no other condition to service). The start of the execution
causes the block hook to be called, no actual code to be run, and then
the block started again with another block hook call.

This change is discussed in ticket 1193:
    https://github.com/unicorn-engine/unicorn/issues/1193
2020-05-05 08:32:12 +08:00
Nguyen Anh Quynh
0cd66bab8a fix qemu/scripts/qapi-build.sh 2020-04-30 14:00:48 +08:00
Nguyen Anh Quynh
00bbe2ce7d we do not need Python to build anymore 2020-04-30 13:58:33 +08:00
Nguyen Anh Quynh
27167a8ccb delete unused qemu/scripts/qapi-event.py 2020-04-30 11:13:28 +08:00
Nguyen Anh Quynh
0d93f055b4 cleanup qemu/configure 2020-04-28 16:46:41 +08:00
Nguyen Anh Quynh
2b13230a4d qemu/Makefile cleanup 2020-04-28 13:50:50 +08:00
Nguyen Anh Quynh
21b5c122a3 qemu/Makefile cleanup 2020-04-28 13:34:16 +08:00
Nguyen Anh Quynh
06d741242d qemu/Makefile cleanup 2020-04-28 13:30:18 +08:00
Chen Huitao
414c230b59
fix m68k func name (#1245)
* fix finding python path which only has python3.

* fix m68k func name.
2020-04-28 09:51:45 +08:00
Nguyen Anh Quynh
9a70675975 qemu/Makefile cleanup 2020-04-28 09:39:10 +08:00
Nguyen Anh Quynh
49473d7780 Merge branch 'master' of github.com:unicorn-engine/unicorn 2020-04-28 08:58:41 +08:00
Nguyen Anh Quynh
709d081972 more qemu/Makefile* cleanup 2020-04-28 02:38:51 +08:00
Nguyen Anh Quynh
dd28727e99 more qemu/Makefile* cleanup 2020-04-28 01:53:39 +08:00
Nguyen Anh Quynh
cdd9340113 cleanup qemu Makefile* 2020-04-27 23:01:26 +08:00
Nguyen Anh Quynh
d2c66b8386 cleanup qemu/configure 2020-04-27 20:44:11 +08:00
Chen Huitao
8905ecd5e4
move some operations after hook callback (#1243)
* fix finding python path which only has python3.

* move some operations after hook callback.
2020-04-27 19:54:58 +08:00
Nguyen Anh Quynh
5826b1fa54 Merge branch 'master' of github.com:unicorn-engine/unicorn 2020-04-27 01:51:59 +08:00
Nguyen Anh Quynh
cc5bfbc844 delete unused file i386-softmmu.mak 2020-04-27 01:31:39 +08:00
Nguyen Anh Quynh
0ac28359a3 Makefile cleanup 2020-04-25 17:54:14 +08:00
Nguyen Anh Quynh
d947b5f76f cleanup qemu Makefile 2020-04-24 18:06:21 +08:00
Nguyen Anh Quynh
dff96a24a1 cleanup qemu/Makefile* 2020-04-24 15:34:06 +08:00
Nguyen Anh Quynh
d4b9f436f0 more ppc cleanup 2020-04-13 17:55:16 +08:00
Nguyen Anh Quynh
148fa4d66d cleanup: we do not support PowerPC 2020-04-13 17:37:06 +08:00
Chen Huitao
b5f9441689
fix some oss-fuzz bugs (#1233)
* fix oss-fuzz 18138.

* fix oss-fuzz 20079.

* fix oss-fuzz 20209.

* fix oss-fuzz 20210.

* fix oss-fuzz 20262.

* rollback.

* rollback.

* fix oss-fuzz 20079.

* fix oss-fuzz 20179.

* fix oss-fuzz 20195.

* fix oss-fuzz 20206.

* fix oss-fuzz 20207.

* fix oss-fuzz 20265.

* fix oss-fuzz 20285.

* fix oss-fuzz 20868.

* fix oss-fuzz 20908.

* fix oss-fuzz 20909.

* fix oss-fuzz 20914.

* fix oss-fuzz 20922.

* fix oss-fuzz 20928.

* remove warnigs.

* fix oss-fuzz 20961.

* fix oss-fuzz 21005.

* remove clang warnings.

* fix oss-fuzz 21043.

* fix oss-fuzz 21047.

* fix oss-fuzz 21050.

* fix oss-fuzz 21219.

* fix oss-fuzz 21380.

* fix oss-fuzz 21455.

* fix oss-fuzz 21458.

* fix oss-fuzz 21650.

* fix oss-fuzz 21651.
2020-04-13 16:34:07 +08:00
Chen Huitao
4d7193eeb3
fix some oss-fuzz (#1229)
* fix oss-fuzz 18138.

* fix oss-fuzz 20079.

* fix oss-fuzz 20209.

* fix oss-fuzz 20210.

* fix oss-fuzz 20262.

* rollback.

* rollback.

* fix oss-fuzz 20079.

* fix oss-fuzz 20179.

* fix oss-fuzz 20195.

* fix oss-fuzz 20206.

* fix oss-fuzz 20207.

* fix oss-fuzz 20265.

* fix oss-fuzz 20285.

* fix oss-fuzz 20868.

* fix oss-fuzz 20908.

* fix oss-fuzz 20909.

* fix oss-fuzz 20914.

* fix oss-fuzz 20922.

* fix oss-fuzz 20928.

* remove warnigs.

* fix oss-fuzz 20961.

* fix oss-fuzz 21005.

* remove clang warnings.

* fix oss-fuzz 21043.

* fix oss-fuzz 21047.

* fix oss-fuzz 21050.

* fix oss-fuzz 21219.

* fix oss-fuzz 21380.

* fix oss-fuzz 21455.

* fix oss-fuzz 21458.
2020-04-08 03:37:12 +08:00
Chen Huitao
930cb9ada8
fix some oss-fuzz (#1224)
* fix oss-fuzz 18138.

* fix oss-fuzz 20079.

* fix oss-fuzz 20209.

* fix oss-fuzz 20210.

* fix oss-fuzz 20262.

* rollback.

* rollback.

* fix oss-fuzz 20079.

* fix oss-fuzz 20179.

* fix oss-fuzz 20195.

* fix oss-fuzz 20206.

* fix oss-fuzz 20207.

* fix oss-fuzz 20265.

* fix oss-fuzz 20285.

* fix oss-fuzz 20868.

* fix oss-fuzz 20908.

* fix oss-fuzz 20909.

* fix oss-fuzz 20914.

* fix oss-fuzz 20922.

* fix oss-fuzz 20928.

* remove warnigs.

* fix oss-fuzz 20961.

* fix oss-fuzz 21005.

* remove clang warnings.

* fix oss-fuzz 21043.

* fix oss-fuzz 21047.

* fix oss-fuzz 21050.

* fix oss-fuzz 21219.
2020-03-24 16:23:04 +08:00
Chen Huitao
4ca2c7f0b0
fix some oss-fuzz (#1218)
* fix oss-fuzz 18138.

* fix oss-fuzz 20079.

* fix oss-fuzz 20209.

* fix oss-fuzz 20210.

* fix oss-fuzz 20262.

* rollback.

* rollback.

* fix oss-fuzz 20079.

* fix oss-fuzz 20179.

* fix oss-fuzz 20195.

* fix oss-fuzz 20206.

* fix oss-fuzz 20207.

* fix oss-fuzz 20265.

* fix oss-fuzz 20285.

* fix oss-fuzz 20868.

* fix oss-fuzz 20908.

* fix oss-fuzz 20909.

* fix oss-fuzz 20914.

* fix oss-fuzz 20922.

* fix oss-fuzz 20928.

* remove warnigs.
2020-03-02 09:44:53 +08:00
Chen Huitao
65614075d2
fix some oss-fuzz (#1213)
* fix oss-fuzz 18138.

* fix oss-fuzz 20079.

* fix oss-fuzz 20209.

* fix oss-fuzz 20210.

* fix oss-fuzz 20262.

* rollback.

* rollback.

* fix oss-fuzz 20079.

* fix oss-fuzz 20179.

* fix oss-fuzz 20195.

* fix oss-fuzz 20206.

* fix oss-fuzz 20207.

* fix oss-fuzz 20265.

* fix oss-fuzz 20285.

* fix oss-fuzz 20868.
2020-02-26 17:58:19 +08:00
Chen Huitao
c520307959
fix some oss-fuzz (#1206)
* fix oss-fuzz 18138.

* fix oss-fuzz 20079.

* fix oss-fuzz 20209.

* fix oss-fuzz 20210.

* fix oss-fuzz 20262.

* rollback.

* rollback.

* fix oss-fuzz 20079.

* fix oss-fuzz 20179.

* fix oss-fuzz 20195.

* fix oss-fuzz 20206.

* fix oss-fuzz 20207.

* fix oss-fuzz 20265.
2020-02-25 11:36:06 +08:00
Chen Huitao
393a5641fd
fix mips ops bugs. (#1209) 2020-02-19 19:57:22 +08:00
kickass156
e54eea00ec
The expression(args[i] < 0) always returns false (#1207)
* Update optimize.c

typedef uint64_t tcg_target_ulong;
typedef tcg_target_ulong TCGArg;
TCGArg *args
The expression(args[i] < 0) always returns false

* Update tcg.c

typedef uint64_t tcg_target_ulong;
typedef tcg_target_ulong TCGArg;
TCGArg *args
The expression(args[i] < 0) always returns false
2020-02-15 08:11:40 +08:00
Chen Huitao
901efc4bd4
fix some oss-fuzz (#1200)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.

* fix oss-fuzz 10449.

* fix oss-fuzz 10452.

* fix oss-fuzz 11792.

* fix oss-fuzz 10457.

* fix oss-fuzz 11737.

* fix oss-fuzz 10458.

* fix oss-fuzz 10565.

* fix oss-fuzz 11651.

* fix oss-fuzz 10497.

* fix oss-fuzz 10515.

* fix oss-fuzz 10586.

* fix oss-fuzz 10597.

* fiz oss-fuzz 11721.

* fix oss-fuzz 10718.

* fix oss-fuzz 15610.

* fix oss-fuzz 10512.

* fix oss-fuzz 10545.

* fix oss-fuzz 10598.

* fix oss-fuzz 11112.

* fix oss-fuzz 11589.

* fix oss-fuzz 10674.

* git fix oss-fuzz 19610.

* fix oss-fuzz 19848.

* fix oss-fuzz 19851.

* fix oss-fuzz 19852.

* fix oss-fuzz 10878.

* fix oss-fuzz 11655.

* fix oss-fuzz 19849.

* fix oss-fuzz 11765.

* fix oss-fuzz 10337.

* fix oss-fuzz 10575.

* fix oss-fuzz 19877.

* fix oss-fuzz 19895.

* fix oss-fuzz 19896.

* fix oss-fuzz 19897.

* remove verbose fprintf output.

* fix oss-fuzz 19943.

* fix oss-fuzz 20026.

* fix oss-fuzz 20027.

* fix oss-fuzz 19967.

* fix oss-fuzz 19946.

* fix oss-fuzz 20069.

* fix oss-fuzz 20071.

* fix oss-fuzz 20073.

* fix oss-fuzz 20075.

* fix oss-fuzz 20076.

* fix a operation mistake.

* fix oss-fuzz 20101.

* fix oss-fuzz 20152.

* fix oss-fuzz 20101.

* fix oss-fuzz 20154.

* fix oss-fuzz 20166.

* fix oss-fuzz 14042.

* fix oss-fuzz 10578.

* fix oss-fuzz 11328.

* fix oss-fuzz 10602.
2020-02-10 22:33:00 +08:00
Ryan Houdek
1eabe2ffaa
Fixes LM flag for CPUID extended feature mask (#1202) 2020-02-10 10:57:46 +08:00
Haruka Ma
63ebcf41a8 Python 3.8 compatibility (#1201) 2020-02-09 01:03:56 +08:00
Chen Huitao
8b99637f77 fix some oss-fuzz (#1192)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.

* fix oss-fuzz 10449.

* fix oss-fuzz 10452.

* fix oss-fuzz 11792.

* fix oss-fuzz 10457.

* fix oss-fuzz 11737.

* fix oss-fuzz 10458.

* fix oss-fuzz 10565.

* fix oss-fuzz 11651.

* fix oss-fuzz 10497.

* fix oss-fuzz 10515.

* fix oss-fuzz 10586.

* fix oss-fuzz 10597.

* fiz oss-fuzz 11721.

* fix oss-fuzz 10718.

* fix oss-fuzz 15610.

* fix oss-fuzz 10512.

* fix oss-fuzz 10545.

* fix oss-fuzz 10598.

* fix oss-fuzz 11112.

* fix oss-fuzz 11589.

* fix oss-fuzz 10674.

* git fix oss-fuzz 19610.

* fix oss-fuzz 19848.

* fix oss-fuzz 19851.

* fix oss-fuzz 19852.

* fix oss-fuzz 10878.

* fix oss-fuzz 11655.

* fix oss-fuzz 19849.

* fix oss-fuzz 11765.

* fix oss-fuzz 10337.

* fix oss-fuzz 10575.

* fix oss-fuzz 19877.

* fix oss-fuzz 19895.

* fix oss-fuzz 19896.

* fix oss-fuzz 19897.

* remove verbose fprintf output.

* fix oss-fuzz 19943.

* fix oss-fuzz 20026.

* fix oss-fuzz 20027.

* fix oss-fuzz 19967.

* fix oss-fuzz 19946.

* fix oss-fuzz 20069.

* fix oss-fuzz 20071.

* fix oss-fuzz 20073.

* fix oss-fuzz 20075.

* fix oss-fuzz 20076.

* fix a operation mistake.

* fix oss-fuzz 20101.

* fix oss-fuzz 20152.

* fix oss-fuzz 20101.

* fix oss-fuzz 20154.

* fix oss-fuzz 20166.

* fix oss-fuzz 14042.
2020-01-18 23:49:36 +08:00
Chen Huitao
6398248534 fix some oss-fuzz (#1191)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.

* fix oss-fuzz 10449.

* fix oss-fuzz 10452.

* fix oss-fuzz 11792.

* fix oss-fuzz 10457.

* fix oss-fuzz 11737.

* fix oss-fuzz 10458.

* fix oss-fuzz 10565.

* fix oss-fuzz 11651.

* fix oss-fuzz 10497.

* fix oss-fuzz 10515.

* fix oss-fuzz 10586.

* fix oss-fuzz 10597.

* fiz oss-fuzz 11721.

* fix oss-fuzz 10718.

* fix oss-fuzz 15610.

* fix oss-fuzz 10512.

* fix oss-fuzz 10545.

* fix oss-fuzz 10598.

* fix oss-fuzz 11112.

* fix oss-fuzz 11589.

* fix oss-fuzz 10674.

* git fix oss-fuzz 19610.

* fix oss-fuzz 19848.

* fix oss-fuzz 19851.

* fix oss-fuzz 19852.

* fix oss-fuzz 10878.

* fix oss-fuzz 11655.

* fix oss-fuzz 19849.

* fix oss-fuzz 11765.

* fix oss-fuzz 10337.

* fix oss-fuzz 10575.

* fix oss-fuzz 19877.

* fix oss-fuzz 19895.

* fix oss-fuzz 19896.

* fix oss-fuzz 19897.

* remove verbose fprintf output.

* fix oss-fuzz 19943.

* fix oss-fuzz 20026.

* fix oss-fuzz 20027.

* fix oss-fuzz 19967.

* fix oss-fuzz 19946.

* fix oss-fuzz 20069.

* fix oss-fuzz 20071.

* fix oss-fuzz 20073.

* fix oss-fuzz 20075.

* fix oss-fuzz 20076.

* fix a operation mistake.

* fix oss-fuzz 20101.

* fix oss-fuzz 20152.

* fix oss-fuzz 20101.

* fix oss-fuzz 20154.
2020-01-17 17:23:39 +08:00
Chen Huitao
2776bc1db7 fix some oss-fuzz (#1189)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.

* fix oss-fuzz 10449.

* fix oss-fuzz 10452.

* fix oss-fuzz 11792.

* fix oss-fuzz 10457.

* fix oss-fuzz 11737.

* fix oss-fuzz 10458.

* fix oss-fuzz 10565.

* fix oss-fuzz 11651.

* fix oss-fuzz 10497.

* fix oss-fuzz 10515.

* fix oss-fuzz 10586.

* fix oss-fuzz 10597.

* fiz oss-fuzz 11721.

* fix oss-fuzz 10718.

* fix oss-fuzz 15610.

* fix oss-fuzz 10512.

* fix oss-fuzz 10545.

* fix oss-fuzz 10598.

* fix oss-fuzz 11112.

* fix oss-fuzz 11589.

* fix oss-fuzz 10674.

* git fix oss-fuzz 19610.

* fix oss-fuzz 19848.

* fix oss-fuzz 19851.

* fix oss-fuzz 19852.

* fix oss-fuzz 10878.

* fix oss-fuzz 11655.

* fix oss-fuzz 19849.

* fix oss-fuzz 11765.

* fix oss-fuzz 10337.

* fix oss-fuzz 10575.

* fix oss-fuzz 19877.

* fix oss-fuzz 19895.

* fix oss-fuzz 19896.

* fix oss-fuzz 19897.

* remove verbose fprintf output.

* fix oss-fuzz 19943.

* fix oss-fuzz 20026.

* fix oss-fuzz 20027.

* fix oss-fuzz 19967.

* fix oss-fuzz 19946.

* fix oss-fuzz 20069.

* fix oss-fuzz 20071.

* fix oss-fuzz 20073.

* fix oss-fuzz 20075.

* fix oss-fuzz 20076.
2020-01-15 22:18:00 +08:00
Chen Huitao
ec2e454481 fix some oss-fuzz (#1188)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.

* fix oss-fuzz 10449.

* fix oss-fuzz 10452.

* fix oss-fuzz 11792.

* fix oss-fuzz 10457.

* fix oss-fuzz 11737.

* fix oss-fuzz 10458.

* fix oss-fuzz 10565.

* fix oss-fuzz 11651.

* fix oss-fuzz 10497.

* fix oss-fuzz 10515.

* fix oss-fuzz 10586.

* fix oss-fuzz 10597.

* fiz oss-fuzz 11721.

* fix oss-fuzz 10718.

* fix oss-fuzz 15610.

* fix oss-fuzz 10512.

* fix oss-fuzz 10545.

* fix oss-fuzz 10598.

* fix oss-fuzz 11112.

* fix oss-fuzz 11589.

* fix oss-fuzz 10674.

* git fix oss-fuzz 19610.

* fix oss-fuzz 19848.

* fix oss-fuzz 19851.

* fix oss-fuzz 19852.

* fix oss-fuzz 10878.

* fix oss-fuzz 11655.

* fix oss-fuzz 19849.

* fix oss-fuzz 11765.

* fix oss-fuzz 10337.

* fix oss-fuzz 10575.

* fix oss-fuzz 19877.

* fix oss-fuzz 19895.

* fix oss-fuzz 19896.

* fix oss-fuzz 19897.

* remove verbose fprintf output.

* fix oss-fuzz 19943.

* fix oss-fuzz 20026.

* fix oss-fuzz 20027.

* fix oss-fuzz 19967.

* fix oss-fuzz 19946.
2020-01-14 10:08:58 +08:00
Chen Huitao
7e4ac9e86e fix some oss-fuzz (#1184)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.

* fix oss-fuzz 10449.

* fix oss-fuzz 10452.

* fix oss-fuzz 11792.

* fix oss-fuzz 10457.

* fix oss-fuzz 11737.

* fix oss-fuzz 10458.

* fix oss-fuzz 10565.

* fix oss-fuzz 11651.

* fix oss-fuzz 10497.

* fix oss-fuzz 10515.

* fix oss-fuzz 10586.

* fix oss-fuzz 10597.

* fiz oss-fuzz 11721.

* fix oss-fuzz 10718.

* fix oss-fuzz 15610.

* fix oss-fuzz 10512.

* fix oss-fuzz 10545.

* fix oss-fuzz 10598.

* fix oss-fuzz 11112.

* fix oss-fuzz 11589.

* fix oss-fuzz 10674.

* git fix oss-fuzz 19610.

* fix oss-fuzz 19848.

* fix oss-fuzz 19851.

* fix oss-fuzz 19852.

* fix oss-fuzz 10878.

* fix oss-fuzz 11655.

* fix oss-fuzz 19849.

* fix oss-fuzz 11765.

* fix oss-fuzz 10337.

* fix oss-fuzz 10575.

* fix oss-fuzz 19877.

* fix oss-fuzz 19895.

* fix oss-fuzz 19896.

* fix oss-fuzz 19897.

* remove verbose fprintf output.
2020-01-10 23:05:44 +08:00
Chen Huitao
8621bca537 fix some oss-fuzz bugs (#1182)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.

* fix oss-fuzz 10449.

* fix oss-fuzz 10452.

* fix oss-fuzz 11792.

* fix oss-fuzz 10457.

* fix oss-fuzz 11737.

* fix oss-fuzz 10458.

* fix oss-fuzz 10565.

* fix oss-fuzz 11651.

* fix oss-fuzz 10497.

* fix oss-fuzz 10515.

* fix oss-fuzz 10586.

* fix oss-fuzz 10597.

* fiz oss-fuzz 11721.

* fix oss-fuzz 10718.

* fix oss-fuzz 15610.

* fix oss-fuzz 10512.

* fix oss-fuzz 10545.
2020-01-05 19:20:29 +08:00
Chen Huitao
68eb357984 fix some oss-fuzz bugs (#1180)
* fix oss-fuzz 10419.

* fix oss-fuzz 10427.

* fix oss-fuzz 10421.

* fix oss-fuzz 10422.

* fix oss-fuzz 10425.

* fix oss-fuzz 10426.

* fix oss-fuzz 10426.

* fix oss-fuzz 10422.

* fix oss-fuzz  10426.

* fix oss-fuzz 10456.

* fix oss-fuzz 10428.

* fix oss-fuzz 10429.

* fix oss-fuzz 10431.

* fix oss-fuzz 10435.

* fix oss-fuzz 10430.

* fix oss-fuzz 10436.

* remove unused var.
2020-01-04 23:42:02 +08:00
Charles Ferguson
99097cab4c Add implementation of access to the ARM SPSR register. (#1178)
The SPSR register is named within the Unicorn headers, but the code
to access it is absent. This means that it will always read as 0 and
ignore writes. This makes it harder to work with changes in processor
mode, as the usual way to return from a CPU exception is a
`MOVS pc, lr` for undefined instructions or `SUBS pc, lr, #4`
for most other aborts - which implicitly restores the CPSR from SPSR.

This change adds the access to the SPSR so that it can be read and
written as the caller might expect.
2020-01-02 09:42:01 +08:00
Nguyen Anh Quynh
fc8a42aeb8 spacing 2020-01-01 09:56:55 +08:00
Charles Ferguson
b59632fb64 Ensure that PC is not fixed up when code tracing or timing. (#1179)
Under some circumstances, the PC is not fixed up properly when
returning from the execution of a block in cpu_tb_exec. This appears
to be caused by the resetting of the PC from the tb.

This change removes the additional fixup in the cases where there
is code tracing or timing active. Either of these cases would result
in the wrong PC being reported.

Closes unicorn-engine#1105.
2020-01-01 09:55:08 +08:00