Changeset 22108 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 9, 2009 12:42:45 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50859
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/DBGFAddrSpace.cpp
r21111 r22108 589 589 psz++; 590 590 591 /* Fin ethe end of this element. */591 /* Find the end of this element. */ 592 592 const char *pszNext; 593 593 const char *pszEnd = strchr(psz, ';'); -
trunk/src/VBox/VMM/DBGFOS.cpp
r19300 r22108 30 30 #include <VBox/vm.h> 31 31 #include <VBox/err.h> 32 33 32 #include <VBox/log.h> 33 34 #include <iprt/assert.h> 34 35 #include <iprt/thread.h> 35 #include <iprt/assert.h> 36 36 #include <iprt/param.h> 37 38 39 /******************************************************************************* 40 * Defined Constants And Macros * 41 *******************************************************************************/ 42 #define DBGF_OS_READ_LOCK(pVM) do { } while (0) 43 #define DBGF_OS_READ_UNLOCK(pVM) do { } while (0) 44 45 #define DBGF_OS_WRITE_LOCK(pVM) do { } while (0) 46 #define DBGF_OS_WRITE_UNLOCK(pVM) do { } while (0) 47 48 49 /** 50 * Internal cleanup routine called by DBGFR3Term(). 51 * 52 * @param pVM Pointer to the shared VM structure. 53 */ 54 void dbgfR3OSTerm(PVM pVM) 55 { 56 /* 57 * Terminate the current one. 58 */ 59 if (pVM->dbgf.s.pCurOS) 60 { 61 pVM->dbgf.s.pCurOS->pReg->pfnTerm(pVM, pVM->dbgf.s.pCurOS->abData); 62 pVM->dbgf.s.pCurOS = NULL; 63 } 64 65 /* 66 * Destroy all the instances. 67 */ 68 while (pVM->dbgf.s.pOSHead) 69 { 70 PDBGFOS pOS = pVM->dbgf.s.pOSHead; 71 pVM->dbgf.s.pOSHead = pOS->pNext; 72 if (pOS->pReg->pfnDestruct) 73 pOS->pReg->pfnDestruct(pVM, pOS->abData); 74 MMR3HeapFree(pOS); 75 } 76 } 37 77 38 78 … … 47 87 { 48 88 /* more validations. */ 89 DBGF_OS_READ_LOCK(pVM); 49 90 PDBGFOS pOS; 50 91 for (pOS = pVM->dbgf.s.pOSHead; pOS; pOS = pOS->pNext) 51 92 if (!strcmp(pOS->pReg->szName, pReg->szName)) 52 93 { 94 DBGF_OS_READ_UNLOCK(pVM); 53 95 Log(("dbgfR3OSRegister: %s -> VERR_ALREADY_LOADED\n", pReg->szName)); 54 96 return VERR_ALREADY_LOADED; … … 65 107 if (RT_SUCCESS(rc)) 66 108 { 109 DBGF_OS_WRITE_LOCK(pVM); 67 110 pOS->pNext = pVM->dbgf.s.pOSHead; 68 111 pVM->dbgf.s.pOSHead = pOS; 112 DBGF_OS_WRITE_UNLOCK(pVM); 69 113 } 70 114 else … … 95 139 * Validate intput. 96 140 */ 141 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 142 97 143 AssertPtrReturn(pReg, VERR_INVALID_POINTER); 98 144 AssertReturn(pReg->u32Magic == DBGFOSREG_MAGIC, VERR_INVALID_MAGIC); … … 115 161 */ 116 162 PVMREQ pReq; 117 int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)dbgfR3OSRegister, 2, pVM, pReg);163 int rc = VMR3ReqCallU(pVM->pUVM, 0, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)dbgfR3OSRegister, 2, pVM, pReg); 118 164 if (RT_SUCCESS(rc)) 119 165 rc = pReq->iStatus; … … 125 171 126 172 /** 127 * Internal cleanup routine called by DBGFR3Term(). 128 * 173 * EMT worker function for DBGFR3OSDeregister. 174 * 175 * @returns VBox status code. 129 176 * @param pVM Pointer to the shared VM structure. 130 */ 131 void dbgfR3OSTerm(PVM pVM) 132 { 133 /* 134 * Terminate the current one. 135 */ 136 if (pVM->dbgf.s.pCurOS) 137 { 138 pVM->dbgf.s.pCurOS->pReg->pfnTerm(pVM, pVM->dbgf.s.pCurOS->abData); 139 pVM->dbgf.s.pCurOS = NULL; 140 } 141 142 /* 143 * Destroy all the instances. 144 */ 145 while (pVM->dbgf.s.pOSHead) 146 { 147 PDBGFOS pOS = pVM->dbgf.s.pOSHead; 148 pVM->dbgf.s.pOSHead = pOS->pNext; 149 if (pOS->pReg->pfnDestruct) 150 pOS->pReg->pfnDestruct(pVM, pOS->abData); 151 MMR3HeapFree(pOS); 152 } 177 * @param pReg The registration structure. 178 */ 179 static DECLCALLBACK(int) dbgfR3OSDeregister(PVM pVM, PDBGFOSREG pReg) 180 { 181 /* 182 * Unlink it. 183 */ 184 bool fWasCurOS = false; 185 PDBGFOS pOSPrev = NULL; 186 PDBGFOS pOS; 187 DBGF_OS_WRITE_LOCK(pVM); 188 for (pOS = pVM->dbgf.s.pOSHead; pOS; pOSPrev = pOS, pOS = pOS->pNext) 189 if (pOS->pReg == pReg) 190 { 191 if (pOSPrev) 192 pOSPrev->pNext = pOS->pNext; 193 else 194 pVM->dbgf.s.pOSHead = pOS->pNext; 195 if (pVM->dbgf.s.pCurOS == pOS) 196 { 197 pVM->dbgf.s.pCurOS = NULL; 198 fWasCurOS = true; 199 } 200 break; 201 } 202 DBGF_OS_WRITE_UNLOCK(pVM); 203 if (!pOS) 204 { 205 Log(("DBGFR3OSDeregister: %s -> VERR_NOT_FOUND\n", pReg->szName)); 206 return VERR_NOT_FOUND; 207 } 208 209 /* 210 * Terminate it if it was the current OS, then invoke the 211 * destructor and clean up. 212 */ 213 if (fWasCurOS) 214 pOS->pReg->pfnTerm(pVM, pOS->abData); 215 if (pOS->pReg->pfnDestruct) 216 pOS->pReg->pfnDestruct(pVM, pOS->abData); 217 MMR3HeapFree(pOS); 218 219 return VINF_SUCCESS; 220 } 221 222 223 /** 224 * Deregisters a guest OS digger previously registered by DBGFR3OSRegister. 225 * 226 * @returns VBox status code. 227 * 228 * @param pVM Pointer to the shared VM structure. 229 * @param pReg The registration structure. 230 * @thread Any. 231 */ 232 VMMR3DECL(int) DBGFR3OSDeregister(PVM pVM, PCDBGFOSREG pReg) 233 { 234 /* 235 * Validate input. 236 */ 237 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 238 AssertPtrReturn(pReg, VERR_INVALID_POINTER); 239 AssertReturn(pReg->u32Magic == DBGFOSREG_MAGIC, VERR_INVALID_MAGIC); 240 AssertReturn(pReg->u32EndMagic == DBGFOSREG_MAGIC, VERR_INVALID_MAGIC); 241 AssertReturn(memchr(&pReg->szName[0], '\0', sizeof(pReg->szName)), VERR_INVALID_NAME); 242 243 DBGF_OS_READ_LOCK(pVM); 244 PDBGFOS pOS; 245 for (pOS = pVM->dbgf.s.pOSHead; pOS; pOS = pOS->pNext) 246 if (pOS->pReg == pReg) 247 break; 248 DBGF_OS_READ_LOCK(pVM); 249 250 if (!pOS) 251 { 252 Log(("DBGFR3OSDeregister: %s -> VERR_NOT_FOUND\n", pReg->szName)); 253 return VERR_NOT_FOUND; 254 } 255 256 /* 257 * Pass it on to the EMT. 258 */ 259 PVMREQ pReq; 260 int rc = VMR3ReqCallU(pVM->pUVM, 0, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)dbgfR3OSDeregister, 2, pVM, pReg); 261 if (RT_SUCCESS(rc)) 262 rc = pReq->iStatus; 263 VMR3ReqFree(pReq); 264 265 return rc; 153 266 } 154 267 … … 223 336 */ 224 337 PVMREQ pReq; 225 int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)dbgfR3OSDetect, 3, pVM, pszName, cchName);338 int rc = VMR3ReqCallU(pVM->pUVM, 0, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)dbgfR3OSDetect, 3, pVM, pszName, cchName); 226 339 if (RT_SUCCESS(rc)) 227 340 rc = pReq->iStatus; … … 307 420 */ 308 421 PVMREQ pReq; 309 int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)dbgfR3OSQueryNameAndVersion,422 int rc = VMR3ReqCallU(pVM->pUVM, 0, &pReq, RT_INDEFINITE_WAIT, 0, (PFNRT)dbgfR3OSQueryNameAndVersion, 310 423 5, pVM, pszName, cchName, pszVersion, cchVersion); 311 424 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.