summary refs log tree commit diff
path: root/pkgs/tools/security/afl/qemu-patches/cpu-exec.patch
blob: 29b65e71b9ade005a1a9e13160ca1ac118a8f6a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- qemu-2.2.0/cpu-exec.c.orig     2014-12-09 14:45:40.000000000 +0000
+++ qemu-2.2.0/cpu-exec.c  2015-02-20 22:07:02.966000000 +0000
@@ -25,6 +25,8 @@
 #include "sysemu/qtest.h"
 #include "qemu/timer.h"

+#include "afl-qemu-cpu-inl.h"
+
 /* -icount align implementation. */

 typedef struct SyncClocks {
@@ -262,8 +264,11 @@
     }
  not_found:
    /* if no translated code available, then translate it now */
+
     tb = tb_gen_code(cpu, pc, cs_base, flags, 0);

+    AFL_QEMU_CPU_SNIPPET1;
+
  found:
     /* Move the last found TB to the head of the list */
     if (likely(*ptb1)) {
@@ -455,6 +460,9 @@
                     next_tb = 0;
                     tcg_ctx.tb_ctx.tb_invalidated_flag = 0;
                 }
+
+                AFL_QEMU_CPU_SNIPPET2;
+
                 if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
                     qemu_log("Trace %p [" TARGET_FMT_lx "] %s\n",
                              tb->tc_ptr, tb->pc, lookup_symbol(tb->pc));