fix read_reg
This commit is contained in:
parent
d4d652ed9b
commit
e407657da0
8
cpu.c
8
cpu.c
@ -63,10 +63,6 @@ int libafl_qemu_write_reg(int reg, uint8_t* val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (libafl_qemu_mem_buf == NULL) {
|
||||
libafl_qemu_mem_buf = g_byte_array_sized_new(64);
|
||||
}
|
||||
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
if (reg < cc->gdb_num_core_regs) {
|
||||
return cc->gdb_write_register(cpu, val, reg);
|
||||
@ -81,6 +77,10 @@ int libafl_qemu_read_reg(int reg, uint8_t* val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (libafl_qemu_mem_buf == NULL) {
|
||||
libafl_qemu_mem_buf = g_byte_array_sized_new(64);
|
||||
}
|
||||
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
if (reg < cc->gdb_num_core_regs) {
|
||||
int len = cc->gdb_read_register(cpu, libafl_qemu_mem_buf, reg);
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "qemu_libafl_bridge"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>"]
|
||||
description = "QEMU and LibAFL bridge lib"
|
||||
repository = "https://github.com/AFLplusplus/qemu-libafl-bridge/"
|
||||
|
@ -5,13 +5,13 @@ use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||
#[allow(clippy::pub_enum_variant_names)]
|
||||
pub enum Amd64Regs {
|
||||
Rax = 0,
|
||||
Rcx = 1,
|
||||
Rdx = 2,
|
||||
Rbx = 3,
|
||||
Rsp = 4,
|
||||
Rbp = 5,
|
||||
Rsi = 6,
|
||||
Rdi = 7,
|
||||
Rbx = 1,
|
||||
Rcx = 2,
|
||||
Rdx = 3,
|
||||
Rsi = 4,
|
||||
Rdi = 5,
|
||||
Rbp = 6,
|
||||
Rsp = 7,
|
||||
R8 = 8,
|
||||
R9 = 9,
|
||||
R10 = 10,
|
||||
|
@ -2,6 +2,7 @@ use core::{mem::transmute, ptr::copy_nonoverlapping};
|
||||
use num::Num;
|
||||
|
||||
pub mod amd64;
|
||||
pub mod x86;
|
||||
|
||||
/*
|
||||
int libafl_qemu_write_reg(int reg, uint8_t* val);
|
||||
|
15
qemu_libafl_bridge/src/x86.rs
Normal file
15
qemu_libafl_bridge/src/x86.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||
|
||||
#[derive(IntoPrimitive, TryFromPrimitive, Clone, Copy)]
|
||||
#[repr(i32)]
|
||||
#[allow(clippy::pub_enum_variant_names)]
|
||||
pub enum X86Regs {
|
||||
Eax = 0,
|
||||
Ebx = 1,
|
||||
Ecx = 2,
|
||||
Edx = 3,
|
||||
Esi = 4,
|
||||
Edi = 5,
|
||||
Ebp = 6,
|
||||
Esp = 7,
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user