diff options
Diffstat (limited to 'hw/xfree86/x86emu/decode.c')
-rw-r--r-- | hw/xfree86/x86emu/decode.c | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/hw/xfree86/x86emu/decode.c b/hw/xfree86/x86emu/decode.c index 1294640df..25415d9fa 100644 --- a/hw/xfree86/x86emu/decode.c +++ b/hw/xfree86/x86emu/decode.c @@ -37,8 +37,6 @@ * ****************************************************************************/ -/* $XdotOrg: xc/extras/x86emu/src/x86emu/decode.c,v 1.1.4.1.4.2 2004/03/05 12:46:30 eich Exp $ */ -/* $XFree86: xc/extras/x86emu/src/x86emu/decode.c,v 1.11 2002/07/23 20:20:43 tsi Exp $ */ #include "x86emu/x86emui.h" @@ -105,8 +103,14 @@ DB( if (CHECK_IP_FETCH()) INC_DECODED_INST_LEN(1); if (M.x86.intr) { if (M.x86.intr & INTR_HALTED) { -DB( printk("halted\n"); - X86EMU_trace_regs();) +DB( if (M.x86.R_SP != 0) { + printk("halted\n"); + X86EMU_trace_regs(); + } + else { + if (M.x86.debug) + printk("Service completed successfully\n"); + }) return; } if (((M.x86.intr & INTR_SYNCH) && (M.x86.intno == 0 || M.x86.intno == 2)) || @@ -116,6 +120,10 @@ DB( printk("halted\n"); } op1 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++)); (*x86emu_optab[op1])(op1); + if (M.x86.debug & DEBUG_EXIT) { + M.x86.debug &= ~DEBUG_EXIT; + return; + } } } @@ -834,6 +842,7 @@ u32 decode_rm00_address( int sib; if (M.x86.mode & SYSMODE_PREFIX_ADDR) { + /* 32-bit addressing */ switch (rm) { case 0: DECODE_PRINTF("[EAX]"); @@ -863,21 +872,22 @@ u32 decode_rm00_address( } HALT_SYS(); } else { + /* 16-bit addressing */ switch (rm) { case 0: DECODE_PRINTF("[BX+SI]"); - return M.x86.R_BX + M.x86.R_SI; + return (M.x86.R_BX + M.x86.R_SI) & 0xffff; case 1: DECODE_PRINTF("[BX+DI]"); - return M.x86.R_BX + M.x86.R_DI; + return (M.x86.R_BX + M.x86.R_DI) & 0xffff; case 2: DECODE_PRINTF("[BP+SI]"); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + M.x86.R_SI; + return (M.x86.R_BP + M.x86.R_SI) & 0xffff; case 3: DECODE_PRINTF("[BP+DI]"); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + M.x86.R_DI; + return (M.x86.R_BP + M.x86.R_DI) & 0xffff; case 4: DECODE_PRINTF("[SI]"); return M.x86.R_SI; @@ -919,6 +929,7 @@ u32 decode_rm01_address( displacement = (s8)fetch_byte_imm(); if (M.x86.mode & SYSMODE_PREFIX_ADDR) { + /* 32-bit addressing */ switch (rm) { case 0: DECODE_PRINTF2("%d[EAX]", displacement); @@ -949,34 +960,35 @@ u32 decode_rm01_address( } HALT_SYS(); } else { + /* 16-bit addressing */ switch (rm) { case 0: DECODE_PRINTF2("%d[BX+SI]", displacement); - return M.x86.R_BX + M.x86.R_SI + displacement; + return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff; case 1: DECODE_PRINTF2("%d[BX+DI]", displacement); - return M.x86.R_BX + M.x86.R_DI + displacement; + return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff; case 2: DECODE_PRINTF2("%d[BP+SI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + M.x86.R_SI + displacement; + return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff; case 3: DECODE_PRINTF2("%d[BP+DI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + M.x86.R_DI + displacement; + return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff; case 4: DECODE_PRINTF2("%d[SI]", displacement); - return M.x86.R_SI + displacement; + return (M.x86.R_SI + displacement) & 0xffff; case 5: DECODE_PRINTF2("%d[DI]", displacement); - return M.x86.R_DI + displacement; + return (M.x86.R_DI + displacement) & 0xffff; case 6: DECODE_PRINTF2("%d[BP]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + displacement; + return (M.x86.R_BP + displacement) & 0xffff; case 7: DECODE_PRINTF2("%d[BX]", displacement); - return M.x86.R_BX + displacement; + return (M.x86.R_BX + displacement) & 0xffff; } HALT_SYS(); } @@ -1010,6 +1022,7 @@ u32 decode_rm10_address( } if (M.x86.mode & SYSMODE_PREFIX_ADDR) { + /* 32-bit addressing */ switch (rm) { case 0: DECODE_PRINTF2("%08x[EAX]", displacement); @@ -1042,34 +1055,35 @@ u32 decode_rm10_address( } HALT_SYS(); } else { + /* 16-bit addressing */ switch (rm) { case 0: - DECODE_PRINTF2("%04x[BX+SI]", displacement); - return M.x86.R_BX + M.x86.R_SI + displacement; + DECODE_PRINTF2("%04x[BX+SI]", displacement); + return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff; case 1: - DECODE_PRINTF2("%04x[BX+DI]", displacement); - return M.x86.R_BX + M.x86.R_DI + displacement; + DECODE_PRINTF2("%04x[BX+DI]", displacement); + return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff; case 2: DECODE_PRINTF2("%04x[BP+SI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + M.x86.R_SI + displacement; + return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff; case 3: DECODE_PRINTF2("%04x[BP+DI]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + M.x86.R_DI + displacement; + return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff; case 4: - DECODE_PRINTF2("%04x[SI]", displacement); - return M.x86.R_SI + displacement; + DECODE_PRINTF2("%04x[SI]", displacement); + return (M.x86.R_SI + displacement) & 0xffff; case 5: - DECODE_PRINTF2("%04x[DI]", displacement); - return M.x86.R_DI + displacement; + DECODE_PRINTF2("%04x[DI]", displacement); + return (M.x86.R_DI + displacement) & 0xffff; case 6: DECODE_PRINTF2("%04x[BP]", displacement); M.x86.mode |= SYSMODE_SEG_DS_SS; - return M.x86.R_BP + displacement; + return (M.x86.R_BP + displacement) & 0xffff; case 7: - DECODE_PRINTF2("%04x[BX]", displacement); - return M.x86.R_BX + displacement; + DECODE_PRINTF2("%04x[BX]", displacement); + return (M.x86.R_BX + displacement) & 0xffff; } HALT_SYS(); } |