about summary refs log tree commit diff
path: root/utils/aflpp_driver/aflpp_qemu_driver_hook.c
blob: 823cc42d7111368e879382bb80910a8d87258ed9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdint.h>
#include <string.h>

#define g2h(x) ((void *)((unsigned long)(x) + guest_base))

#define REGS_RDI 7
#define REGS_RSI 6

void afl_persistent_hook(uint64_t *regs, uint64_t guest_base,
                         uint8_t *input_buf, uint32_t input_len) {

  memcpy(g2h(regs[REGS_RDI]), input_buf, input_len);
  regs[REGS_RSI] = input_len;

}

int afl_persistent_hook_init(void) {

  return 1;

}