libafl_qemu: fallback cpu for read-/write_mem
In systemmode, current_cpu may not be set. In such cases use the first cpus memory access methods.
This commit is contained in:
parent
5c22f11d17
commit
73ccda8b4b
@ -658,11 +658,15 @@ impl Emulator {
|
||||
}
|
||||
|
||||
pub unsafe fn write_mem(&self, addr: GuestAddr, buf: &[u8]) {
|
||||
self.current_cpu().unwrap().write_mem(addr, buf);
|
||||
self.current_cpu()
|
||||
.unwrap_or(self.cpu_from_index(0))
|
||||
.write_mem(addr, buf);
|
||||
}
|
||||
|
||||
pub unsafe fn read_mem(&self, addr: GuestAddr, buf: &mut [u8]) {
|
||||
self.current_cpu().unwrap().read_mem(addr, buf);
|
||||
self.current_cpu()
|
||||
.unwrap_or(self.cpu_from_index(0))
|
||||
.read_mem(addr, buf);
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
Loading…
x
Reference in New Issue
Block a user