@@ -10,18 +10,19 @@ struct libafl_breakpoint {
1010 struct libafl_breakpoint * next ;
1111};
1212
13- int libafl_qemu_set_breakpoint (target_ulong pc );
14- int libafl_qemu_remove_breakpoint (target_ulong pc );
15- void libafl_qemu_trigger_breakpoint (CPUState * cpu );
16- void libafl_qemu_breakpoint_run (vaddr pc_next );
17-
1813enum libafl_exit_reason_kind {
1914 INTERNAL = 0 ,
2015 BREAKPOINT = 1 ,
21- SYNC_EXIT = 2 ,
16+ CUSTOM_INSN = 2 ,
2217 TIMEOUT = 3 ,
2318};
2419
20+ enum libafl_custom_insn_kind {
21+ LIBAFL_CUSTOM_INSN_UNDEFINED = 0 ,
22+ LIBAFL_CUSTOM_INSN_LIBAFL = 1 ,
23+ LIBAFL_CUSTOM_INSN_NYX = 2 ,
24+ };
25+
2526// QEMU exited on its own for some reason.
2627struct libafl_exit_reason_internal {
2728 ShutdownCause cause ;
@@ -34,23 +35,32 @@ struct libafl_exit_reason_breakpoint {
3435};
3536
3637// A synchronous exit has been triggered.
37- struct libafl_exit_reason_sync_exit {};
38+ struct libafl_exit_reason_custom_insn {
39+ enum libafl_custom_insn_kind kind ;
40+ };
3841
3942// A timeout occured and we were asked to exit on timeout
40- struct libafl_exit_reason_timeout {};
43+ struct libafl_exit_reason_timeout {
44+ };
4145
4246struct libafl_exit_reason {
4347 enum libafl_exit_reason_kind kind ;
4448 CPUState * cpu ; // CPU that triggered an exit.
4549 vaddr next_pc ; // The PC that should be stored in the CPU when re-entering.
4650 union {
47- struct libafl_exit_reason_internal internal ; // kind == INTERNAL
48- struct libafl_exit_reason_breakpoint breakpoint ; // kind == BREAKPOINT
49- struct libafl_exit_reason_sync_exit sync_exit ; // kind == SYNC_EXIT
50- struct libafl_exit_reason_timeout timeout ; // kind == TIMEOUT
51+ struct libafl_exit_reason_internal internal ; // kind == INTERNAL
52+ struct libafl_exit_reason_breakpoint breakpoint ; // kind == BREAKPOINT
53+ struct libafl_exit_reason_custom_insn
54+ custom_insn ; // kind == CUSTOM_INSN
55+ struct libafl_exit_reason_timeout timeout ; // kind == TIMEOUT
5156 } data ;
5257};
5358
59+ int libafl_qemu_set_breakpoint (target_ulong pc );
60+ int libafl_qemu_remove_breakpoint (target_ulong pc );
61+ void libafl_qemu_trigger_breakpoint (CPUState * cpu );
62+ void libafl_qemu_breakpoint_run (vaddr pc_next );
63+
5464// Only makes sense to call if an exit was expected
5565// Will return NULL if there was no exit expected.
5666CPUState * libafl_last_exit_cpu (void );
@@ -62,7 +72,8 @@ void libafl_sync_exit_cpu(void);
6272void libafl_exit_request_internal (CPUState * cpu , uint64_t pc ,
6373 ShutdownCause cause , int signal );
6474void libafl_exit_request_breakpoint (CPUState * cpu , target_ulong pc );
65- void libafl_exit_request_sync_backdoor (CPUState * cpu , target_ulong pc );
75+ void libafl_exit_request_custom_insn (CPUState * cpu , target_ulong pc ,
76+ enum libafl_custom_insn_kind kind );
6677
6778#ifndef CONFIG_USER_ONLY
6879void libafl_exit_request_timeout (void );
0 commit comments