Skip to contentSkip to conversation

x86_64: properly update RSI/RDI after emulated ins/outs

PATCH In review Jan Beulich 2 participants 2 messages May 26, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86_64: properly update RSI/RDI after emulated ins/outs

Negating a value of type 'unsigned' doesn't make it signed...

xen/arch/x86/traps.c renamed from home/jbeulich/src/xen/2006-05-19/xen/arch/x86/traps.c +2 -2
@@ -876,7 +876,7 @@ static int emulate_privileged_op(struct 
                     PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
                 break;
             }
-            regs->edi += (regs->eflags & EF_DF) ? -op_bytes : op_bytes;
+            regs->edi += (regs->eflags & EF_DF) ? -(long)op_bytes : op_bytes;
             break;
 
         case 0x6e: /* OUTSB */
@@ -902,7 +902,7 @@ static int emulate_privileged_op(struct 
                 outl_user((u32)data, (u16)regs->edx, v, regs);
                 break;
             }
-            regs->esi += (regs->eflags & EF_DF) ? -op_bytes : op_bytes;
+            regs->esi += (regs->eflags & EF_DF) ? -(long)op_bytes : op_bytes;
             break;
         }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 1 line · Jan Beulich

Negating a value of type 'unsigned' doesn't make it signed...

Argh, embarrassing C error. I'll fix up the mistakes in x86_emulate.c too... :-)

-- Keir