Changeset 99208 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Mar 29, 2023 2:13:56 PM (22 months ago)
- Location:
- trunk/src/VBox/Runtime/testcase
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstLdr-2.cpp
r98103 r99208 51 51 bool MyDisBlock(uint8_t const *pbCodeBlock, int32_t cbMax) 52 52 { 53 DIS CPUSTATE Cpu;53 DISSTATE Dis; 54 54 int32_t i = 0; 55 55 while (i < cbMax) … … 57 57 char szOutput[256]; 58 58 uint32_t cbInstr; 59 if (RT_FAILURE(DISInstrToStr(pbCodeBlock + i, DISCPUMODE_32BIT, & Cpu, &cbInstr, szOutput, sizeof(szOutput))))59 if (RT_FAILURE(DISInstrToStr(pbCodeBlock + i, DISCPUMODE_32BIT, &Dis, &cbInstr, szOutput, sizeof(szOutput)))) 60 60 return false; 61 61 -
trunk/src/VBox/Runtime/testcase/tstLdr-3.cpp
r98103 r99208 137 137 } 138 138 139 static DECLCALLBACK(int) MyGetSymbol(PCDIS CPUSTATE pCpu, uint32_t u32Sel, RTUINTPTR uAddress,139 static DECLCALLBACK(int) MyGetSymbol(PCDISSTATE pDis, uint32_t u32Sel, RTUINTPTR uAddress, 140 140 char *pszBuf, size_t cchBuf, RTINTPTR *poff, 141 141 void *pvUser) 142 142 { 143 RT_NOREF3(p Cpu, u32Sel, pvUser);143 RT_NOREF3(pDis, u32Sel, pvUser); 144 144 145 145 if ( uAddress > RTLdrSize(g_hLdrMod) + g_uLoadAddr … … 161 161 * @callback_method_impl{FNDISREADBYTES} 162 162 */ 163 static DECLCALLBACK(int) MyReadBytes(PDIS CPUSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)163 static DECLCALLBACK(int) MyReadBytes(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead) 164 164 { 165 165 RT_NOREF1(cbMaxRead); … … 174 174 RTUINTPTR uNearAddr, RTUINTPTR uSearchAddr) 175 175 { 176 DIS CPUSTATE Cpu;177 int32_t 176 DISSTATE Dis; 177 int32_t i = 0; 178 178 while (i < cbMax) 179 179 { … … 184 184 int rc = DISInstrWithReader(uNearAddr + i, enmCpuMode, 185 185 MyReadBytes, (uint8_t *)pvCodeBlock - (uintptr_t)uNearAddr, 186 & Cpu, &cbInstr);186 &Dis, &cbInstr); 187 187 RTAssertSetMayPanic(fMayPanic); 188 188 RTAssertSetQuiet(fQuiet); … … 195 195 RTPrintf("%s:\n", NearSym.aSyms[0].szName); 196 196 197 DISFormatYasmEx(& Cpu, szOutput, sizeof(szOutput),197 DISFormatYasmEx(&Dis, szOutput, sizeof(szOutput), 198 198 DIS_FMT_FLAGS_RELATIVE_BRANCH | DIS_FMT_FLAGS_BYTES_RIGHT | DIS_FMT_FLAGS_ADDR_LEFT | DIS_FMT_FLAGS_BYTES_SPACED, 199 199 MyGetSymbol, NULL); -
trunk/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp
r98103 r99208 93 93 * @callback_method_impl{FNDISREADBYTES} 94 94 */ 95 static DECLCALLBACK(int) DisasmTest1ReadCode(PDIS CPUSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)95 static DECLCALLBACK(int) DisasmTest1ReadCode(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead) 96 96 { 97 97 size_t cb = cbMaxRead; … … 107 107 * Use an inline function here just to test '__textcoal_nt' sections on darwin. 108 108 */ 109 inline int MyDisasm(uintptr_t CodeIndex, PDIS CPUSTATE pCpu, uint32_t *pcb)109 inline int MyDisasm(uintptr_t CodeIndex, PDISSTATE pDis, uint32_t *pcb) 110 110 { 111 111 uint32_t cb; 112 int rc = DISInstrWithReader(CodeIndex, DISCPUMODE_32BIT, DisasmTest1ReadCode, 0, p Cpu, &cb);112 int rc = DISInstrWithReader(CodeIndex, DISCPUMODE_32BIT, DisasmTest1ReadCode, 0, pDis, &cb); 113 113 *pcb = cb; 114 114 MY_PRINTF(("DISCoreOneEx -> rc=%d cb=%d Cpu: bOpCode=%#x pCurInstr=%p (42=%d)\n", \ 115 rc, cb, p Cpu->bOpCode, pCpu->pCurInstr, 42)); \115 rc, cb, pDis->bOpCode, pDis->pCurInstr, 42)); \ 116 116 return rc; 117 117 } … … 120 120 extern "C" DECLEXPORT(int) DisasmTest1(void) 121 121 { 122 DIS CPUSTATE Cpu;122 DISSTATE Dis; 123 123 uintptr_t CodeIndex = 0; 124 124 uint32_t cb; … … 140 140 #endif 141 141 142 memset(& Cpu, 0, sizeof(Cpu));142 memset(&Dis, 0, sizeof(Dis)); 143 143 144 144 #define DISAS_AND_CHECK(cbInstr, enmOp) \ 145 145 do { \ 146 rc = MyDisasm(CodeIndex, & Cpu, &cb); \146 rc = MyDisasm(CodeIndex, &Dis, &cb); \ 147 147 if (RT_FAILURE(rc)) \ 148 148 return CodeIndex | 0xf000; \ 149 if ( Cpu.pCurInstr->uOpcode != (enmOp)) \149 if (Dis.pCurInstr->uOpcode != (enmOp)) \ 150 150 return CodeIndex| 0xe000; \ 151 151 if (cb != (cbInstr)) \ -
trunk/src/VBox/Runtime/testcase/tstLdrObjR0.cpp
r98103 r99208 103 103 { 104 104 static unsigned cb; 105 DIS CPUSTATE Cpu;105 DISSTATE Dis; 106 106 107 memset(& Cpu, 0, sizeof(Cpu));107 memset(&Dis, 0, sizeof(Dis)); 108 108 109 DISInstr((void *)(uintptr_t)SomeExportFunction3, DISCPUMODE_32BIT, & Cpu, &cb);109 DISInstr((void *)(uintptr_t)SomeExportFunction3, DISCPUMODE_32BIT, &Dis, &cb); 110 110 return (void *)(uintptr_t)&SomeExportFunction1; 111 111 }
Note:
See TracChangeset
for help on using the changeset viewer.