qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] x86: Fixed incorrect segment base address addition
@ 2012-07-02 10:29 Vitaly Chipounov
  2012-07-02 15:18 ` Max Filippov
  0 siblings, 1 reply; 6+ messages in thread
From: Vitaly Chipounov @ 2012-07-02 10:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vitaly Chipounov

An instruction with address and segment size override triggers the bug.
inc dword ptr gs:260h[ebx*4] gets incorrectly translated to:
(uint32_t)(gs.base + ebx * 4 + 0x260)
instead of
gs.base + (uint32_t)(ebx * 4 + 0x260)

Signed-off-by: Vitaly Chipounov <vitaly.chipounov@epfl.ch>
---
 target-i386/translate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-i386/translate.c b/target-i386/translate.c
index a902f4a..9ca7375 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -459,10 +459,10 @@ static inline void gen_op_movl_A0_seg(int reg)
 static inline void gen_op_addl_A0_seg(int reg)
 {
     tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUX86State, segs[reg].base));
-    tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_tmp0);
 #ifdef TARGET_X86_64
     tcg_gen_andi_tl(cpu_A0, cpu_A0, 0xffffffff);
 #endif
+    tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_tmp0);
 }
 
 #ifdef TARGET_X86_64
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-29  9:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 10:29 [Qemu-devel] [PATCH] x86: Fixed incorrect segment base address addition Vitaly Chipounov
2012-07-02 15:18 ` Max Filippov
2012-07-02 22:09   ` Vitaly Chipounov
2012-07-02 22:20   ` [Qemu-devel] [PATCH v2] x86: Fixed incorrect segment base address addition in 64-bits mode Vitaly Chipounov
2012-07-03 12:52     ` Max Filippov
2012-07-29  9:38     ` Blue Swirl

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).