Commit Graph

580 Commits

Author SHA1 Message Date
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
6c3960242b Format unicorn_arm and unicorn_aarch64 2021-11-01 10:17:58 +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
4bcf1c4a7c Flush TB at exit with a better approach instead of flushing tlb in uc1 2021-10-31 19:43:56 +01:00
e62b0ef255 Add clang-format and format code to qemu code style 2021-10-29 12:44:49 +02:00
e695686c15 Remove AFL Integration by reverting 2021-10-26 11:22:21 +02:00
7ac7c23c12 Fix Windows build for AFL integration 2021-10-25 16:11:58 +02:00
1fa2eb688b Fix UC_MODE_AFL and update config 2021-10-25 14:39:40 +02:00
d965c0f159 Use UCLOG and fix uc_afl_fuzz 2021-10-25 10:46:52 +02:00
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
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
8ab7e0626d To make dockcross-x86 happy 2021-10-06 11:53:34 +02:00
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
aaaea14214 import Unicorn2 2021-10-03 22:14:44 +08:00
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
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
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
811e77c7aa Support querying architecture mode besides arm (#1389) 2021-04-26 00:31:29 +08:00
21ec6e8f83 Add ARM BE8 support (#1369)
Co-authored-by: w4kfu <gw4kfu@gmail.com>
2021-03-31 21:22:35 +08:00
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
7ca7e8a79d qemu_getauxval FreeBSD implementation backport (#1366) 2020-12-31 18:53:36 +08:00
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
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
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
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
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
c1c0baec7d Fix IP value for UC_MODE_16 (#1321) 2020-09-10 10:02:22 +08:00
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
3134f33029 fix 64-bit fstenv (#1300)
* fix 64-bit fstenv

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

* Generic fix for watchpoints leak
2020-05-23 09:59:30 +08:00
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
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
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
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