mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +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:
committed by
Rob Bradford
parent
8db85eca1f
commit
556bda74a0
@@ -124,7 +124,7 @@ fn memory_operand_address<T: CpuStateManager>(
|
|||||||
address += index;
|
address += index;
|
||||||
}
|
}
|
||||||
|
|
||||||
address += insn.memory_displacement64();
|
address = address.wrapping_add(insn.memory_displacement64());
|
||||||
|
|
||||||
// Translate to a linear address.
|
// Translate to a linear address.
|
||||||
state.linearize(insn.memory_segment(), address, write)
|
state.linearize(insn.memory_segment(), address, write)
|
||||||
|
|||||||
Reference in New Issue
Block a user