Changeset 41658 in vbox for trunk/src/VBox/Disassembler/testcase
- Timestamp:
- Jun 11, 2012 10:21:44 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 78464
- Location:
- trunk/src/VBox/Disassembler/testcase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/testcase/Makefile.kmk
r41477 r41658 60 60 # $(PATH_STAGE_BIN)/testcase/tstDisasm-2$(SUFF_EXEC) 61 61 endif 62 VBOX_DISAS_TESTS_BINARIES_NOT_16BIT := \ 63 tstBinFnstsw-1.bin 64 VBOX_DISAS_TESTS_BINARIES_NOT_32BIT := 65 VBOX_DISAS_TESTS_BINARIES_NOT_64BIT := 62 66 63 67 … … 195 199 196 200 ## @todo 64-bit is problematic because of bugs like POP RDI ending up as POP EDI (incorrect default opmode). 197 #$(foreach bits, 32 16 64, $(foreach binary, $(VBOX_DISAS_TESTS_BINARIES), $(evalvalctx def_vbox_disas_binary))) 198 $(foreach bits, 32 16, $(foreach binary, $(VBOX_DISAS_TESTS_BINARIES), $(evalvalctx def_vbox_disas_binary))) 201 #$(foreach bits, 64, $(foreach binary, $(VBOX_DISAS_TESTS_BINARIES), $(evalvalctx def_vbox_disas_binary))) 202 $(foreach bits, 32 16, $(foreach binary, $(filter-out $(VBOX_DISAS_TESTS_BINARIES_NOT_$(bits)BIT), $(VBOX_DISAS_TESTS_BINARIES)) \ 203 , $(evalvalctx def_vbox_disas_binary))) 199 204 200 205 -
trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp
r41501 r41658 171 171 * however the current doesn't do this and is just complicated... 172 172 */ 173 static DECLCALLBACK(int) MyDisasInstrRead( RTUINTPTR uSrcAddr, uint8_t *pbDst, uint32_t cbRead, void *pvDisCpu)174 { 175 PMYDISSTATE pState = (PMYDISSTATE)p vDisCpu;173 static DECLCALLBACK(int) MyDisasInstrRead(PDISCPUSTATE pDisState, uint8_t *pbDst, RTUINTPTR uSrcAddr, uint32_t cbToRead) 174 { 175 PMYDISSTATE pState = (PMYDISSTATE)pDisState; 176 176 if (RT_LIKELY( pState->uNextAddr == uSrcAddr 177 && pState->cbLeft >= cb Read))177 && pState->cbLeft >= cbToRead)) 178 178 { 179 179 /* 180 180 * Straight forward reading. 181 181 */ 182 if (cb Read == 1)182 if (cbToRead == 1) 183 183 { 184 184 pState->cbLeft--; … … 188 188 else 189 189 { 190 memcpy(pbDst, pState->pbNext, cb Read);191 pState->pbNext += cb Read;192 pState->cbLeft -= cb Read;193 pState->uNextAddr += cb Read;190 memcpy(pbDst, pState->pbNext, cbToRead); 191 pState->pbNext += cbToRead; 192 pState->cbLeft -= cbToRead; 193 pState->uNextAddr += cbToRead; 194 194 } 195 195 } … … 211 211 pState->cbLeft = 0; 212 212 213 memset(pbDst, 0xcc, cb Read);213 memset(pbDst, 0xcc, cbToRead); 214 214 pState->rc = VERR_EOF; 215 215 return VERR_EOF; … … 227 227 228 228 /* do the reading. */ 229 if (pState->cbLeft >= cb Read)230 { 231 memcpy(pbDst, pState->pbNext, cb Read);232 pState->cbLeft -= cb Read;233 pState->pbNext += cb Read;234 pState->uNextAddr += cb Read;229 if (pState->cbLeft >= cbToRead) 230 { 231 memcpy(pbDst, pState->pbNext, cbToRead); 232 pState->cbLeft -= cbToRead; 233 pState->pbNext += cbToRead; 234 pState->uNextAddr += cbToRead; 235 235 } 236 236 else … … 240 240 memcpy(pbDst, pState->pbNext, pState->cbLeft); 241 241 pbDst += pState->cbLeft; 242 cb Read -= (uint32_t)pState->cbLeft;242 cbToRead -= (uint32_t)pState->cbLeft; 243 243 pState->pbNext += pState->cbLeft; 244 244 pState->uNextAddr += pState->cbLeft; 245 245 pState->cbLeft = 0; 246 246 } 247 memset(pbDst, 0xcc, cb Read);247 memset(pbDst, 0xcc, cbToRead); 248 248 pState->rc = VERR_EOF; 249 249 return VERR_EOF; … … 253 253 { 254 254 RTStrmPrintf(g_pStdErr, "Reading before current instruction!\n"); 255 memset(pbDst, 0x90, cb Read);255 memset(pbDst, 0x90, cbToRead); 256 256 pState->rc = VERR_INTERNAL_ERROR; 257 257 return VERR_INTERNAL_ERROR; … … 286 286 */ 287 287 MYDISSTATE State; 288 State.Cpu.mode = enmCpuMode;289 State.Cpu.pfnReadBytes = MyDisasInstrRead;290 288 State.uAddress = uAddress; 291 289 State.pbInstr = pbFile; … … 331 329 State.pbNext = State.pbInstr; 332 330 333 int rc = DISInstr(&State.Cpu, State.uAddress, 0, &State.cbInstr, State.szLine); 331 332 int rc = DISInstrWithReader(State.uAddress, enmCpuMode, MyDisasInstrRead, &State, 333 &State.Cpu, &State.cbInstr, State.szLine); 334 334 if ( RT_SUCCESS(rc) 335 335 || ( ( rc == VERR_DIS_INVALID_OPCODE … … 345 345 if (State.fUndefOp && State.enmUndefOp == kUndefOp_DefineByte) 346 346 { 347 if (!State.cbInstr) 348 { 349 State.Cpu.abInstr[0] = 0; 350 State.Cpu.pfnReadBytes(&State.Cpu, &State.Cpu.abInstr[0], State.uAddress, 1); 351 State.cbInstr = 1; 352 } 347 353 RTPrintf(" db"); 348 if (!State.cbInstr)349 State.cbInstr = 1;350 354 for (unsigned off = 0; off < State.cbInstr; off++) 351 { 352 uint8_t b; 353 State.Cpu.pfnReadBytes(State.uAddress + off, &b, 1, &State.Cpu); 354 RTPrintf(off ? ", %03xh" : " %03xh", b); 355 } 355 RTPrintf(off ? ", %03xh" : " %03xh", State.Cpu.abInstr[off]); 356 356 RTPrintf(" ; %s\n", State.szLine); 357 357 } … … 376 376 RTPrintf(" db"); 377 377 for (unsigned off = 0; off < State.cbInstr; off++) 378 { 379 uint8_t b; 380 State.Cpu.pfnReadBytes(State.uAddress + off, &b, 1, &State.Cpu); 381 RTPrintf(off ? ", %03xh" : " %03xh", b); 382 } 378 RTPrintf(off ? ", %03xh" : " %03xh", State.Cpu.abInstr[off]); 383 379 RTPrintf(" ; "); 384 380 }
Note:
See TracChangeset
for help on using the changeset viewer.