Fix i386 QEMU read_function_argument() (#1677)
This commit is contained in:
parent
a278357ed9
commit
aa69436b64
@ -80,7 +80,6 @@ impl crate::ArchExtras for crate::CPU {
|
|||||||
|
|
||||||
match idx {
|
match idx {
|
||||||
0..=1 => {
|
0..=1 => {
|
||||||
let val: GuestReg = val.into();
|
|
||||||
let stack_ptr: GuestAddr = self.read_reg(Regs::Sp)?;
|
let stack_ptr: GuestAddr = self.read_reg(Regs::Sp)?;
|
||||||
/*
|
/*
|
||||||
* Stack is full and descending. SP points to return address, arguments
|
* Stack is full and descending. SP points to return address, arguments
|
||||||
@ -89,10 +88,11 @@ impl crate::ArchExtras for crate::CPU {
|
|||||||
let size: GuestAddr = size_of::<GuestReg>() as GuestAddr;
|
let size: GuestAddr = size_of::<GuestReg>() as GuestAddr;
|
||||||
let offset = size * (idx as GuestAddr + 1);
|
let offset = size * (idx as GuestAddr + 1);
|
||||||
|
|
||||||
let val = unsafe {
|
let mut val = [0u8; size_of::<GuestReg>()];
|
||||||
self.read_mem(stack_ptr + offset, size_of::<GuestReg>());
|
unsafe {
|
||||||
};
|
self.read_mem(stack_ptr + offset, &mut val);
|
||||||
Ok(GuestReg::from_le_bytes(val))
|
}
|
||||||
|
Ok(GuestReg::from_le_bytes(val).into())
|
||||||
}
|
}
|
||||||
_ => Err(format!("Unsupported argument: {idx:}")),
|
_ => Err(format!("Unsupported argument: {idx:}")),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user