Changeset 8999 in vbox for trunk/src/VBox
- Timestamp:
- May 21, 2008 8:48:11 AM (17 years ago)
- Location:
- trunk/src/VBox/Disassembler
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r8987 r8999 112 112 ParseEscFP, 113 113 ParseNopPause, 114 ParseImmByteSX 114 ParseImmByteSX, 115 ParseImmZ 115 116 }; 116 117 … … 153 154 ParseEscFP, 154 155 ParseNopPause, 155 ParseImmByteSX_SizeOnly 156 ParseImmByteSX_SizeOnly, 157 ParseImmZ_SizeOnly 156 158 }; 157 159 … … 1227 1229 } 1228 1230 else 1231 if (pCpu->opmode == CPUMODE_64BIT) 1232 { 1233 pParam->parval = DISReadQWord(pCpu, lpszCodeBlock); 1234 pParam->flags |= USE_IMMEDIATE64; 1235 1236 disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), "0%VX64h", pParam->parval); 1237 return sizeof(uint64_t); 1238 } 1239 else 1229 1240 { 1230 1241 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); … … 1241 1252 if (pCpu->opmode == CPUMODE_32BIT) 1242 1253 return sizeof(uint32_t); 1254 else 1255 if (pCpu->opmode == CPUMODE_64BIT) 1256 return sizeof(uint64_t); 1257 1243 1258 return sizeof(uint16_t); 1244 1259 } 1260 //***************************************************************************** 1261 //***************************************************************************** 1262 unsigned ParseImmZ(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1263 { 1264 /* Word for 16-bit operand-size or doubleword for 32 or 64-bit operand-size. */ 1265 if (pCpu->opmode == CPUMODE_16BIT) 1266 { 1267 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); 1268 pParam->flags |= USE_IMMEDIATE16; 1269 1270 disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), "0%04Xh", (uint32_t)pParam->parval); 1271 return sizeof(uint16_t); 1272 } 1273 else 1274 { 1275 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); 1276 pParam->flags |= USE_IMMEDIATE32; 1277 1278 disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), "0%08Xh", (uint32_t)pParam->parval); 1279 return sizeof(uint32_t); 1280 } 1281 } 1282 //***************************************************************************** 1283 //***************************************************************************** 1284 unsigned ParseImmZ_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1285 { 1286 /* Word for 16-bit operand-size or doubleword for 32 or 64-bit operand-size. */ 1287 if (pCpu->opmode == CPUMODE_16BIT) 1288 return sizeof(uint16_t); 1289 return sizeof(uint32_t); 1290 } 1291 1245 1292 //***************************************************************************** 1246 1293 // Relative displacement for branches (rel. to next instruction) … … 1275 1322 } 1276 1323 else 1324 if (pCpu->opmode == CPUMODE_64BIT) 1325 { 1326 pParam->parval = DISReadQWord(pCpu, lpszCodeBlock); 1327 pParam->flags |= USE_IMMEDIATE64_REL; 1328 1329 disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), " (0%VX64h)", pParam->parval); 1330 return sizeof(int64_t); 1331 } 1332 else 1277 1333 { 1278 1334 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); … … 1290 1346 if (pCpu->opmode == CPUMODE_32BIT) 1291 1347 return sizeof(int32_t); 1348 else 1349 if (pCpu->opmode == CPUMODE_64BIT) 1350 return sizeof(int64_t); 1292 1351 return sizeof(uint16_t); 1293 1352 } -
trunk/src/VBox/Disassembler/DisasmInternal.h
r8936 r8999 69 69 #define IDX_ParseNopPause 35 70 70 #define IDX_ParseImmByteSX 36 71 #define IDX_ParseMax (IDX_ParseImmByteSX+1) 71 #define IDX_ParseImmZ 37 72 #define IDX_ParseMax (IDX_ParseImmZ+1) 72 73 73 74 #ifdef IN_RING0 … … 104 105 unsigned ParseImmVRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 105 106 unsigned ParseImmVRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 107 unsigned ParseImmZ(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 108 unsigned ParseImmZ_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 106 109 107 110 unsigned ParseImmAddr(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); -
trunk/src/VBox/Disassembler/DisasmTables.cpp
r8361 r8999 309 309 OP("les %Gv,%Mp", IDX_ParseModRM, IDX_UseModRM, 0, OP_LES, OP_PARM_Gv, OP_PARM_Mp, OP_PARM_NONE, OPTYPE_HARMLESS | OPTYPE_INVALID_64), 310 310 OP("lds %Gv,%Mp", IDX_ParseModRM, IDX_UseModRM, 0, OP_LDS, OP_PARM_Gv, OP_PARM_Mp, OP_PARM_NONE, OPTYPE_HARMLESS | OPTYPE_RRM_DANGEROUS | OPTYPE_INVALID_64), 311 /* @todo these two are groups*/311 /* @todo these two are actually group11 */ 312 312 OP("mov %Eb,%Ib", IDX_ParseModRM, IDX_ParseImmByte, 0, OP_MOV, OP_PARM_Eb, OP_PARM_Ib, OP_PARM_NONE, OPTYPE_HARMLESS), 313 OP("mov %Ev,%I v", IDX_ParseModRM, IDX_ParseImmV, 0, OP_MOV, OP_PARM_Ev, OP_PARM_Iv, OP_PARM_NONE, OPTYPE_HARMLESS),313 OP("mov %Ev,%Iz", IDX_ParseModRM, IDX_ParseImmZ, 0, OP_MOV, OP_PARM_Ev, OP_PARM_Iz, OP_PARM_NONE, OPTYPE_HARMLESS), 314 314 OP("enter %Iw,%Ib", IDX_ParseImmUshort, IDX_ParseImmByte, 0, OP_ENTER, OP_PARM_Iw, OP_PARM_Ib, OP_PARM_NONE, OPTYPE_HARMLESS), 315 315 OP("leave", 0, 0, 0, OP_LEAVE, OP_PARM_NONE, OP_PARM_NONE, OP_PARM_NONE, OPTYPE_HARMLESS | OPTYPE_DEFAULT_64_OP_SIZE), … … 2295 2295 INVALID_OPCODE, 2296 2296 /* 0F C7 */ 2297 OP("mov %Ev,%I v", IDX_ParseModRM, IDX_ParseImmV, 0, OP_MOV, OP_PARM_Ev, OP_PARM_Iz , OP_PARM_NONE, OPTYPE_HARMLESS),2297 OP("mov %Ev,%Iz", IDX_ParseModRM, IDX_ParseImmZ, 0, OP_MOV, OP_PARM_Ev, OP_PARM_Iz , OP_PARM_NONE, OPTYPE_HARMLESS), 2298 2298 INVALID_OPCODE, 2299 2299 INVALID_OPCODE, -
trunk/src/VBox/Disassembler/DisasmTablesX64.cpp
r8361 r8999 309 309 INVALID_OPCODE, 310 310 INVALID_OPCODE, 311 /* @todo these two are actually group11 */ 311 312 OP("mov %Eb,%Ib", IDX_ParseModRM, IDX_ParseImmByte, 0, OP_MOV, OP_PARM_Eb, OP_PARM_Ib, OP_PARM_NONE, OPTYPE_HARMLESS), 312 OP("mov %Ev,%I v", IDX_ParseModRM, IDX_ParseImmV, 0, OP_MOV, OP_PARM_Ev, OP_PARM_Iv, OP_PARM_NONE, OPTYPE_HARMLESS),313 OP("mov %Ev,%Iz", IDX_ParseModRM, IDX_ParseImmZ, 0, OP_MOV, OP_PARM_Ev, OP_PARM_Iz, OP_PARM_NONE, OPTYPE_HARMLESS), 313 314 OP("enter %Iw,%Ib", IDX_ParseImmUshort, IDX_ParseImmByte, 0, OP_ENTER, OP_PARM_Iw, OP_PARM_Ib, OP_PARM_NONE, OPTYPE_HARMLESS), 314 315 OP("leave", 0, 0, 0, OP_LEAVE, OP_PARM_NONE, OP_PARM_NONE, OP_PARM_NONE, OPTYPE_HARMLESS | OPTYPE_DEFAULT_64_OP_SIZE), -
trunk/src/VBox/Disassembler/DisasmTest.cpp
r8491 r8999 77 77 memset(&cpu, 0, sizeof(cpu)); 78 78 cpu.mode = CPUMODE_64BIT; 79 //__debugbreak();79 __debugbreak(); 80 80 if (VBOX_SUCCESS(DISInstr(&cpu, pInstr, 0, &cb, szOutput))) 81 81 printf(szOutput); -
trunk/src/VBox/Disassembler/DisasmTestA.asm
r8491 r8999 70 70 align 16 71 71 BEGINPROC TestProc64 72 ;incorrectly assembled by yasm; REX.W should not be added! 73 ;test rax, dword 0cc90cc90h 74 mov rax, dword 0cc90cc90h 75 mov rax, qword 0ffffcc90cc90h 76 72 77 movzx rax,byte [edx] 73 78 movzx rax,word [edx] … … 91 96 movss xmm0, xmm14 92 97 movsd xmm6, xmm1 98 93 99 ret 94 100 ENDPROC TestProc64
Note:
See TracChangeset
for help on using the changeset viewer.