Skip to content

Commit e0b8df9

Browse files
committed
fix systemmode compilation
1 parent 9366380 commit e0b8df9

File tree

13 files changed

+40
-36
lines changed

13 files changed

+40
-36
lines changed

accel/tcg/cpu-exec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
//// --- Begin LibAFL code ---
4949

50+
#include "libafl/defs.h"
5051
#include "libafl/exit.h"
5152
#include "libafl/tcg.h"
5253
#include "libafl/hooks/tcg/edge.h"

accel/tcg/tcg-accel-ops-mttcg.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
#include "tcg-accel-ops.h"
3636
#include "tcg-accel-ops-mttcg.h"
3737

38+
//// --- Begin LibAFL code ---
39+
40+
#include "libafl/defs.h"
41+
42+
//// --- End LibAFL code ---
43+
44+
3845
typedef struct MttcgForceRcuNotifier {
3946
Notifier notifier;
4047
CPUState *cpu;
@@ -55,12 +62,6 @@ static void mttcg_force_rcu(Notifier *notify, void *data)
5562
async_run_on_cpu(cpu, do_nothing, RUN_ON_CPU_NULL);
5663
}
5764

58-
//// --- Begin LibAFL code ---
59-
60-
#include "libafl/exit.h"
61-
62-
//// --- End LibAFL code ---
63-
6465
/*
6566
* In the multi-threaded case each vCPU has its own thread. The TLS
6667
* variable current_cpu can be used deep in the code to find the

accel/tcg/tcg-accel-ops-rr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
#include "tcg-accel-ops-rr.h"
3838
#include "tcg-accel-ops-icount.h"
3939

40+
//// --- Begin LibAFL code ---
41+
42+
#include "libafl/defs.h"
43+
44+
//// --- End LibAFL code ---
45+
4046
/* Kick all RR vCPUs */
4147
void rr_kick_vcpu_thread(CPUState *unused)
4248
{
@@ -169,12 +175,6 @@ static int rr_cpu_count(void)
169175
return cpu_count;
170176
}
171177

172-
//// --- Begin LibAFL code ---
173-
174-
#include "libafl/exit.h"
175-
176-
//// --- End LibAFL code ---
177-
178178
/*
179179
* In the single-threaded case each vCPU is simulated in turn. If
180180
* there is more than a single vCPU we create a simple timer to kick

include/libafl/defs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#define EXCP_LIBAFL_EXIT 0xf4775747

include/libafl/exit.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#pragma once
22

33
#include "qemu/osdep.h"
4-
#include "exec/cpu_ldst.h"
54
#include "hw/core/cpu.h"
6-
7-
#define EXCP_LIBAFL_EXIT 0xf4775747
5+
#include "exec/cpu-defs.h"
86

97
struct libafl_breakpoint {
108
target_ulong addr;

include/libafl/system.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#pragma once
22

33
#include "hw/core/cpu.h"
4-
#include "gdbstub/enums.h"
5-
#include "sysemu/accel-ops.h"
6-
#include "sysemu/cpus.h"
74

85
int libafl_qemu_set_hw_breakpoint(vaddr addr);
96
int libafl_qemu_remove_hw_breakpoint(vaddr addr);

include/libafl/syx-snapshot/syx-snapshot.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@
1010

1111
#include "qemu/osdep.h"
1212

13-
#include "qom/object.h"
14-
#include "sysemu/sysemu.h"
15-
1613
#include "device-save.h"
1714
#include "syx-cow-cache.h"
1815

19-
#include "libafl/syx-misc.h"
20-
2116
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_CHUNK_SIZE 64
2217
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_MAX_BLOCKS (1024 * 1024)
2318

libafl/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "hw/core/sysemu-cpu-ops.h"
1212

1313
#include "libafl/cpu.h"
14-
14+
#include "libafl/exit.h"
1515
#include "libafl/hook.h"
1616

1717
int gdb_write_register(CPUState* cpu, uint8_t* mem_buf, int reg);

libafl/exit.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
#include "tcg/tcg-op.h"
55

66
#include "cpu.h"
7+
#include "libafl/defs.h"
78
#include "libafl/cpu.h"
89

10+
#ifndef CONFIG_USER_ONLY
11+
#include "system/runstate.h"
12+
#endif
13+
914
#ifdef CONFIG_USER_ONLY
1015
#define THREAD_MODIFIER __thread
1116
#else

libafl/qemu_snapshot.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
#include "libafl/qemu_snapshot.h"
1+
#include "qemu/osdep.h"
2+
#include "qapi/error.h"
3+
4+
#include <stdlib.h>
5+
#include <string.h>
26

3-
#include "sysemu/runstate.h"
47
#include "migration/snapshot.h"
5-
#include "qapi/error.h"
68
#include "qemu/error-report.h"
79
#include "qemu/main-loop.h"
810
#include "hw/core/cpu.h"
9-
#include "sysemu/hw_accel.h"
10-
#include <stdlib.h>
11-
#include <string.h>
11+
#include "system/runstate.h"
12+
#include "libafl/qemu_snapshot.h"
1213

1314
static void save_snapshot_cb(void* opaque)
1415
{

0 commit comments

Comments
 (0)