On Thu, 9 Apr 2009, address@hidden wrote:
From: Riku Voipio <address@hidden>
From: Mika Westerberg <address@hidden>
- Now GUEST_BASE is dynamic and can be set from command line.
- Qemu checks /proc/sys/vm/mmap_min_addr and sets GUEST_BASE
if needed.
- Code generation supports GUEST_BASE for i386 and x86_64 hosts.
Signed-off-by: Riku Voipio <address@hidden>
[..snip..]
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index e0fd434..7cb51b5 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -560,6 +560,12 @@ static void tcg_out_qemu_ld(TCGContext *s,
const TCGArg *args,
/* add x(r1), r0 */
tcg_out_modrm_offset(s, 0x03, r0, r1, offsetof(CPUTLBEntry,
addend) -
offsetof(CPUTLBEntry, addr_read));
+#elif defined(CONFIG_USE_GUEST_BASE)
+ /*
+ * Add guest_base to all loads.
+ */
+ tcg_out_mov(s, r0, addr_reg); /* movl addr_reg, r0 */
+ tcg_out_addi(s, r0, GUEST_BASE); /* addl $GUEST_BASE, r0 */
I think 'lea' is warranted here, and likewise in _st and x86_64 case.