From: malc <av1474@comtv.ru>
To: riku.voipio@iki.fi
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 06/10] Revived GUEST_BASE support for usermode emulation targets [v2]
Date: Wed, 29 Apr 2009 23:50:47 +0400 (MSD) [thread overview]
Message-ID: <Pine.LNX.4.64.0904292348090.3672@linmac.oyster.ru> (raw)
In-Reply-To: <1241028203-19687-6-git-send-email-riku.voipio@iki.fi>
On Wed, 29 Apr 2009, riku.voipio@iki.fi wrote:
> From: Mika Westerberg <mika.westerberg@iki.fi>
>
> From: Mika Westerberg <mika.westerberg@iki.fi>
>
> - 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.
>
> [v2]: implemented GUEST_BASE with single LEA
>
> Changed TCG (on x86 and x86_64) to generate single LEA instead
After actually considering the whole picture neither MOV+ADD nor LEA
are needed at all, something like the following (i386 case, and not
tested):
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index e0fd434..f17bca0 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -22,6 +22,10 @@
* THE SOFTWARE.
*/
+#ifndef CONFIG_USE_GUEST_BASE
+#define GUEST_BASE 0
+#endif
+
#ifndef NDEBUG
static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
"%eax",
@@ -572,15 +576,15 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args,
switch(opc) {
case 0:
/* movzbl */
- tcg_out_modrm_offset(s, 0xb6 | P_EXT, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0xb6 | P_EXT, data_reg, r0, GUEST_BASE);
break;
case 0 | 4:
/* movsbl */
- tcg_out_modrm_offset(s, 0xbe | P_EXT, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0xbe | P_EXT, data_reg, r0, GUEST_BASE);
break;
case 1:
/* movzwl */
- tcg_out_modrm_offset(s, 0xb7 | P_EXT, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0xb7 | P_EXT, data_reg, r0, GUEST_BASE);
if (bswap) {
/* rolw $8, data_reg */
tcg_out8(s, 0x66);
@@ -590,7 +594,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args,
break;
case 1 | 4:
/* movswl */
- tcg_out_modrm_offset(s, 0xbf | P_EXT, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0xbf | P_EXT, data_reg, r0, GUEST_BASE);
if (bswap) {
/* rolw $8, data_reg */
tcg_out8(s, 0x66);
@@ -603,7 +607,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args,
break;
case 2:
/* movl (r0), data_reg */
- tcg_out_modrm_offset(s, 0x8b, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0x8b, data_reg, r0, GUEST_BASE);
if (bswap) {
/* bswap */
tcg_out_opc(s, (0xc8 + data_reg) | P_EXT);
@@ -615,17 +619,17 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args,
r1 = TCG_REG_EDX;
if (r1 == data_reg)
r1 = TCG_REG_EAX;
- tcg_out_mov(s, r1, r0);
+ tcg_out_mov(s, r1, GUEST_BASE);
r0 = r1;
}
if (!bswap) {
- tcg_out_modrm_offset(s, 0x8b, data_reg, r0, 0);
- tcg_out_modrm_offset(s, 0x8b, data_reg2, r0, 4);
+ tcg_out_modrm_offset(s, 0x8b, data_reg, r0, GUEST_BASE);
+ tcg_out_modrm_offset(s, 0x8b, data_reg2, r0, GUEST_BASE + 4);
} else {
- tcg_out_modrm_offset(s, 0x8b, data_reg, r0, 4);
+ tcg_out_modrm_offset(s, 0x8b, data_reg, r0, GUEST_BASE + 4);
tcg_out_opc(s, (0xc8 + data_reg) | P_EXT);
- tcg_out_modrm_offset(s, 0x8b, data_reg2, r0, 0);
+ tcg_out_modrm_offset(s, 0x8b, data_reg2, r0, GUEST_BASE);
/* bswap */
tcg_out_opc(s, (0xc8 + data_reg2) | P_EXT);
}
@@ -806,7 +810,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,
switch(opc) {
case 0:
/* movb */
- tcg_out_modrm_offset(s, 0x88, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0x88, data_reg, r0, GUEST_BASE);
break;
case 1:
if (bswap) {
@@ -818,7 +822,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,
}
/* movw */
tcg_out8(s, 0x66);
- tcg_out_modrm_offset(s, 0x89, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0x89, data_reg, r0, GUEST_BASE);
break;
case 2:
if (bswap) {
@@ -828,21 +832,21 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args,
data_reg = r1;
}
/* movl */
- tcg_out_modrm_offset(s, 0x89, data_reg, r0, 0);
+ tcg_out_modrm_offset(s, 0x89, data_reg, r0, GUEST_BASE);
break;
case 3:
if (bswap) {
tcg_out_mov(s, r1, data_reg2);
/* bswap data_reg */
tcg_out_opc(s, (0xc8 + r1) | P_EXT);
- tcg_out_modrm_offset(s, 0x89, r1, r0, 0);
+ tcg_out_modrm_offset(s, 0x89, r1, r0, GUEST_BASE);
tcg_out_mov(s, r1, data_reg);
/* bswap data_reg */
tcg_out_opc(s, (0xc8 + r1) | P_EXT);
- tcg_out_modrm_offset(s, 0x89, r1, r0, 4);
+ tcg_out_modrm_offset(s, 0x89, r1, r0, GUEST_BASE + 4);
} else {
- tcg_out_modrm_offset(s, 0x89, data_reg, r0, 0);
- tcg_out_modrm_offset(s, 0x89, data_reg2, r0, 4);
+ tcg_out_modrm_offset(s, 0x89, data_reg, r0, GUEST_BASE);
+ tcg_out_modrm_offset(s, 0x89, data_reg2, r0, GUEST_BASE + 4);
}
break;
default:
P.S. BTW revived?
--
mailto:av1474@comtv.ru
next prev parent reply other threads:[~2009-04-29 19:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-29 18:03 [Qemu-devel] [PATCH 01/10] export mmap_find_vma for shmat riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 02/10] Implement shm* syscalls and fix 64/32bit errors riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 03/10] linux-user: implemented ELF coredump support for ARM target [v2] riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 04/10] linux-user: added x86 and x86_64 support for ELF coredump riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 05/10] linux-user: strace now handles guest strings correctly riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 06/10] Revived GUEST_BASE support for usermode emulation targets [v2] riku.voipio
2009-04-29 19:50 ` malc [this message]
2009-05-05 13:27 ` [Qemu-devel] [PATCH] Revived GUEST_BASE support for usermode emulation targets [v3] Riku Voipio
2009-05-05 13:53 ` Paul Brook
2009-05-05 14:18 ` Riku Voipio
2009-05-05 14:34 ` Paul Brook
2009-05-05 18:02 ` malc
2009-05-05 20:46 ` [Qemu-devel] [PATCH] Revived GUEST_BASE support for usermode emulation targets [v4] Riku Voipio
2009-05-15 2:25 ` Paul Brook
2009-05-15 8:41 ` Martin Mohring
2009-05-15 9:50 ` Paul Brook
2009-05-15 9:57 ` Riku Voipio
2009-05-15 10:02 ` Paul Brook
2009-05-15 10:09 ` Paul Brook
2009-05-15 12:07 ` malc
2009-05-15 10:12 ` Martin Mohring
2009-05-15 14:13 ` Riku Voipio
2009-05-15 15:25 ` Martin Mohring
2009-04-30 7:07 ` [Qemu-devel] [PATCH 06/10] Revived GUEST_BASE support for usermode emulation targets [v2] Martin Mohring
2009-04-29 18:03 ` [Qemu-devel] [PATCH 07/10] linux-user: fix utimensat when used as futimens riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 08/10] Fix struct termios host - target translation riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 09/10] linux-user: fix utimensat with NULL timespec riku.voipio
2009-04-29 18:03 ` [Qemu-devel] [PATCH 10/10] Return EOPNOTSUPP instead of ENOSYS for *xattr* syscalls riku.voipio
2009-04-30 7:09 ` [Qemu-devel] [PATCH 01/10] export mmap_find_vma for shmat Martin Mohring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0904292348090.3672@linmac.oyster.ru \
--to=av1474@comtv.ru \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).