vbox的更動 17426 路徑 trunk/src/recompiler_new
- 時間撮記:
- 2009-3-6 上午01:55:51 (16 年 以前)
- 位置:
- trunk/src/recompiler_new
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/recompiler_new/VBoxREMWrapper.cpp
r17251 r17426 725 725 { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL } 726 726 }; 727 static const REMPARMDESC g_aArgsPGMPhysGCPtr2R3PtrByGstCR3[] =728 {729 { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },730 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },731 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL },732 { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },733 { REMPARMDESC_FLAGS_INT, sizeof(PRTR3PTR), NULL }734 };735 727 static const REMPARMDESC g_aArgsPGM3PhysGrowRange[] = 736 728 { … … 1131 1123 { "PGMInvalidatePage", (void *)(uintptr_t)&PGMInvalidatePage, &g_aArgsPGMInvalidatePage[0], RT_ELEMENTS(g_aArgsPGMInvalidatePage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1132 1124 { "PGMPhysGCPhys2R3Ptr", (void *)(uintptr_t)&PGMPhysGCPhys2R3Ptr, &g_aArgsPGMPhysGCPhys2R3Ptr[0], RT_ELEMENTS(g_aArgsPGMPhysGCPhys2R3Ptr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1133 { "PGMPhysGCPtr2R3PtrByGstCR3", (void *)(uintptr_t)&PGMPhysGCPtr2R3PtrByGstCR3, &g_aArgsPGMPhysGCPtr2R3PtrByGstCR3[0], RT_ELEMENTS(g_aArgsPGMPhysGCPtr2R3PtrByGstCR3), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1134 1125 #ifndef VBOX_WITH_NEW_PHYS_CODE 1135 1126 { "PGM3PhysGrowRange", (void *)(uintptr_t)&PGM3PhysGrowRange, &g_aArgsPGM3PhysGrowRange[0], RT_ELEMENTS(g_aArgsPGM3PhysGrowRange), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, -
trunk/src/recompiler_new/VBoxRecompiler.c
r17366 r17426 3465 3465 3466 3466 /** 3467 * Disassembles n instructions and prints them to the log.3468 *3469 * @returns Success indicator.3470 * @param env Pointer to the recompiler CPU structure.3471 * @param f32BitCode Indicates that whether or not the code should3472 * be disassembled as 16 or 32 bit. If -1 the CS3473 * selector will be inspected.3474 * @param nrInstructions Nr of instructions to disassemble3475 * @param pszPrefix3476 * @remark not currently used for anything but ad-hoc debugging.3477 */3478 bool remR3DisasBlock(CPUState *env, int f32BitCode, int nrInstructions, char *pszPrefix)3479 {3480 int i, rc;3481 RTGCPTR GCPtrPC;3482 uint8_t *pvPC;3483 RTINTPTR off;3484 DISCPUSTATE Cpu;3485 3486 /*3487 * Determin 16/32 bit mode.3488 */3489 if (f32BitCode == -1)3490 f32BitCode = !!(env->segs[R_CS].flags & X86_DESC_DB); /** @todo is this right?!!?!?!?!? */3491 3492 /*3493 * Convert cs:eip to host context address.3494 * We don't care to much about cross page correctness presently.3495 */3496 GCPtrPC = env->segs[R_CS].base + env->eip;3497 if (f32BitCode && (env->cr[0] & (X86_CR0_PE | X86_CR0_PG)) == (X86_CR0_PE | X86_CR0_PG))3498 {3499 Assert(PGMGetGuestMode(env->pVM) < PGMMODE_AMD64);3500 3501 /* convert eip to physical address. */3502 rc = PGMPhysGCPtr2R3PtrByGstCR3(env->pVM,3503 GCPtrPC,3504 env->cr[3],3505 env->cr[4] & (X86_CR4_PSE | X86_CR4_PAE), /** @todo add longmode flag */3506 (void**)&pvPC);3507 if (RT_FAILURE(rc))3508 {3509 if (!PATMIsPatchGCAddr(env->pVM, GCPtrPC))3510 return false;3511 pvPC = (uint8_t *)PATMR3QueryPatchMemHC(env->pVM, NULL)3512 + (GCPtrPC - PATMR3QueryPatchMemGC(env->pVM, NULL));3513 }3514 }3515 else3516 {3517 /* physical address */3518 rc = PGMPhysGCPhys2R3Ptr(env->pVM, (RTGCPHYS)GCPtrPC, nrInstructions * 16,3519 (void**)&pvPC);3520 if (RT_FAILURE(rc))3521 return false;3522 }3523 3524 /*3525 * Disassemble.3526 */3527 off = env->eip - (RTGCUINTPTR)(uintptr_t)pvPC;3528 Cpu.mode = f32BitCode ? CPUMODE_32BIT : CPUMODE_16BIT;3529 Cpu.pfnReadBytes = NULL; /** @todo make cs:eip reader for the disassembler. */3530 //Cpu.dwUserData[0] = (uintptr_t)pVM;3531 //Cpu.dwUserData[1] = (uintptr_t)pvPC;3532 //Cpu.dwUserData[2] = GCPtrPC;3533 3534 for (i=0;i<nrInstructions;i++)3535 {3536 char szOutput[256];3537 uint32_t cbOp;3538 if (RT_FAILURE(DISInstr(&Cpu, (uintptr_t)pvPC, off, &cbOp, &szOutput[0])))3539 return false;3540 if (pszPrefix)3541 Log(("%s: %s", pszPrefix, szOutput));3542 else3543 Log(("%s", szOutput));3544 3545 pvPC += cbOp;3546 }3547 return true;3548 }3549 3550 3551 /** @todo need to test the new code, using the old code in the mean while. */3552 #define USE_OLD_DUMP_AND_DISASSEMBLY3553 3554 /**3555 3467 * Disassembles one instruction and prints it to the log. 3556 3468 * … … 3564 3476 bool remR3DisasInstr(CPUState *env, int f32BitCode, char *pszPrefix) 3565 3477 { 3566 #ifdef USE_OLD_DUMP_AND_DISASSEMBLY3567 PVM pVM = env->pVM;3568 RTGCPTR GCPtrPC;3569 uint8_t *pvPC;3570 char szOutput[256];3571 uint32_t cbOp;3572 RTINTPTR off;3573 DISCPUSTATE Cpu;3574 3575 3576 /* Doesn't work in long mode. */3577 if (env->hflags & HF_LMA_MASK)3578 return false;3579 3580 /*3581 * Determin 16/32 bit mode.3582 */3583 if (f32BitCode == -1)3584 f32BitCode = !!(env->segs[R_CS].flags & X86_DESC_DB); /** @todo is this right?!!?!?!?!? */3585 3586 /*3587 * Log registers3588 */3589 if (LogIs2Enabled())3590 {3591 remR3StateUpdate(pVM);3592 DBGFR3InfoLog(pVM, "cpumguest", pszPrefix);3593 }3594 3595 /*3596 * Convert cs:eip to host context address.3597 * We don't care to much about cross page correctness presently.3598 */3599 GCPtrPC = env->segs[R_CS].base + env->eip;3600 if ((env->cr[0] & (X86_CR0_PE | X86_CR0_PG)) == (X86_CR0_PE | X86_CR0_PG))3601 {3602 /* convert eip to physical address. */3603 int rc = PGMPhysGCPtr2R3PtrByGstCR3(pVM,3604 GCPtrPC,3605 env->cr[3],3606 env->cr[4] & (X86_CR4_PSE | X86_CR4_PAE),3607 (void**)&pvPC);3608 if (RT_FAILURE(rc))3609 {3610 if (!PATMIsPatchGCAddr(pVM, GCPtrPC))3611 return false;3612 pvPC = (uint8_t *)PATMR3QueryPatchMemHC(pVM, NULL)3613 + (GCPtrPC - PATMR3QueryPatchMemGC(pVM, NULL));3614 }3615 }3616 else3617 {3618 3619 /* physical address */3620 int rc = PGMPhysGCPhys2R3Ptr(pVM, (RTGCPHYS)GCPtrPC, 16, (void**)&pvPC);3621 if (RT_FAILURE(rc))3622 return false;3623 }3624 3625 /*3626 * Disassemble.3627 */3628 off = env->eip - (RTGCUINTPTR)(uintptr_t)pvPC;3629 Cpu.mode = f32BitCode ? CPUMODE_32BIT : CPUMODE_16BIT;3630 Cpu.pfnReadBytes = NULL; /** @todo make cs:eip reader for the disassembler. */3631 //Cpu.dwUserData[0] = (uintptr_t)pVM;3632 //Cpu.dwUserData[1] = (uintptr_t)pvPC;3633 //Cpu.dwUserData[2] = GCPtrPC;3634 if (RT_FAILURE(DISInstr(&Cpu, (uintptr_t)pvPC, off, &cbOp, &szOutput[0])))3635 return false;3636 3637 if (!f32BitCode)3638 {3639 if (pszPrefix)3640 Log(("%s: %04X:%s", pszPrefix, env->segs[R_CS].selector, szOutput));3641 else3642 Log(("%04X:%s", env->segs[R_CS].selector, szOutput));3643 }3644 else3645 {3646 if (pszPrefix)3647 Log(("%s: %s", pszPrefix, szOutput));3648 else3649 Log(("%s", szOutput));3650 }3651 return true;3652 3653 #else /* !USE_OLD_DUMP_AND_DISASSEMBLY */3654 3478 PVM pVM = env->pVM; 3655 3479 const bool fLog = LogIsEnabled(); … … 3681 3505 3682 3506 return RT_SUCCESS(rc); 3683 #endif3684 3507 } 3685 3508
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器