mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
hypervisor: emulator: Use wrapping add for memory offset
Assume rax is 0xfee003e0 and the displacement is negative 0x60. The effective address is then 0xfee00380. This is perfectly valid. Example instruction: c7 40 a0 00 10 00 00 movl $0x1000,-0x60(%rax) Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
parent
8db85eca1f
commit
556bda74a0
@ -124,7 +124,7 @@ fn memory_operand_address<T: CpuStateManager>(
|
||||
address += index;
|
||||
}
|
||||
|
||||
address += insn.memory_displacement64();
|
||||
address = address.wrapping_add(insn.memory_displacement64());
|
||||
|
||||
// Translate to a linear address.
|
||||
state.linearize(insn.memory_segment(), address, write)
|
||||
|
Loading…
Reference in New Issue
Block a user