Skip to contentSkip to conversation

x86_64: Fix long jumps/calls in long mode with REX.W set

RFC PATCH In review malc 2 participants 3 messages Mar 4, 2010 – Mar 6, 2010

lore
Share & tools
lore

malc

author
#0 lore raw

RFC PATCH 1/1 x86_64: Fix long jumps/calls in long mode with REX.W set

---
 target-i386/translate.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
target-i386/translate.c +0 -0
index a597e80..68e6df9 100644
@@ -4589,9 +4589,7 @@ static target_ulong disas_insn(DisasContext *s, 

target_ulong pc_start)

                 /* operand size for jumps is 64 bit */
                 ot = OT_QUAD;
             } else if (op == 3 || op == 5) {
-                /* for call calls, the operand is 16 or 32 bit, even
-                   in long mode */
-                ot = dflag ? OT_LONG : OT_WORD;
+                ot = dflag ? OT_LONG + (rex_w == 1) : OT_WORD;
             } else if (op == 6) {
                 /* default push size is 64 bit */
                 ot = dflag ? OT_QUAD : OT_WORD;
Signature · 6 lines
1.6.6.1



-- 
mailto:[email protected]
author
#1 lore raw

On Thu, 4 Mar 2010, malc wrote:

That's not enough, later on there's a bunch of operations assuming 32bit width...

Signature · 1 line
mailto:[email protected]
#2 lore raw
Quoted 5 lines · malc

On Thu, 4 Mar 2010, malc wrote:

That's not enough, later on there's a bunch of operations assuming 32bit width...

After discussing with malc, it happens that this patch is actually correct and enough. I have just committed it.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net