Changeset 8377 in vbox for trunk/src/VBox/Disassembler
- Timestamp:
- Apr 25, 2008 8:23:14 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 30173
- Location:
- trunk/src/VBox/Disassembler
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/Disasm.cpp
r8365 r8377 173 173 174 174 /* Hardcoded assumption about OP_* values!! */ 175 if (opcode <= OP_L OCK)175 if (opcode <= OP_LAST_PREFIX) 176 176 { 177 177 pCpu->lastprefix = opcode; … … 253 253 /* REX prefix byte */ 254 254 pCpu->prefix |= PREFIX_REX; 255 pCpu->prefix_rex = PREFIX_REX_OP_2_FLAGS(opcode); 255 pCpu->prefix_rex = PREFIX_REX_OP_2_FLAGS(paOneByteMap[codebyte].param1); 256 i += sizeof(uint8_t); 257 prefixbytes += sizeof(uint8_t); 256 258 257 259 if (pCpu->prefix_rex & PREFIX_REX_FLAGS_W) 258 260 pCpu->opmode = CPUMODE_64BIT; /* overrides size prefix byte */ 259 break;261 continue; //fetch the next byte 260 262 } 261 263 } -
trunk/src/VBox/Disassembler/DisasmCore.cpp
r8365 r8377 278 278 279 279 /* Hardcoded assumption about OP_* values!! */ 280 if (opcode <= OP_L OCK)280 if (opcode <= OP_LAST_PREFIX) 281 281 { 282 282 pCpu->lastprefix = opcode; … … 350 350 /* REX prefix byte */ 351 351 pCpu->prefix |= PREFIX_REX; 352 pCpu->prefix_rex = PREFIX_REX_OP_2_FLAGS(opcode); 352 pCpu->prefix_rex = PREFIX_REX_OP_2_FLAGS(paOneByteMap[codebyte].param1); 353 iByte += sizeof(uint8_t); 353 354 354 355 if (pCpu->prefix_rex & PREFIX_REX_FLAGS_W) 355 356 pCpu->opmode = CPUMODE_64BIT; /* overrides size prefix byte */ 356 break;357 continue; //fetch the next byte 357 358 } 358 359 } … … 2027 2028 subtype = OP_PARM_VSUBTYPE(pParam->param); 2028 2029 if (fRegAddr) 2029 subtype = OP_PARM_d;2030 subtype = (pCpu->opmode == CPUMODE_64BIT) ? OP_PARM_q : OP_PARM_d; 2030 2031 else 2031 2032 if (subtype == OP_PARM_v || subtype == OP_PARM_NONE) -
trunk/src/VBox/Disassembler/DisasmReg.cpp
r8364 r8377 188 188 189 189 if (subtype == OP_PARM_v) 190 {191 190 subtype = (pCpu->opmode == CPUMODE_32BIT) ? OP_PARM_d : OP_PARM_w; 192 }193 191 194 192 switch(subtype) … … 476 474 memset(pParamVal, 0, sizeof(*pParamVal)); 477 475 478 if (pParam->flags & (USE_BASE|USE_INDEX|USE_DISPLACEMENT32|USE_DISPLACEMENT16|USE_DISPLACEMENT8 ))476 if (pParam->flags & (USE_BASE|USE_INDEX|USE_DISPLACEMENT32|USE_DISPLACEMENT16|USE_DISPLACEMENT8|USE_RIPDISPLACEMENT32)) 479 477 { 480 478 // Effective address … … 528 526 if (pParam->flags & USE_DISPLACEMENT8) 529 527 { 530 if (pCpu->mode &CPUMODE_32BIT)528 if (pCpu->mode == CPUMODE_32BIT) 531 529 pParamVal->val.val32 += (int32_t)pParam->disp8; 532 530 else … … 536 534 if (pParam->flags & USE_DISPLACEMENT16) 537 535 { 538 if (pCpu->mode &CPUMODE_32BIT)536 if (pCpu->mode == CPUMODE_32BIT) 539 537 pParamVal->val.val32 += (int32_t)pParam->disp16; 540 538 else … … 544 542 if (pParam->flags & USE_DISPLACEMENT32) 545 543 { 546 if (pCpu->mode &CPUMODE_32BIT)544 if (pCpu->mode == CPUMODE_32BIT) 547 545 pParamVal->val.val32 += pParam->disp32; 546 else 547 AssertFailed(); 548 } 549 else 550 if (pParam->flags & USE_RIPDISPLACEMENT32) 551 { 552 if (pCpu->mode == CPUMODE_64BIT) 553 pParamVal->val.val64 += pParam->disp32 + pCtx->rip; 548 554 else 549 555 AssertFailed(); … … 597 603 pParamVal->type = PARMTYPE_REGISTER; 598 604 } 605 Assert(!(pParam->flags & USE_IMMEDIATE)); 606 return VINF_SUCCESS; 599 607 } 600 608 -
trunk/src/VBox/Disassembler/DisasmTest.cpp
r8155 r8377 30 30 31 31 DECLASM(int) TestProc(); 32 DECLASM(int) TestProc64(); 32 33 //uint8_t aCode16[] = { 0x66, 0x67, 0x89, 0x07 }; 33 34 … … 61 62 pInstr += cb; 62 63 } 64 65 printf("\n64 bits disassembly\n"); 66 pInstr = (RTUINTPTR)TestProc64; 67 68 for (int i=0;i<50;i++) 69 { 70 unsigned cb; 71 DISCPUSTATE cpu; 72 char szOutput[256]; 73 74 memset(&cpu, 0, sizeof(cpu)); 75 cpu.mode = CPUMODE_64BIT; 76 //__debugbreak(); 77 if (VBOX_SUCCESS(DISInstr(&cpu, pInstr, 0, &cb, szOutput))) 78 printf(szOutput); 79 else 80 { 81 printf("DISOne failed!\n"); 82 return 1; 83 } 84 pInstr += cb; 85 } 63 86 } 64 87 return 0; -
trunk/src/VBox/Disassembler/DisasmTestA.asm
r8155 r8377 66 66 ENDPROC TestProc 67 67 68 69 BITS 64 70 align 16 71 BEGINPROC TestProc64 72 movzx rax,byte [edx] 73 movzx rax,word [edx] 74 lock cmpxchg [rcx], rax 75 lock cmpxchg [rcx], ax 76 lock cmpxchg [r15], dl 77 movzx RSI, word [R8] 78 in al, dx 79 in ax, dx 80 in eax, dx 81 mov rbx, [rcx + rax*4 + 17] 82 mov rbx, [rbp + rax*4 + 4] 83 mov rbx, [rbp + rax*4] 84 int 80h 85 in al, 60h 86 in ax, dx 87 out 64h, eax 88 89 movss xmm0, xmm14 90 movsd xmm6, xmm1 91 ret 92 ENDPROC TestProc64
Note:
See TracChangeset
for help on using the changeset viewer.