Fix libafl_qemu i386 build (#924)
* fix * fmt Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com>
This commit is contained in:
parent
71dd58396c
commit
8444cf7cc8
@ -50,6 +50,15 @@ pub fn pc2basicblock(pc: GuestAddr, emu: &Emulator) -> Result<Vec<Instruction>,
|
|||||||
.detail(true)
|
.detail(true)
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
#[cfg(cpu_target = "i386")]
|
||||||
|
let cs = Capstone::new()
|
||||||
|
.x86()
|
||||||
|
.mode(capstone::arch::x86::ArchMode::Mode32)
|
||||||
|
.detail(true)
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
#[cfg(cpu_target = "arm")]
|
#[cfg(cpu_target = "arm")]
|
||||||
let cs = Capstone::new()
|
let cs = Capstone::new()
|
||||||
.arm()
|
.arm()
|
||||||
|
@ -15,9 +15,11 @@ use crate::{
|
|||||||
GuestAddr, SYS_fstat, SYS_fstatfs, SYS_futex, SYS_getrandom, SYS_mprotect, SYS_mremap,
|
GuestAddr, SYS_fstat, SYS_fstatfs, SYS_futex, SYS_getrandom, SYS_mprotect, SYS_mremap,
|
||||||
SYS_munmap, SYS_pread64, SYS_read, SYS_readlinkat, SYS_statfs,
|
SYS_munmap, SYS_pread64, SYS_read, SYS_readlinkat, SYS_statfs,
|
||||||
};
|
};
|
||||||
|
#[cfg(cpu_target = "i386")]
|
||||||
|
use crate::{SYS_fstatat64, SYS_mmap};
|
||||||
#[cfg(cpu_target = "arm")]
|
#[cfg(cpu_target = "arm")]
|
||||||
use crate::{SYS_fstatat64, SYS_mmap2};
|
use crate::{SYS_fstatat64, SYS_mmap2};
|
||||||
#[cfg(not(cpu_target = "arm"))]
|
#[cfg(not(any(cpu_target = "arm", cpu_target = "i386")))]
|
||||||
use crate::{SYS_mmap, SYS_newfstatat};
|
use crate::{SYS_mmap, SYS_newfstatat};
|
||||||
|
|
||||||
// TODO use the functions provided by Emulator
|
// TODO use the functions provided by Emulator
|
||||||
@ -630,14 +632,14 @@ where
|
|||||||
let h = hooks.match_helper_mut::<QemuSnapshotHelper>().unwrap();
|
let h = hooks.match_helper_mut::<QemuSnapshotHelper>().unwrap();
|
||||||
h.access(a0 as GuestAddr, a3 as usize);
|
h.access(a0 as GuestAddr, a3 as usize);
|
||||||
}
|
}
|
||||||
#[cfg(not(cpu_target = "arm"))]
|
#[cfg(not(any(cpu_target = "arm", cpu_target = "i386")))]
|
||||||
SYS_newfstatat => {
|
SYS_newfstatat => {
|
||||||
if a2 != 0 {
|
if a2 != 0 {
|
||||||
let h = hooks.match_helper_mut::<QemuSnapshotHelper>().unwrap();
|
let h = hooks.match_helper_mut::<QemuSnapshotHelper>().unwrap();
|
||||||
h.access(a2 as GuestAddr, 4096); // stat is not greater than a page
|
h.access(a2 as GuestAddr, 4096); // stat is not greater than a page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(cpu_target = "arm")]
|
#[cfg(any(cpu_target = "arm", cpu_target = "i386"))]
|
||||||
SYS_fstatat64 => {
|
SYS_fstatat64 => {
|
||||||
if a2 != 0 {
|
if a2 != 0 {
|
||||||
let h = hooks.match_helper_mut::<QemuSnapshotHelper>().unwrap();
|
let h = hooks.match_helper_mut::<QemuSnapshotHelper>().unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user