vbox的更動 44399 路徑 trunk/src/VBox/VMM/VMMR3/DBGFReg.cpp
- 時間撮記:
- 2013-1-27 下午09:12:53 (12 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/VMMR3/DBGFReg.cpp
r41803 r44399 25 25 #include <VBox/vmm/mm.h> 26 26 #include <VBox/vmm/vm.h> 27 #include <VBox/vmm/uvm.h> 27 28 #include <VBox/param.h> 28 29 #include <VBox/err.h> … … 37 38 *******************************************************************************/ 38 39 /** Locks the register database for writing. */ 39 #define DBGF_REG_DB_LOCK_WRITE(p VM) \40 #define DBGF_REG_DB_LOCK_WRITE(pUVM) \ 40 41 do { \ 41 int rcSem = RTSemRWRequestWrite((p VM)->dbgf.s.hRegDbLock, RT_INDEFINITE_WAIT); \42 int rcSem = RTSemRWRequestWrite((pUVM)->dbgf.s.hRegDbLock, RT_INDEFINITE_WAIT); \ 42 43 AssertRC(rcSem); \ 43 44 } while (0) 44 45 45 46 /** Unlocks the register database after writing. */ 46 #define DBGF_REG_DB_UNLOCK_WRITE(p VM) \47 #define DBGF_REG_DB_UNLOCK_WRITE(pUVM) \ 47 48 do { \ 48 int rcSem = RTSemRWReleaseWrite((p VM)->dbgf.s.hRegDbLock); \49 int rcSem = RTSemRWReleaseWrite((pUVM)->dbgf.s.hRegDbLock); \ 49 50 AssertRC(rcSem); \ 50 51 } while (0) 51 52 52 53 /** Locks the register database for reading. */ 53 #define DBGF_REG_DB_LOCK_READ(p VM) \54 #define DBGF_REG_DB_LOCK_READ(pUVM) \ 54 55 do { \ 55 int rcSem = RTSemRWRequestRead((p VM)->dbgf.s.hRegDbLock, RT_INDEFINITE_WAIT); \56 int rcSem = RTSemRWRequestRead((pUVM)->dbgf.s.hRegDbLock, RT_INDEFINITE_WAIT); \ 56 57 AssertRC(rcSem); \ 57 58 } while (0) 58 59 59 60 /** Unlocks the register database after reading. */ 60 #define DBGF_REG_DB_UNLOCK_READ(p VM) \61 #define DBGF_REG_DB_UNLOCK_READ(pUVM) \ 61 62 do { \ 62 int rcSem = RTSemRWReleaseRead((p VM)->dbgf.s.hRegDbLock); \63 int rcSem = RTSemRWReleaseRead((pUVM)->dbgf.s.hRegDbLock); \ 63 64 AssertRC(rcSem); \ 64 65 } while (0) … … 161 162 /** The number of entries in the output array. */ 162 163 size_t cRegs; 163 /** The current register number when enumerating the string space. */ 164 /** The current register number when enumerating the string space. 165 * @remarks Only used by EMT(0). */ 164 166 size_t iReg; 165 167 } DBGFR3REGNMQUERYALLARGS; … … 174 176 typedef struct DBGFR3REGPRINTFARGS 175 177 { 176 /** Pointer to the VM. */177 P VM pVM;178 /** The user mode VM handle. */ 179 PUVM pUVM; 178 180 /** The target CPU. */ 179 181 VMCPUID idCpu; … … 204 206 * 205 207 * @returns VBox status code. 206 * @param p VM Pointer to the VM.207 */ 208 int dbgfR3RegInit(P VM pVM)209 { 210 int rc= VINF_SUCCESS;211 if (!p VM->dbgf.s.fRegDbInitialized)212 { 213 rc = RTSemRWCreate(&p VM->dbgf.s.hRegDbLock);214 p VM->dbgf.s.fRegDbInitialized = RT_SUCCESS(rc);208 * @param pUVM The user mode VM handle. 209 */ 210 int dbgfR3RegInit(PUVM pUVM) 211 { 212 int rc = VINF_SUCCESS; 213 if (!pUVM->dbgf.s.fRegDbInitialized) 214 { 215 rc = RTSemRWCreate(&pUVM->dbgf.s.hRegDbLock); 216 pUVM->dbgf.s.fRegDbInitialized = RT_SUCCESS(rc); 215 217 } 216 218 return rc; … … 221 223 * Terminates the register database. 222 224 * 223 * @param p VM Pointer to the VM.224 */ 225 void dbgfR3RegTerm(P VM pVM)226 { 227 RTSemRWDestroy(p VM->dbgf.s.hRegDbLock);228 p VM->dbgf.s.hRegDbLock = NIL_RTSEMRW;229 p VM->dbgf.s.fRegDbInitialized = false;225 * @param pUVM The user mode VM handle. 226 */ 227 void dbgfR3RegTerm(PUVM pUVM) 228 { 229 RTSemRWDestroy(pUVM->dbgf.s.hRegDbLock); 230 pUVM->dbgf.s.hRegDbLock = NIL_RTSEMRW; 231 pUVM->dbgf.s.fRegDbInitialized = false; 230 232 } 231 233 … … 262 264 * 263 265 * @returns VBox status code. 264 * @param p VM Pointer to the VM.266 * @param pUVM The user mode VM handle. 265 267 * @param paRegisters The register descriptors. 266 268 * @param enmType The set type. … … 270 272 * pszPrefix when creating the set name. 271 273 */ 272 static int dbgfR3RegRegisterCommon(P VM pVM, PCDBGFREGDESC paRegisters, DBGFREGSETTYPE enmType, void *pvUserArg,274 static int dbgfR3RegRegisterCommon(PUVM pUVM, PCDBGFREGDESC paRegisters, DBGFREGSETTYPE enmType, void *pvUserArg, 273 275 const char *pszPrefix, uint32_t iInstance) 274 276 { … … 338 340 339 341 /* Check the instance number of the CPUs. */ 340 AssertReturn(enmType != DBGFREGSETTYPE_CPU || iInstance < p VM->cCpus, VERR_INVALID_CPU_ID);342 AssertReturn(enmType != DBGFREGSETTYPE_CPU || iInstance < pUVM->cCpus, VERR_INVALID_CPU_ID); 341 343 342 344 /* … … 348 350 cbRegSet += cLookupRecs * sizeof(DBGFREGLOOKUP); 349 351 350 PDBGFREGSET pRegSet = (PDBGFREGSET)MMR3HeapAllocZ (pVM, MM_TAG_DBGF_REG, cbRegSet);352 PDBGFREGSET pRegSet = (PDBGFREGSET)MMR3HeapAllocZU(pUVM, MM_TAG_DBGF_REG, cbRegSet); 351 353 if (!pRegSet) 352 354 return VERR_NO_MEMORY; … … 382 384 { 383 385 strcpy(pszReg, paRegisters[iDesc].pszName); 384 pLookupRec->Core.pszString = MMR3HeapStrDup (pVM, MM_TAG_DBGF_REG, szName);386 pLookupRec->Core.pszString = MMR3HeapStrDupU(pUVM, MM_TAG_DBGF_REG, szName); 385 387 if (!pLookupRec->Core.pszString) 386 388 rc = VERR_NO_STR_MEMORY; … … 411 413 { 412 414 strcpy(pszSub, paSubFields[iSubField].pszName); 413 pLookupRec->Core.pszString = MMR3HeapStrDup (pVM, MM_TAG_DBGF_REG, szName);415 pLookupRec->Core.pszString = MMR3HeapStrDupU(pUVM, MM_TAG_DBGF_REG, szName); 414 416 if (!pLookupRec->Core.pszString) 415 417 rc = VERR_NO_STR_MEMORY; … … 432 434 /* The alias record. */ 433 435 strcpy(pszReg, pszRegName); 434 pLookupRec->Core.pszString = MMR3HeapStrDup (pVM, MM_TAG_DBGF_REG, szName);436 pLookupRec->Core.pszString = MMR3HeapStrDupU(pUVM, MM_TAG_DBGF_REG, szName); 435 437 if (!pLookupRec->Core.pszString) 436 438 rc = VERR_NO_STR_MEMORY; … … 450 452 * the CPU register set cache. 451 453 */ 452 DBGF_REG_DB_LOCK_WRITE(p VM);453 454 bool fInserted = RTStrSpaceInsert(&p VM->dbgf.s.RegSetSpace, &pRegSet->Core);454 DBGF_REG_DB_LOCK_WRITE(pUVM); 455 456 bool fInserted = RTStrSpaceInsert(&pUVM->dbgf.s.RegSetSpace, &pRegSet->Core); 455 457 if (fInserted) 456 458 { 457 p VM->dbgf.s.cRegs += pRegSet->cDescs;459 pUVM->dbgf.s.cRegs += pRegSet->cDescs; 458 460 if (enmType == DBGFREGSETTYPE_CPU) 459 461 { 460 462 if (pRegSet->cDescs > DBGFREG_ALL_COUNT) 461 p VM->dbgf.s.cRegs -= pRegSet->cDescs - DBGFREG_ALL_COUNT;463 pUVM->dbgf.s.cRegs -= pRegSet->cDescs - DBGFREG_ALL_COUNT; 462 464 if (!strcmp(pszPrefix, "cpu")) 463 p VM->aCpus[iInstance].dbgf.s.pGuestRegSet = pRegSet;465 pUVM->aCpus[iInstance].dbgf.s.pGuestRegSet = pRegSet; 464 466 else 465 p VM->aCpus[iInstance].dbgf.s.pHyperRegSet = pRegSet;467 pUVM->aCpus[iInstance].dbgf.s.pHyperRegSet = pRegSet; 466 468 } 467 469 … … 470 472 while (iLookupRec-- > 0) 471 473 { 472 bool fInserted2 = RTStrSpaceInsert(&p VM->dbgf.s.RegSpace, &paLookupRecs[iLookupRec].Core);474 bool fInserted2 = RTStrSpaceInsert(&pUVM->dbgf.s.RegSpace, &paLookupRecs[iLookupRec].Core); 473 475 AssertMsg(fInserted2, ("'%s'", paLookupRecs[iLookupRec].Core.pszString)); NOREF(fInserted2); 474 476 } 475 477 476 DBGF_REG_DB_UNLOCK_WRITE(p VM);478 DBGF_REG_DB_UNLOCK_WRITE(pUVM); 477 479 return VINF_SUCCESS; 478 480 } 479 481 480 DBGF_REG_DB_UNLOCK_WRITE(p VM);482 DBGF_REG_DB_UNLOCK_WRITE(pUVM); 481 483 rc = VERR_DUPLICATE; 482 484 } … … 505 507 VMMR3_INT_DECL(int) DBGFR3RegRegisterCpu(PVM pVM, PVMCPU pVCpu, PCDBGFREGDESC paRegisters, bool fGuestRegs) 506 508 { 507 if (!pVM->dbgf.s.fRegDbInitialized) 508 { 509 int rc = dbgfR3RegInit(pVM); 509 PUVM pUVM = pVM->pUVM; 510 if (!pUVM->dbgf.s.fRegDbInitialized) 511 { 512 int rc = dbgfR3RegInit(pUVM); 510 513 if (RT_FAILURE(rc)) 511 514 return rc; 512 515 } 513 516 514 return dbgfR3RegRegisterCommon(pVM, paRegisters, DBGFREGSETTYPE_CPU, pVCpu, fGuestRegs ? "cpu" : "hypercpu", pVCpu->idCpu); 517 return dbgfR3RegRegisterCommon(pUVM, paRegisters, DBGFREGSETTYPE_CPU, pVCpu, 518 fGuestRegs ? "cpu" : "hypercpu", pVCpu->idCpu); 515 519 } 516 520 … … 525 529 * the standard name. 526 530 */ 527 VMMR3 DECL(int) DBGFR3RegRegisterDevice(PVM pVM, PCDBGFREGDESC paRegisters, PPDMDEVINS pDevIns, const char *pszPrefix, uint32_t iInstance)528 { 529 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 531 VMMR3_INT_DECL(int) DBGFR3RegRegisterDevice(PVM pVM, PCDBGFREGDESC paRegisters, PPDMDEVINS pDevIns, const char *pszPrefix, 532 uint32_t iInstance) 533 { 530 534 AssertPtrReturn(paRegisters, VERR_INVALID_POINTER); 531 535 AssertPtrReturn(pDevIns, VERR_INVALID_POINTER); 532 536 AssertPtrReturn(pszPrefix, VERR_INVALID_POINTER); 533 537 534 return dbgfR3RegRegisterCommon(pVM , paRegisters, DBGFREGSETTYPE_DEVICE, pDevIns, pszPrefix, iInstance);538 return dbgfR3RegRegisterCommon(pVM->pUVM, paRegisters, DBGFREGSETTYPE_DEVICE, pDevIns, pszPrefix, iInstance); 535 539 } 536 540 … … 782 786 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 783 787 * 784 * @param p VM Pointer to the VM.788 * @param pUVM The user mode VM handle. 785 789 * @param idCpu The virtual CPU ID. 786 790 * @param enmReg The register to query. … … 790 794 * @param pValue Where to return the register value. 791 795 */ 792 static DECLCALLBACK(int) dbgfR3RegCpuQueryWorkerOnCpu(P VM pVM, VMCPUID idCpu, DBGFREG enmReg, DBGFREGVALTYPE enmType,796 static DECLCALLBACK(int) dbgfR3RegCpuQueryWorkerOnCpu(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, DBGFREGVALTYPE enmType, 793 797 bool fGuestRegs, PDBGFREGVAL pValue) 794 798 { 795 799 int rc = VINF_SUCCESS; 796 DBGF_REG_DB_LOCK_READ(p VM);800 DBGF_REG_DB_LOCK_READ(pUVM); 797 801 798 802 /* … … 800 804 */ 801 805 PDBGFREGSET pSet = fGuestRegs 802 ? p VM->aCpus[idCpu].dbgf.s.pGuestRegSet803 : p VM->aCpus[idCpu].dbgf.s.pHyperRegSet;806 ? pUVM->aCpus[idCpu].dbgf.s.pGuestRegSet 807 : pUVM->aCpus[idCpu].dbgf.s.pHyperRegSet; 804 808 if (RT_LIKELY(pSet)) 805 809 { … … 831 835 rc = VERR_INVALID_CPU_ID; 832 836 833 DBGF_REG_DB_UNLOCK_READ(p VM);837 DBGF_REG_DB_UNLOCK_READ(pUVM); 834 838 return rc; 835 839 } … … 848 852 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 849 853 * 850 * @param p VM Pointer to the VM.854 * @param pUVM The user mode VM handle. 851 855 * @param idCpu The virtual CPU ID. Can be OR'ed with 852 856 * DBGFREG_HYPER_VMCPUID. … … 855 859 * @param pValue Where to return the register value. 856 860 */ 857 static int dbgfR3RegCpuQueryWorker(PVM pVM, VMCPUID idCpu, DBGFREG enmReg, DBGFREGVALTYPE enmType, PDBGFREGVAL pValue) 858 { 859 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 861 static int dbgfR3RegCpuQueryWorker(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, DBGFREGVALTYPE enmType, PDBGFREGVAL pValue) 862 { 863 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 864 VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE); 860 865 AssertMsgReturn(enmReg >= DBGFREG_AL && enmReg <= DBGFREG_END, ("%d\n", enmReg), VERR_INVALID_PARAMETER); 861 866 862 867 bool const fGuestRegs = !(idCpu & DBGFREG_HYPER_VMCPUID); 863 868 idCpu &= ~DBGFREG_HYPER_VMCPUID; 864 AssertReturn(idCpu < p VM->cCpus, VERR_INVALID_CPU_ID);865 866 return VMR3ReqPriorityCallWait (pVM, idCpu, (PFNRT)dbgfR3RegCpuQueryWorkerOnCpu, 6,867 pVM, idCpu, enmReg, enmType, fGuestRegs, pValue);869 AssertReturn(idCpu < pUVM->cCpus, VERR_INVALID_CPU_ID); 870 871 return VMR3ReqPriorityCallWaitU(pUVM, idCpu, (PFNRT)dbgfR3RegCpuQueryWorkerOnCpu, 6, 872 pUVM, idCpu, enmReg, enmType, fGuestRegs, pValue); 868 873 } 869 874 … … 879 884 * @retval VINF_DBGF_TRUNCATED_REGISTER 880 885 * 881 * @param p VM Pointer to the VM.886 * @param pUVM The user mode VM handle. 882 887 * @param idCpu The target CPU ID. Can be OR'ed with 883 888 * DBGFREG_HYPER_VMCPUID. … … 885 890 * @param pu8 Where to store the register value. 886 891 */ 887 VMMR3DECL(int) DBGFR3RegCpuQueryU8(P VM pVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8)892 VMMR3DECL(int) DBGFR3RegCpuQueryU8(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8) 888 893 { 889 894 DBGFREGVAL Value; 890 int rc = dbgfR3RegCpuQueryWorker(p VM, idCpu, enmReg, DBGFREGVALTYPE_U8, &Value);895 int rc = dbgfR3RegCpuQueryWorker(pUVM, idCpu, enmReg, DBGFREGVALTYPE_U8, &Value); 891 896 if (RT_SUCCESS(rc)) 892 897 *pu8 = Value.u8; … … 908 913 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 909 914 * 910 * @param p VM Pointer to the VM.915 * @param pUVM The user mode VM handle. 911 916 * @param idCpu The target CPU ID. Can be OR'ed with 912 917 * DBGFREG_HYPER_VMCPUID. … … 914 919 * @param pu16 Where to store the register value. 915 920 */ 916 VMMR3DECL(int) DBGFR3RegCpuQueryU16(P VM pVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16)921 VMMR3DECL(int) DBGFR3RegCpuQueryU16(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16) 917 922 { 918 923 DBGFREGVAL Value; 919 int rc = dbgfR3RegCpuQueryWorker(p VM, idCpu, enmReg, DBGFREGVALTYPE_U16, &Value);924 int rc = dbgfR3RegCpuQueryWorker(pUVM, idCpu, enmReg, DBGFREGVALTYPE_U16, &Value); 920 925 if (RT_SUCCESS(rc)) 921 926 *pu16 = Value.u16; … … 937 942 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 938 943 * 939 * @param p VM Pointer to the VM.944 * @param pUVM The user mode VM handle. 940 945 * @param idCpu The target CPU ID. Can be OR'ed with 941 946 * DBGFREG_HYPER_VMCPUID. … … 943 948 * @param pu32 Where to store the register value. 944 949 */ 945 VMMR3DECL(int) DBGFR3RegCpuQueryU32(P VM pVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32)950 VMMR3DECL(int) DBGFR3RegCpuQueryU32(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32) 946 951 { 947 952 DBGFREGVAL Value; 948 int rc = dbgfR3RegCpuQueryWorker(p VM, idCpu, enmReg, DBGFREGVALTYPE_U32, &Value);953 int rc = dbgfR3RegCpuQueryWorker(pUVM, idCpu, enmReg, DBGFREGVALTYPE_U32, &Value); 949 954 if (RT_SUCCESS(rc)) 950 955 *pu32 = Value.u32; … … 966 971 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 967 972 * 968 * @param p VM Pointer to the VM.973 * @param pUVM The user mode VM handle. 969 974 * @param idCpu The target CPU ID. Can be OR'ed with 970 975 * DBGFREG_HYPER_VMCPUID. … … 972 977 * @param pu64 Where to store the register value. 973 978 */ 974 VMMR3DECL(int) DBGFR3RegCpuQueryU64(P VM pVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64)979 VMMR3DECL(int) DBGFR3RegCpuQueryU64(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64) 975 980 { 976 981 DBGFREGVAL Value; 977 int rc = dbgfR3RegCpuQueryWorker(p VM, idCpu, enmReg, DBGFREGVALTYPE_U64, &Value);982 int rc = dbgfR3RegCpuQueryWorker(pUVM, idCpu, enmReg, DBGFREGVALTYPE_U64, &Value); 978 983 if (RT_SUCCESS(rc)) 979 984 *pu64 = Value.u64; … … 1008 1013 1009 1014 1010 static DECLCALLBACK(int) dbgfR3RegCpuQueryBatchWorker(P VM pVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs)1015 static DECLCALLBACK(int) dbgfR3RegCpuQueryBatchWorker(PUVM pUVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs) 1011 1016 { 1012 1017 #if 0 1013 PVMCPU pVCpu = &p VM->aCpus[idCpu];1018 PVMCPU pVCpu = &pUVM->pVM->aCpus[idCpu]; 1014 1019 PCCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 1015 1020 … … 1071 1076 * @retval VERR_DBGF_REGISTER_NOT_FOUND 1072 1077 * 1073 * @param p VM Pointer to the VM.1078 * @param pUVM The user mode VM handle. 1074 1079 * @param idCpu The target CPU ID. Can be OR'ed with 1075 1080 * DBGFREG_HYPER_VMCPUID. … … 1081 1086 * @param cRegs The number of entries in @a paRegs. 1082 1087 */ 1083 VMMR3DECL(int) DBGFR3RegCpuQueryBatch(PVM pVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs) 1084 { 1085 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1086 AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID); 1088 VMMR3DECL(int) DBGFR3RegCpuQueryBatch(PUVM pUVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs) 1089 { 1090 UVM_ASSERT_VALID_EXT_RETURN(pUVM, NULL); 1091 VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, NULL); 1092 AssertReturn(idCpu < pUVM->cCpus, VERR_INVALID_CPU_ID); 1087 1093 if (!cRegs) 1088 1094 return VINF_SUCCESS; … … 1096 1102 } 1097 1103 1098 return VMR3ReqCallWait (pVM, idCpu, (PFNRT)dbgfR3RegCpuQueryBatchWorker, 4, pVM, idCpu, paRegs, cRegs);1104 return VMR3ReqCallWaitU(pUVM, idCpu, (PFNRT)dbgfR3RegCpuQueryBatchWorker, 4, pUVM, idCpu, paRegs, cRegs); 1099 1105 } 1100 1106 … … 1107 1113 * @retval VERR_INVALID_CPU_ID 1108 1114 * 1109 * @param p VM Pointer to the VM.1115 * @param pUVM The user mode VM handle. 1110 1116 * @param idCpu The target CPU ID. Can be OR'ed with 1111 1117 * DBGFREG_HYPER_VMCPUID. … … 1118 1124 * recommended value is DBGFREG_ALL_COUNT. 1119 1125 */ 1120 VMMR3DECL(int) DBGFR3RegCpuQueryAll(P VM pVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs)1126 VMMR3DECL(int) DBGFR3RegCpuQueryAll(PUVM pUVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs) 1121 1127 { 1122 1128 /* 1123 1129 * Validate input. 1124 1130 */ 1125 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1126 AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID); 1131 UVM_ASSERT_VALID_EXT_RETURN(pUVM, NULL); 1132 VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, NULL); 1133 AssertReturn(idCpu < pUVM->cCpus, VERR_INVALID_CPU_ID); 1127 1134 if (!cRegs) 1128 1135 return VINF_SUCCESS; … … 1142 1149 paRegs[iReg++].enmReg = DBGFREG_END; 1143 1150 1144 return VMR3ReqCallWait (pVM, idCpu, (PFNRT)dbgfR3RegCpuQueryBatchWorker, 4, pVM, idCpu, paRegs, cRegs);1151 return VMR3ReqCallWaitU(pUVM, idCpu, (PFNRT)dbgfR3RegCpuQueryBatchWorker, 4, pUVM, idCpu, paRegs, cRegs); 1145 1152 } 1146 1153 … … 1153 1160 * parameters are invalid. 1154 1161 * 1155 * @param p VM Pointer to the VM.1162 * @param pUVM The user mode VM handle. 1156 1163 * @param enmReg The register identifier. 1157 1164 * @param enmType The register type. This is for sort out … … 1159 1166 * the standard name. 1160 1167 */ 1161 VMMR3DECL(const char *) DBGFR3RegCpuName(P VM pVM, DBGFREG enmReg, DBGFREGVALTYPE enmType)1168 VMMR3DECL(const char *) DBGFR3RegCpuName(PUVM pUVM, DBGFREG enmReg, DBGFREGVALTYPE enmType) 1162 1169 { 1163 1170 AssertReturn(enmReg >= DBGFREG_AL && enmReg < DBGFREG_END, NULL); 1164 1171 AssertReturn(enmType >= DBGFREGVALTYPE_INVALID && enmType < DBGFREGVALTYPE_END, NULL); 1165 VM_ASSERT_VALID_EXT_RETURN(pVM, NULL); 1166 1167 PCDBGFREGSET pSet = pVM->aCpus[0].dbgf.s.pGuestRegSet; 1172 UVM_ASSERT_VALID_EXT_RETURN(pUVM, NULL); 1173 VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, NULL); 1174 1175 PCDBGFREGSET pSet = pUVM->aCpus[0].dbgf.s.pGuestRegSet; 1168 1176 if (RT_UNLIKELY(!pSet)) 1169 1177 return NULL; … … 1221 1229 * 1222 1230 * @returns Lookup record. 1223 * @param p VM Pointer to the VM.1231 * @param pUVM The user mode VM handle. 1224 1232 * @param idDefCpu The default CPU ID set. 1225 1233 * @param pszReg The register name. … … 1227 1235 * hypervisor CPU registers if clear. 1228 1236 */ 1229 static PCDBGFREGLOOKUP dbgfR3RegResolve(P VM pVM, VMCPUID idDefCpu, const char *pszReg, bool fGuestRegs)1230 { 1231 DBGF_REG_DB_LOCK_READ(p VM);1237 static PCDBGFREGLOOKUP dbgfR3RegResolve(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, bool fGuestRegs) 1238 { 1239 DBGF_REG_DB_LOCK_READ(pUVM); 1232 1240 1233 1241 /* Try looking up the name without any case folding or cpu prefixing. */ 1234 PCDBGFREGLOOKUP pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet(&pVM->dbgf.s.RegSpace, pszReg); 1242 PRTSTRSPACE pRegSpace = &pUVM->dbgf.s.RegSpace; 1243 PCDBGFREGLOOKUP pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet(pRegSpace, pszReg); 1235 1244 if (!pLookupRec) 1236 1245 { … … 1240 1249 ssize_t cchFolded = dbgfR3RegCopyToLower(pszReg, RTSTR_MAX, szName, sizeof(szName) - DBGF_REG_MAX_NAME); 1241 1250 if (cchFolded > 0) 1242 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet( &pVM->dbgf.s.RegSpace, szName);1251 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet(pRegSpace, szName); 1243 1252 if ( !pLookupRec 1244 1253 && cchFolded >= 0 … … 1248 1257 size_t cchCpuSet = RTStrPrintf(szName, sizeof(szName), fGuestRegs ? "cpu%u." : "hypercpu%u.", idDefCpu); 1249 1258 dbgfR3RegCopyToLower(pszReg, RTSTR_MAX, &szName[cchCpuSet], sizeof(szName) - cchCpuSet); 1250 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet( &pVM->dbgf.s.RegSpace, szName);1259 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet(pRegSpace, szName); 1251 1260 } 1252 1261 } 1253 1262 1254 DBGF_REG_DB_UNLOCK_READ(p VM);1263 DBGF_REG_DB_UNLOCK_READ(pUVM); 1255 1264 return pLookupRec; 1256 1265 } … … 1264 1273 * @retval VERR_DBGF_REGISTER_NOT_FOUND if not found. 1265 1274 * 1266 * @param p VM Pointer to the VM.1275 * @param pUVM The user mode VM handle. 1267 1276 * @param idDefCpu The default CPU. 1268 1277 * @param pszReg The registe name. 1269 1278 */ 1270 VMMR3DECL(int) DBGFR3RegNmValidate(P VM pVM, VMCPUID idDefCpu, const char *pszReg)1279 VMMR3DECL(int) DBGFR3RegNmValidate(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg) 1271 1280 { 1272 1281 /* 1273 1282 * Validate input. 1274 1283 */ 1275 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1276 AssertReturn((idDefCpu & ~DBGFREG_HYPER_VMCPUID) < pVM->cCpus || idDefCpu == VMCPUID_ANY, VERR_INVALID_CPU_ID); 1284 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1285 VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE); 1286 AssertReturn((idDefCpu & ~DBGFREG_HYPER_VMCPUID) < pUVM->cCpus || idDefCpu == VMCPUID_ANY, VERR_INVALID_CPU_ID); 1277 1287 AssertPtrReturn(pszReg, VERR_INVALID_POINTER); 1278 1288 … … 1281 1291 */ 1282 1292 bool const fGuestRegs = !(idDefCpu & DBGFREG_HYPER_VMCPUID) && idDefCpu != VMCPUID_ANY; 1283 PCDBGFREGLOOKUP pLookupRec = dbgfR3RegResolve(p VM, idDefCpu, pszReg, fGuestRegs);1293 PCDBGFREGLOOKUP pLookupRec = dbgfR3RegResolve(pUVM, idDefCpu, pszReg, fGuestRegs); 1284 1294 if (!pLookupRec) 1285 1295 return VERR_DBGF_REGISTER_NOT_FOUND; … … 1294 1304 * @returns VBox status code. 1295 1305 * 1296 * @param p VM Pointer to the VM.1306 * @param pUVM The user mode VM handle. 1297 1307 * @param pLookupRec The register lookup record. 1298 1308 * @param enmType The desired return type. … … 1301 1311 * Optional. 1302 1312 */ 1303 static DECLCALLBACK(int) dbgfR3RegNmQueryWorkerOnCpu(P VM pVM, PCDBGFREGLOOKUP pLookupRec, DBGFREGVALTYPE enmType,1313 static DECLCALLBACK(int) dbgfR3RegNmQueryWorkerOnCpu(PUVM pUVM, PCDBGFREGLOOKUP pLookupRec, DBGFREGVALTYPE enmType, 1304 1314 PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType) 1305 1315 { … … 1310 1320 int rc; 1311 1321 1312 NOREF(p VM);1322 NOREF(pUVM); 1313 1323 1314 1324 /* … … 1409 1419 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 1410 1420 * 1411 * @param p VM Pointer to the VM.1421 * @param pUVM The user mode VM handle. 1412 1422 * @param idDefCpu The virtual CPU ID for the default CPU register 1413 1423 * set. Can be OR'ed with DBGFREG_HYPER_VMCPUID. … … 1418 1428 * Optional. 1419 1429 */ 1420 static int dbgfR3RegNmQueryWorker(P VM pVM, VMCPUID idDefCpu, const char *pszReg, DBGFREGVALTYPE enmType,1430 static int dbgfR3RegNmQueryWorker(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, DBGFREGVALTYPE enmType, 1421 1431 PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType) 1422 1432 { … … 1424 1434 * Validate input. 1425 1435 */ 1426 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1427 AssertReturn((idDefCpu & ~DBGFREG_HYPER_VMCPUID) < pVM->cCpus || idDefCpu == VMCPUID_ANY, VERR_INVALID_CPU_ID); 1436 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1437 VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE); 1438 AssertReturn((idDefCpu & ~DBGFREG_HYPER_VMCPUID) < pUVM->cCpus || idDefCpu == VMCPUID_ANY, VERR_INVALID_CPU_ID); 1428 1439 AssertPtrReturn(pszReg, VERR_INVALID_POINTER); 1429 1440 … … 1435 1446 */ 1436 1447 bool const fGuestRegs = !(idDefCpu & DBGFREG_HYPER_VMCPUID) && idDefCpu != VMCPUID_ANY; 1437 PCDBGFREGLOOKUP pLookupRec = dbgfR3RegResolve(p VM, idDefCpu, pszReg, fGuestRegs);1448 PCDBGFREGLOOKUP pLookupRec = dbgfR3RegResolve(pUVM, idDefCpu, pszReg, fGuestRegs); 1438 1449 if (pLookupRec) 1439 1450 { … … 1442 1453 else if (idDefCpu != VMCPUID_ANY) 1443 1454 idDefCpu &= ~DBGFREG_HYPER_VMCPUID; 1444 return VMR3ReqPriorityCallWait(pVM, idDefCpu, (PFNRT)dbgfR3RegNmQueryWorkerOnCpu, 5, pVM, pLookupRec, enmType, pValue, penmType); 1455 return VMR3ReqPriorityCallWaitU(pUVM, idDefCpu, (PFNRT)dbgfR3RegNmQueryWorkerOnCpu, 5, 1456 pUVM, pLookupRec, enmType, pValue, penmType); 1445 1457 } 1446 1458 return VERR_DBGF_REGISTER_NOT_FOUND; … … 1456 1468 * @retval VERR_DBGF_REGISTER_NOT_FOUND 1457 1469 * 1458 * @param p VM Pointer to the VM.1470 * @param pUVM The user mode VM handle. 1459 1471 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1460 1472 * applicable. Can be OR'ed with … … 1466 1478 * @param penmType Where to store the register value type. 1467 1479 */ 1468 VMMR3DECL(int) DBGFR3RegNmQuery(P VM pVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType)1469 { 1470 return dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_END, pValue, penmType);1480 VMMR3DECL(int) DBGFR3RegNmQuery(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType) 1481 { 1482 return dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_END, pValue, penmType); 1471 1483 } 1472 1484 … … 1482 1494 * @retval VINF_DBGF_TRUNCATED_REGISTER 1483 1495 * 1484 * @param p VM Pointer to the VM.1496 * @param pUVM The user mode VM handle. 1485 1497 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1486 1498 * applicable. Can be OR'ed with … … 1491 1503 * @param pu8 Where to store the register value. 1492 1504 */ 1493 VMMR3DECL(int) DBGFR3RegNmQueryU8(P VM pVM, VMCPUID idDefCpu, const char *pszReg, uint8_t *pu8)1505 VMMR3DECL(int) DBGFR3RegNmQueryU8(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint8_t *pu8) 1494 1506 { 1495 1507 DBGFREGVAL Value; 1496 int rc = dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_U8, &Value, NULL);1508 int rc = dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_U8, &Value, NULL); 1497 1509 if (RT_SUCCESS(rc)) 1498 1510 *pu8 = Value.u8; … … 1514 1526 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 1515 1527 * 1516 * @param p VM Pointer to the VM.1528 * @param pUVM The user mode VM handle. 1517 1529 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1518 1530 * applicable. Can be OR'ed with … … 1523 1535 * @param pu16 Where to store the register value. 1524 1536 */ 1525 VMMR3DECL(int) DBGFR3RegNmQueryU16(P VM pVM, VMCPUID idDefCpu, const char *pszReg, uint16_t *pu16)1537 VMMR3DECL(int) DBGFR3RegNmQueryU16(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint16_t *pu16) 1526 1538 { 1527 1539 DBGFREGVAL Value; 1528 int rc = dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_U16, &Value, NULL);1540 int rc = dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_U16, &Value, NULL); 1529 1541 if (RT_SUCCESS(rc)) 1530 1542 *pu16 = Value.u16; … … 1546 1558 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 1547 1559 * 1548 * @param p VM Pointer to the VM.1560 * @param pUVM The user mode VM handle. 1549 1561 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1550 1562 * applicable. Can be OR'ed with … … 1555 1567 * @param pu32 Where to store the register value. 1556 1568 */ 1557 VMMR3DECL(int) DBGFR3RegNmQueryU32(P VM pVM, VMCPUID idDefCpu, const char *pszReg, uint32_t *pu32)1569 VMMR3DECL(int) DBGFR3RegNmQueryU32(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint32_t *pu32) 1558 1570 { 1559 1571 DBGFREGVAL Value; 1560 int rc = dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_U32, &Value, NULL);1572 int rc = dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_U32, &Value, NULL); 1561 1573 if (RT_SUCCESS(rc)) 1562 1574 *pu32 = Value.u32; … … 1578 1590 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 1579 1591 * 1580 * @param p VM Pointer to the VM.1592 * @param pUVM The user mode VM handle. 1581 1593 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1582 1594 * applicable. Can be OR'ed with … … 1587 1599 * @param pu64 Where to store the register value. 1588 1600 */ 1589 VMMR3DECL(int) DBGFR3RegNmQueryU64(P VM pVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64)1601 VMMR3DECL(int) DBGFR3RegNmQueryU64(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64) 1590 1602 { 1591 1603 DBGFREGVAL Value; 1592 int rc = dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_U64, &Value, NULL);1604 int rc = dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_U64, &Value, NULL); 1593 1605 if (RT_SUCCESS(rc)) 1594 1606 *pu64 = Value.u64; … … 1610 1622 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 1611 1623 * 1612 * @param p VM Pointer to the VM.1624 * @param pUVM The user mode VM handle. 1613 1625 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1614 1626 * applicable. Can be OR'ed with … … 1619 1631 * @param pu128 Where to store the register value. 1620 1632 */ 1621 VMMR3DECL(int) DBGFR3RegNmQueryU128(P VM pVM, VMCPUID idDefCpu, const char *pszReg, PRTUINT128U pu128)1633 VMMR3DECL(int) DBGFR3RegNmQueryU128(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PRTUINT128U pu128) 1622 1634 { 1623 1635 DBGFREGVAL Value; 1624 int rc = dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_U128, &Value, NULL);1636 int rc = dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_U128, &Value, NULL); 1625 1637 if (RT_SUCCESS(rc)) 1626 1638 *pu128 = Value.u128; … … 1643 1655 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 1644 1656 * 1645 * @param p VM Pointer to the VM.1657 * @param pUVM The user mode VM handle. 1646 1658 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1647 1659 * applicable. Can be OR'ed with … … 1652 1664 * @param plrd Where to store the register value. 1653 1665 */ 1654 VMMR3DECL(int) DBGFR3RegNmQueryLrd(P VM pVM, VMCPUID idDefCpu, const char *pszReg, long double *plrd)1666 VMMR3DECL(int) DBGFR3RegNmQueryLrd(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, long double *plrd) 1655 1667 { 1656 1668 DBGFREGVAL Value; 1657 int rc = dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_R80, &Value, NULL);1669 int rc = dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_R80, &Value, NULL); 1658 1670 if (RT_SUCCESS(rc)) 1659 1671 *plrd = Value.lrd; … … 1676 1688 * @retval VINF_DBGF_ZERO_EXTENDED_REGISTER 1677 1689 * 1678 * @param p VM Pointer to the VM.1690 * @param pUVM The user mode VM handle. 1679 1691 * @param idDefCpu The default target CPU ID, VMCPUID_ANY if not 1680 1692 * applicable. Can be OR'ed with … … 1686 1698 * @param pu32Limit Where to store the register limit value. 1687 1699 */ 1688 VMMR3DECL(int) DBGFR3RegNmQueryXdtr(P VM pVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64Base, uint32_t *pu32Limit)1700 VMMR3DECL(int) DBGFR3RegNmQueryXdtr(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64Base, uint32_t *pu32Limit) 1689 1701 { 1690 1702 DBGFREGVAL Value; 1691 int rc = dbgfR3RegNmQueryWorker(p VM, idDefCpu, pszReg, DBGFREGVALTYPE_DTR, &Value, NULL);1703 int rc = dbgfR3RegNmQueryWorker(pUVM, idDefCpu, pszReg, DBGFREGVALTYPE_DTR, &Value, NULL); 1692 1704 if (RT_SUCCESS(rc)) 1693 1705 { … … 1704 1716 1705 1717 1706 /// @todo VMMR3DECL(int) DBGFR3RegNmQueryBatch(P VM pVM,VMCPUID idDefCpu, DBGFREGENTRYNM paRegs, size_t cRegs);1718 /// @todo VMMR3DECL(int) DBGFR3RegNmQueryBatch(PUVM pUVM,VMCPUID idDefCpu, DBGFREGENTRYNM paRegs, size_t cRegs); 1707 1719 1708 1720 … … 1711 1723 * 1712 1724 * @returns VBox status code. 1713 * @param p VM Pointer to the VM.1725 * @param pUVM The user mode VM handle. 1714 1726 * @param pcRegs Where to return the register count. 1715 1727 */ 1716 VMMR3DECL(int) DBGFR3RegNmQueryAllCount(P VM pVM, size_t *pcRegs)1717 { 1718 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);1719 *pcRegs = p VM->dbgf.s.cRegs;1728 VMMR3DECL(int) DBGFR3RegNmQueryAllCount(PUVM pUVM, size_t *pcRegs) 1729 { 1730 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1731 *pcRegs = pUVM->dbgf.s.cRegs; 1720 1732 return VINF_SUCCESS; 1721 1733 } … … 1803 1815 PDBGFREGENTRYNM paRegs = pArgs->paRegs; 1804 1816 size_t const cRegs = pArgs->cRegs; 1805 1806 DBGF_REG_DB_LOCK_READ(pVM); 1817 PUVM pUVM = pVM->pUVM; 1818 PUVMCPU pUVCpu = pVCpu->pUVCpu; 1819 1820 DBGF_REG_DB_LOCK_READ(pUVM); 1807 1821 1808 1822 /* … … 1810 1824 */ 1811 1825 size_t iCpuReg = pVCpu->idCpu * DBGFREG_ALL_COUNT; 1812 if (p VCpu->dbgf.s.pGuestRegSet)1826 if (pUVCpu->dbgf.s.pGuestRegSet) 1813 1827 { 1814 1828 if (iCpuReg < cRegs) 1815 dbgfR3RegNmQueryAllInSet(p VCpu->dbgf.s.pGuestRegSet, DBGFREG_ALL_COUNT, &paRegs[iCpuReg], cRegs - iCpuReg);1829 dbgfR3RegNmQueryAllInSet(pUVCpu->dbgf.s.pGuestRegSet, DBGFREG_ALL_COUNT, &paRegs[iCpuReg], cRegs - iCpuReg); 1816 1830 } 1817 1831 else … … 1821 1835 * My hypervisor CPU registers. 1822 1836 */ 1823 iCpuReg = p VM->cCpus * DBGFREG_ALL_COUNT + pVCpu->idCpu * DBGFREG_ALL_COUNT;1824 if (p VCpu->dbgf.s.pHyperRegSet)1837 iCpuReg = pUVM->cCpus * DBGFREG_ALL_COUNT + pUVCpu->idCpu * DBGFREG_ALL_COUNT; 1838 if (pUVCpu->dbgf.s.pHyperRegSet) 1825 1839 { 1826 1840 if (iCpuReg < cRegs) 1827 dbgfR3RegNmQueryAllInSet(p VCpu->dbgf.s.pHyperRegSet, DBGFREG_ALL_COUNT, &paRegs[iCpuReg], cRegs - iCpuReg);1841 dbgfR3RegNmQueryAllInSet(pUVCpu->dbgf.s.pHyperRegSet, DBGFREG_ALL_COUNT, &paRegs[iCpuReg], cRegs - iCpuReg); 1828 1842 } 1829 1843 else … … 1833 1847 * The primary CPU does all the other registers. 1834 1848 */ 1835 if (p VCpu->idCpu == 0)1836 { 1837 pArgs->iReg = p VM->cCpus * DBGFREG_ALL_COUNT * 2;1838 RTStrSpaceEnumerate(&p VM->dbgf.s.RegSetSpace, dbgfR3RegNmQueryAllEnum, pArgs);1849 if (pUVCpu->idCpu == 0) 1850 { 1851 pArgs->iReg = pUVM->cCpus * DBGFREG_ALL_COUNT * 2; 1852 RTStrSpaceEnumerate(&pUVM->dbgf.s.RegSetSpace, dbgfR3RegNmQueryAllEnum, pArgs); 1839 1853 dbgfR3RegNmQueryAllPadEntries(paRegs, cRegs, pArgs->iReg, cRegs); 1840 1854 } 1841 1855 1842 DBGF_REG_DB_UNLOCK_READ(p VM);1856 DBGF_REG_DB_UNLOCK_READ(pUVM); 1843 1857 return VINF_SUCCESS; /* Ignore errors. */ 1844 1858 } … … 1849 1863 * 1850 1864 * @returns VBox status code. 1851 * @param p VM Pointer to the VM.1865 * @param pUVM The user mode VM handle. 1852 1866 * @param paRegs The output register value array. The register 1853 1867 * name string is read only and shall not be freed … … 1857 1871 * DBGFR3RegNmQueryAllCount. 1858 1872 */ 1859 VMMR3DECL(int) DBGFR3RegNmQueryAll(PVM pVM, PDBGFREGENTRYNM paRegs, size_t cRegs) 1860 { 1873 VMMR3DECL(int) DBGFR3RegNmQueryAll(PUVM pUVM, PDBGFREGENTRYNM paRegs, size_t cRegs) 1874 { 1875 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 1876 PVM pVM = pUVM->pVM; 1861 1877 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1862 1878 AssertPtrReturn(paRegs, VERR_INVALID_POINTER); … … 1871 1887 1872 1888 1873 VMMR3DECL(int) DBGFR3RegNmSet(P VM pVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType)1874 { 1875 NOREF(p VM); NOREF(idDefCpu); NOREF(pszReg); NOREF(pValue); NOREF(enmType);1889 VMMR3DECL(int) DBGFR3RegNmSet(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType) 1890 { 1891 NOREF(pUVM); NOREF(idDefCpu); NOREF(pszReg); NOREF(pValue); NOREF(enmType); 1876 1892 return VERR_NOT_IMPLEMENTED; 1877 1893 } … … 1923 1939 1924 1940 1925 1926 1941 /** 1927 1942 * Format a register value, extended version. … … 1939 1954 * @param fFlags String formatting flags, RTSTR_F_XXX. 1940 1955 */ 1941 VMM DECL(ssize_t) DBGFR3RegFormatValueEx(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType,1942 unsigned uBase, signed int cchWidth, signed int cchPrecision, uint32_t fFlags)1956 VMMR3DECL(ssize_t) DBGFR3RegFormatValueEx(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, 1957 unsigned uBase, signed int cchWidth, signed int cchPrecision, uint32_t fFlags) 1943 1958 { 1944 1959 /* … … 1976 1991 * @param fSpecial Same as RTSTR_F_SPECIAL. 1977 1992 */ 1978 VMM DECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial)1993 VMMR3DECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial) 1979 1994 { 1980 1995 int cchWidth = 0; … … 2021 2036 DBGFREGVAL Value; 2022 2037 DBGFREGVALTYPE enmType; 2023 int rc = dbgfR3RegNmQueryWorkerOnCpu(pThis->p VM, pLookupRec, DBGFREGVALTYPE_END, &Value, &enmType);2038 int rc = dbgfR3RegNmQueryWorkerOnCpu(pThis->pUVM, pLookupRec, DBGFREGVALTYPE_END, &Value, &enmType); 2024 2039 if (RT_FAILURE(rc)) 2025 2040 { … … 2114 2129 DBGFREGVAL Value; 2115 2130 DBGFREGVALTYPE enmType; 2116 int rc = dbgfR3RegNmQueryWorkerOnCpu(pThis->p VM, pLookupRec, DBGFREGVALTYPE_END, &Value, &enmType);2131 int rc = dbgfR3RegNmQueryWorkerOnCpu(pThis->pUVM, pLookupRec, DBGFREGVALTYPE_END, &Value, &enmType); 2117 2132 if (RT_FAILURE(rc)) 2118 2133 { … … 2177 2192 * input string termination. 2178 2193 */ 2194 PRTSTRSPACE pRegSpace = &pThis->pUVM->dbgf.s.RegSpace; 2179 2195 /* Try looking up the name without any case folding or cpu prefixing. */ 2180 PCDBGFREGLOOKUP pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGetN( &pThis->pVM->dbgf.s.RegSpace, pachReg, cchReg);2196 PCDBGFREGLOOKUP pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGetN(pRegSpace, pachReg, cchReg); 2181 2197 if (!pLookupRec) 2182 2198 { … … 2185 2201 ssize_t cchFolded = dbgfR3RegCopyToLower(pachReg, cchReg, szName, sizeof(szName) - DBGF_REG_MAX_NAME); 2186 2202 if (cchFolded > 0) 2187 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet( &pThis->pVM->dbgf.s.RegSpace, szName);2203 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet(pRegSpace, szName); 2188 2204 if ( !pLookupRec 2189 2205 && cchFolded >= 0 … … 2193 2209 size_t cchCpuSet = RTStrPrintf(szName, sizeof(szName), pThis->fGuestRegs ? "cpu%u." : "hypercpu%u.", pThis->idCpu); 2194 2210 dbgfR3RegCopyToLower(pachReg, cchReg, &szName[cchCpuSet], sizeof(szName) - cchCpuSet); 2195 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet( &pThis->pVM->dbgf.s.RegSpace, szName);2211 pLookupRec = (PCDBGFREGLOOKUP)RTStrSpaceGet(pRegSpace, szName); 2196 2212 } 2197 2213 } … … 2270 2286 static DECLCALLBACK(int) dbgfR3RegPrintfWorkerOnCpu(PDBGFR3REGPRINTFARGS pArgs) 2271 2287 { 2272 DBGF_REG_DB_LOCK_READ(pArgs->p VM);2288 DBGF_REG_DB_LOCK_READ(pArgs->pUVM); 2273 2289 RTStrFormatV(dbgfR3RegPrintfCbOutput, pArgs, dbgfR3RegPrintfCbFormat, pArgs, pArgs->pszFormat, pArgs->va); 2274 DBGF_REG_DB_UNLOCK_READ(pArgs->p VM);2290 DBGF_REG_DB_UNLOCK_READ(pArgs->pUVM); 2275 2291 return pArgs->rc; 2276 2292 } … … 2283 2299 * 2284 2300 * @returns VBox status code. 2285 * @param p VM Pointer to the VM.2301 * @param pUVM The user mode VM handle. 2286 2302 * @param idCpu The CPU ID of any CPU registers that may be 2287 2303 * printed, pass VMCPUID_ANY if not applicable. … … 2292 2308 * @param va Other format arguments. 2293 2309 */ 2294 VMMR3DECL(int) DBGFR3RegPrintfV(P VM pVM, VMCPUID idCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, va_list va)2310 VMMR3DECL(int) DBGFR3RegPrintfV(PUVM pUVM, VMCPUID idCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, va_list va) 2295 2311 { 2296 2312 AssertPtrReturn(pszBuf, VERR_INVALID_POINTER); … … 2298 2314 *pszBuf = '\0'; 2299 2315 2300 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);2301 AssertReturn((idCpu & ~DBGFREG_HYPER_VMCPUID) < p VM->cCpus || idCpu == VMCPUID_ANY, VERR_INVALID_CPU_ID);2316 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 2317 AssertReturn((idCpu & ~DBGFREG_HYPER_VMCPUID) < pUVM->cCpus || idCpu == VMCPUID_ANY, VERR_INVALID_CPU_ID); 2302 2318 AssertPtrReturn(pszFormat, VERR_INVALID_POINTER); 2303 2319 … … 2307 2323 */ 2308 2324 DBGFR3REGPRINTFARGS Args; 2309 Args.p VM = pVM;2325 Args.pUVM = pUVM; 2310 2326 Args.idCpu = idCpu != VMCPUID_ANY ? idCpu & ~DBGFREG_HYPER_VMCPUID : idCpu; 2311 2327 Args.fGuestRegs = idCpu != VMCPUID_ANY && !(idCpu & DBGFREG_HYPER_VMCPUID); … … 2316 2332 Args.cchLeftBuf = cbBuf - 1; 2317 2333 Args.rc = VINF_SUCCESS; 2318 int rc = VMR3ReqPriorityCallWait (pVM, Args.idCpu, (PFNRT)dbgfR3RegPrintfWorkerOnCpu, 1, &Args);2334 int rc = VMR3ReqPriorityCallWaitU(pUVM, Args.idCpu, (PFNRT)dbgfR3RegPrintfWorkerOnCpu, 1, &Args); 2319 2335 va_end(Args.va); 2320 2336 return rc; … … 2328 2344 * 2329 2345 * @returns VBox status code. 2330 * @param p VM Pointer to the VM.2346 * @param pUVM The user mode VM handle. 2331 2347 * @param idCpu The CPU ID of any CPU registers that may be 2332 2348 * printed, pass VMCPUID_ANY if not applicable. … … 2340 2356 * @param ... Other format arguments. 2341 2357 */ 2342 VMMR3DECL(int) DBGFR3RegPrintf(P VM pVM, VMCPUID idCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...)2358 VMMR3DECL(int) DBGFR3RegPrintf(PUVM pUVM, VMCPUID idCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...) 2343 2359 { 2344 2360 va_list va; 2345 2361 va_start(va, pszFormat); 2346 int rc = DBGFR3RegPrintfV(p VM, idCpu, pszBuf, cbBuf, pszFormat, va);2362 int rc = DBGFR3RegPrintfV(pUVM, idCpu, pszBuf, cbBuf, pszFormat, va); 2347 2363 va_end(va); 2348 2364 return rc;
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器