Changeset 4953 in vbox for trunk/src/VBox/VMM/DBGFDisas.cpp
- Timestamp:
- Sep 21, 2007 2:08:19 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/DBGFDisas.cpp
r4071 r4953 40 40 * Internal Functions * 41 41 *******************************************************************************/ 42 static DECLCALLBACK(int 32_t) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata);42 static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata); 43 43 44 44 … … 65 65 /** Pointer to the current page - GC Ptr. */ 66 66 RTGCPTR pvPageGC; 67 /** The rc of the operation.68 * @todo r=bird: it's rather annoying that we have to keep track of the status code of the operation.69 * When we've got time we should adjust the disassembler to use VBox status codes and not70 * boolean returns.71 */72 int rc;73 67 /** Pointer to the next instruction (relative to GCPtrSegBase). */ 74 68 RTGCUINTPTR GCPtrNext; … … 97 91 pState->pvPageGC = 0; 98 92 pState->pvPageHC = NULL; 99 pState->rc = VINF_SUCCESS;100 93 pState->pVM = pVM; 101 94 Assert((uintptr_t)GCPtr == GCPtr); 102 95 uint32_t cbInstr; 103 if (DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL)) 96 int rc = DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL); 97 if (VBOX_SUCCESS(rc)) 104 98 { 105 99 pState->GCPtrNext = GCPtr + cbInstr; 106 100 return VINF_SUCCESS; 107 101 } 108 if (VBOX_FAILURE(pState->rc)) 109 return pState->rc; 110 return VERR_GENERAL_FAILURE; 102 return rc; 111 103 } 112 104 … … 123 115 pState->rc = VINF_SUCCESS; 124 116 uint32_t cbInstr; 125 if (DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL)) 117 int rc = DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL); 118 if (VBOX_SUCCESS(rc)) 126 119 { 127 120 pState->GCPtrNext = GCPtr + cbInstr; 128 121 return VINF_SUCCESS; 129 122 } 130 if (VBOX_FAILURE(pState->rc)) 131 return pState->rc; 132 return VERR_GENERAL_FAILURE; 123 return rc; 133 124 } 134 125 #endif … … 146 137 * In this context it's always pointer to the Core of a DBGFDISASSTATE. 147 138 */ 148 static DECLCALLBACK(int 32_t) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, RTHCUINTPTR uDisCpu)149 { 150 PDBGFDISASSTATE pState = (PDBGFDISASSTATE) uDisCpu;139 static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, unsigned cbRead, void *pvDisCpu) 140 { 141 PDBGFDISASSTATE pState = (PDBGFDISASSTATE)pvDisCpu; 151 142 Assert(cbRead > 0); 152 143 for (;;) … … 158 149 || (GCPtr >> PAGE_SHIFT) != (pState->pvPageGC >> PAGE_SHIFT)) 159 150 { 151 int rc = VINF_SUCCESS; 152 160 153 /* translate the address */ 161 154 pState->pvPageGC = GCPtr & PAGE_BASE_GC_MASK; … … 164 157 pState->pvPageHC = MMHyperGC2HC(pState->pVM, pState->pvPageGC); 165 158 if (!pState->pvPageHC) 166 pState->rc = VERR_INVALID_POINTER;159 rc = VERR_INVALID_POINTER; 167 160 } 168 161 else if (pState->enmMode <= PGMMODE_PROTECTED) 169 pState->rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC);162 rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC); 170 163 else 171 pState->rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);172 if (VBOX_FAILURE( pState->rc))164 rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC); 165 if (VBOX_FAILURE(rc)) 173 166 { 174 167 pState->pvPageHC = NULL; 175 return pState->rc;168 return rc; 176 169 } 177 170 } … … 179 172 /* check the segemnt limit */ 180 173 if (PtrSrc > pState->cbSegLimit) 181 return pState->rc =VERR_OUT_OF_SELECTOR_BOUNDS;174 return VERR_OUT_OF_SELECTOR_BOUNDS; 182 175 183 176 /* calc how much we can read */ … … 544 537 size_t cbBits = State.Cpu.opsize; 545 538 uint8_t *pau8Bits = (uint8_t *)alloca(cbBits); 546 rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, (uintptr_t)&State);539 rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, &State); 547 540 AssertRC(rc); 548 541 if (fFlags & DBGF_DISAS_FLAGS_NO_ADDRESS)
Note:
See TracChangeset
for help on using the changeset viewer.