fix systemmode compilation

This commit is contained in:
Romain Malmain 2025-04-30 13:47:55 +02:00
parent 9366380915
commit e0b8df9655
No known key found for this signature in database
GPG Key ID: 02E4A13F7415468A
13 changed files with 41 additions and 37 deletions

View File

@ -47,6 +47,7 @@
//// --- Begin LibAFL code ---
#include "libafl/defs.h"
#include "libafl/exit.h"
#include "libafl/tcg.h"
#include "libafl/hooks/tcg/edge.h"

View File

@ -35,6 +35,13 @@
#include "tcg-accel-ops.h"
#include "tcg-accel-ops-mttcg.h"
//// --- Begin LibAFL code ---
#include "libafl/defs.h"
//// --- End LibAFL code ---
typedef struct MttcgForceRcuNotifier {
Notifier notifier;
CPUState *cpu;
@ -55,12 +62,6 @@ static void mttcg_force_rcu(Notifier *notify, void *data)
async_run_on_cpu(cpu, do_nothing, RUN_ON_CPU_NULL);
}
//// --- Begin LibAFL code ---
#include "libafl/exit.h"
//// --- End LibAFL code ---
/*
* In the multi-threaded case each vCPU has its own thread. The TLS
* variable current_cpu can be used deep in the code to find the

View File

@ -37,6 +37,12 @@
#include "tcg-accel-ops-rr.h"
#include "tcg-accel-ops-icount.h"
//// --- Begin LibAFL code ---
#include "libafl/defs.h"
//// --- End LibAFL code ---
/* Kick all RR vCPUs */
void rr_kick_vcpu_thread(CPUState *unused)
{
@ -169,12 +175,6 @@ static int rr_cpu_count(void)
return cpu_count;
}
//// --- Begin LibAFL code ---
#include "libafl/exit.h"
//// --- End LibAFL code ---
/*
* In the single-threaded case each vCPU is simulated in turn. If
* there is more than a single vCPU we create a simple timer to kick

3
include/libafl/defs.h Normal file
View File

@ -0,0 +1,3 @@
#pragma once
#define EXCP_LIBAFL_EXIT 0xf4775747

View File

@ -1,10 +1,8 @@
#pragma once
#include "qemu/osdep.h"
#include "exec/cpu_ldst.h"
#include "hw/core/cpu.h"
#define EXCP_LIBAFL_EXIT 0xf4775747
#include "exec/cpu-defs.h"
struct libafl_breakpoint {
target_ulong addr;

View File

@ -1,9 +1,6 @@
#pragma once
#include "hw/core/cpu.h"
#include "gdbstub/enums.h"
#include "sysemu/accel-ops.h"
#include "sysemu/cpus.h"
int libafl_qemu_set_hw_breakpoint(vaddr addr);
int libafl_qemu_remove_hw_breakpoint(vaddr addr);

View File

@ -10,14 +10,9 @@
#include "qemu/osdep.h"
#include "qom/object.h"
#include "sysemu/sysemu.h"
#include "device-save.h"
#include "syx-cow-cache.h"
#include "libafl/syx-misc.h"
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_CHUNK_SIZE 64
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_MAX_BLOCKS (1024 * 1024)

View File

@ -11,7 +11,7 @@
#include "hw/core/sysemu-cpu-ops.h"
#include "libafl/cpu.h"
#include "libafl/exit.h"
#include "libafl/hook.h"
int gdb_write_register(CPUState* cpu, uint8_t* mem_buf, int reg);

View File

@ -4,8 +4,13 @@
#include "tcg/tcg-op.h"
#include "cpu.h"
#include "libafl/defs.h"
#include "libafl/cpu.h"
#ifndef CONFIG_USER_ONLY
#include "system/runstate.h"
#endif
#ifdef CONFIG_USER_ONLY
#define THREAD_MODIFIER __thread
#else

View File

@ -1,14 +1,15 @@
#include "libafl/qemu_snapshot.h"
#include "sysemu/runstate.h"
#include "migration/snapshot.h"
#include "qemu/osdep.h"
#include "qapi/error.h"
#include <stdlib.h>
#include <string.h>
#include "migration/snapshot.h"
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "hw/core/cpu.h"
#include "sysemu/hw_accel.h"
#include <stdlib.h>
#include <string.h>
#include "system/runstate.h"
#include "libafl/qemu_snapshot.h"
static void save_snapshot_cb(void* opaque)
{

View File

@ -1,5 +1,9 @@
#include "qemu/osdep.h"
#include "sysemu/sysemu.h"
#include "exec/vaddr.h"
#include "system/system.h"
#include "system/accel-ops.h"
#include "system/cpus.h"
#include "gdbstub/enums.h"
#include "libafl/system.h"

View File

@ -1,6 +1,7 @@
#include "libafl/syx-snapshot/syx-cow-cache.h"
#include "qemu/osdep.h"
#include "sysemu/block-backend.h"
#include "libafl/syx-snapshot/syx-cow-cache.h"
#include "system/block-backend-io.h"
#define IS_POWER_OF_TWO(x) ((x != 0) && ((x & (x - 1)) == 0))

View File

@ -1,16 +1,14 @@
#include "qemu/osdep.h"
#include "qemu/main-loop.h"
#include "sysemu/sysemu.h"
#include "migration/vmstate.h"
#include "cpu.h"
#include "exec/ramlist.h"
#include "exec/ram_addr.h"
#include "exec/exec-all.h"
#include "libafl/syx-snapshot/syx-snapshot.h"
#include "libafl/syx-snapshot/device-save.h"
#include "libafl/syx-misc.h"
#define SYX_SNAPSHOT_LIST_INIT_SIZE 4096
#define SYX_SNAPSHOT_LIST_GROW_FACTOR 2