vbox的更動 13577 路徑 trunk/src/VBox/VMM/VMMGC/SELMGC.cpp
- 時間撮記:
- 2008-10-27 下午01:53:04 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/VMMGC/SELMGC.cpp
r13144 r13577 100 100 * 'little' adjustment we do for DPL 0 selectors. 101 101 */ 102 PX86DESC pShadowDescr = &pVM->selm.s.paGdt GC[iGDTEntry];102 PX86DESC pShadowDescr = &pVM->selm.s.paGdtRC[iGDTEntry]; 103 103 if (Desc.Gen.u1DescType) 104 104 { … … 150 150 if (Sel == (pRegFrame->cs & X86_SEL_MASK)) 151 151 Log(("GDT write to selector in CS register %04X\n", pRegFrame->cs)); 152 else 153 if (Sel == (pRegFrame->ds & X86_SEL_MASK)) 152 else if (Sel == (pRegFrame->ds & X86_SEL_MASK)) 154 153 Log(("GDT write to selector in DS register %04X\n", pRegFrame->ds)); 155 else 156 if (Sel == (pRegFrame->es & X86_SEL_MASK)) 154 else if (Sel == (pRegFrame->es & X86_SEL_MASK)) 157 155 Log(("GDT write to selector in ES register %04X\n", pRegFrame->es)); 158 else 159 if (Sel == (pRegFrame->fs & X86_SEL_MASK)) 156 else if (Sel == (pRegFrame->fs & X86_SEL_MASK)) 160 157 Log(("GDT write to selector in FS register %04X\n", pRegFrame->fs)); 161 else 162 if (Sel == (pRegFrame->gs & X86_SEL_MASK)) 158 else if (Sel == (pRegFrame->gs & X86_SEL_MASK)) 163 159 Log(("GDT write to selector in GS register %04X\n", pRegFrame->gs)); 164 else 165 if (Sel == (pRegFrame->ss & X86_SEL_MASK)) 160 else if (Sel == (pRegFrame->ss & X86_SEL_MASK)) 166 161 Log(("GDT write to selector in SS register %04X\n", pRegFrame->ss)); 167 162 #endif … … 182 177 * (If it's a EIP range this's the EIP, if not it's pvFault.) 183 178 */ 184 VMMRCDECL(int) selm gcGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)185 { 186 LogFlow(("selm gcGuestGDTWriteHandler errcode=%x fault=%VGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange));179 VMMRCDECL(int) selmRCGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange) 180 { 181 LogFlow(("selmRCGuestGDTWriteHandler errcode=%x fault=%VGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange)); 187 182 188 183 /* … … 218 213 if (rc2 == VINF_SUCCESS) 219 214 { 220 STAM_COUNTER_INC(&pVM->selm.s.Stat GCWriteGuestGDTHandled);215 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestGDTHandled); 221 216 return rc; 222 217 } … … 238 233 VM_FF_SET(pVM, VM_FF_SELM_SYNC_GDT); 239 234 } 240 STAM_COUNTER_INC(&pVM->selm.s.Stat GCWriteGuestGDTUnhandled);235 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestGDTUnhandled); 241 236 return rc; 242 237 } … … 255 250 * (If it's a EIP range this's the EIP, if not it's pvFault.) 256 251 */ 257 VMMRCDECL(int) selm gcGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)252 VMMRCDECL(int) selmRCGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange) 258 253 { 259 254 /** @todo To be implemented. */ 260 ////LogCom(("selm gcGuestLDTWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange));255 ////LogCom(("selmRCGuestLDTWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange)); 261 256 262 257 VM_FF_SET(pVM, VM_FF_SELM_SYNC_LDT); 263 STAM_COUNTER_INC(&pVM->selm.s.Stat GCWriteGuestLDT);258 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestLDT); 264 259 return VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT; 265 260 } … … 278 273 * (If it's a EIP range this's the EIP, if not it's pvFault.) 279 274 */ 280 VMMRCDECL(int) selm gcGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)281 { 282 LogFlow(("selm gcGuestTSSWriteHandler errcode=%x fault=%VGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange));275 VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange) 276 { 277 LogFlow(("selmRCGuestTSSWriteHandler errcode=%x fault=%VGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange)); 283 278 284 279 /* … … 298 293 || pGuestTSS->ss0 != (pVM->selm.s.Tss.ss1 & ~1)) /* undo raw-r0 */ 299 294 { 300 Log(("selm gcGuestTSSWriteHandler: R0 stack: %RTsel:%VGv -> %RTsel:%VGv\n",295 Log(("selmRCGuestTSSWriteHandler: R0 stack: %RTsel:%VGv -> %RTsel:%VGv\n", 301 296 (RTSEL)(pVM->selm.s.Tss.ss1 & ~1), pVM->selm.s.Tss.esp1, (RTSEL)pGuestTSS->ss0, pGuestTSS->esp0)); 302 297 pVM->selm.s.Tss.esp1 = pGuestTSS->esp0; 303 298 pVM->selm.s.Tss.ss1 = pGuestTSS->ss0 | 1; 304 STAM_COUNTER_INC(&pVM->selm.s.Stat GCWriteGuestTSSHandledChanged);299 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestTSSHandledChanged); 305 300 } 306 301 if (CPUMGetGuestCR4(pVM) & X86_CR4_VME) … … 331 326 AssertMsg(rc == VINF_SUCCESS, ("MMGCRamRead %VGv failed with %Vrc\n", (uint8_t *)pGuestTSS + offIntRedirBitmap + i * 8, rc)); 332 327 } 333 STAM_COUNTER_INC(&pVM->selm.s.Stat GCWriteGuestTSSRedir);328 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestTSSRedir); 334 329 } 335 330 } 336 STAM_COUNTER_INC(&pVM->selm.s.Stat GCWriteGuestTSSHandled);331 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestTSSHandled); 337 332 } 338 333 else … … 340 335 Assert(VBOX_FAILURE(rc)); 341 336 VM_FF_SET(pVM, VM_FF_SELM_SYNC_TSS); 342 STAM_COUNTER_INC(&pVM->selm.s.Stat GCWriteGuestTSSUnhandled);337 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestTSSUnhandled); 343 338 if (rc == VERR_EM_INTERPRETER) 344 339 rc = VINF_EM_RAW_EMULATE_INSTR_TSS_FAULT; … … 348 343 349 344 350 351 345 /** 352 346 * \#PF Virtual Handler callback for Guest write access to the VBox shadow GDT. … … 361 355 * (If it's a EIP range this's the EIP, if not it's pvFault.) 362 356 */ 363 VMMRCDECL(int) selm gcShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)364 { 365 LogRel(("FATAL ERROR: selm gcShadowGDTWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange));357 VMMRCDECL(int) selmRCShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange) 358 { 359 LogRel(("FATAL ERROR: selmRCShadowGDTWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange)); 366 360 return VERR_SELM_SHADOW_GDT_WRITE; 367 361 } 368 362 363 369 364 /** 370 365 * \#PF Virtual Handler callback for Guest write access to the VBox shadow LDT. … … 379 374 * (If it's a EIP range this's the EIP, if not it's pvFault.) 380 375 */ 381 VMMRCDECL(int) selm gcShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)382 { 383 LogRel(("FATAL ERROR: selm gcShadowLDTWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange));384 Assert((RTRCPTR)pvFault >= pVM->selm.s. GCPtrLdt && (RTRCUINTPTR)pvFault < (RTRCUINTPTR)pVM->selm.s.GCPtrLdt+ 65536 + PAGE_SIZE);376 VMMRCDECL(int) selmRCShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange) 377 { 378 LogRel(("FATAL ERROR: selmRCShadowLDTWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange)); 379 Assert((RTRCPTR)pvFault >= pVM->selm.s.pvLdtRC && (RTRCUINTPTR)pvFault < (RTRCUINTPTR)pVM->selm.s.pvLdtRC + 65536 + PAGE_SIZE); 385 380 return VERR_SELM_SHADOW_LDT_WRITE; 386 381 } 387 382 383 388 384 /** 389 385 * \#PF Virtual Handler callback for Guest write access to the VBox shadow TSS. … … 398 394 * (If it's a EIP range this's the EIP, if not it's pvFault.) 399 395 */ 400 VMMRCDECL(int) selm gcShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)401 { 402 LogRel(("FATAL ERROR: selm gcShadowTSSWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange));396 VMMRCDECL(int) selmRCShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange) 397 { 398 LogRel(("FATAL ERROR: selmRCShadowTSSWriteHandler: eip=%08X pvFault=%VGv pvRange=%VGv\r\n", pRegFrame->eip, pvFault, pvRange)); 403 399 return VERR_SELM_SHADOW_TSS_WRITE; 404 400 } … … 417 413 if (pVM->selm.s.fSyncTSSRing0Stack) 418 414 { 419 RCPTRTYPE(uint8_t *) GCPtrTss = (RCPTRTYPE(uint8_t *))pVM->selm.s.GCPtrGuestTss; 420 int rc; 421 VBOXTSS tss; 415 uint8_t * GCPtrGuestTss = (uint8_t *)(uintptr_t)pVM->selm.s.GCPtrGuestTss; 416 bool fTriedAlready = false; 417 int rc; 418 VBOXTSS tss; 422 419 423 420 Assert(pVM->selm.s.GCPtrGuestTss && pVM->selm.s.cbMonitoredGuestTss); 424 421 425 #ifdef IN_GC426 bool fTriedAlready = false;427 428 422 l_tryagain: 429 rc = MMGCRamRead(pVM, &tss.ss0, GCPtr Tss + RT_OFFSETOF(VBOXTSS, ss0), sizeof(tss.ss0));430 rc |= MMGCRamRead(pVM, &tss.esp0, GCPtr Tss + RT_OFFSETOF(VBOXTSS, esp0), sizeof(tss.esp0));431 432 rc |= MMGCRamRead(pVM, &tss.offIoBitmap, GCPtr Tss + RT_OFFSETOF(VBOXTSS, offIoBitmap), sizeof(tss.offIoBitmap));433 423 rc = MMGCRamRead(pVM, &tss.ss0, GCPtrGuestTss + RT_OFFSETOF(VBOXTSS, ss0), sizeof(tss.ss0)); 424 rc |= MMGCRamRead(pVM, &tss.esp0, GCPtrGuestTss + RT_OFFSETOF(VBOXTSS, esp0), sizeof(tss.esp0)); 425 #ifdef DEBUG 426 rc |= MMGCRamRead(pVM, &tss.offIoBitmap, GCPtrGuestTss + RT_OFFSETOF(VBOXTSS, offIoBitmap), sizeof(tss.offIoBitmap)); 427 #endif 434 428 435 429 if (VBOX_FAILURE(rc)) … … 440 434 /** @todo might cross page boundary */ 441 435 fTriedAlready = true; 442 rc = PGMPrefetchPage(pVM, (RTGCPTR)( RTRCUINTPTR)GCPtrTss);436 rc = PGMPrefetchPage(pVM, (RTGCPTR)(uintptr_t)GCPtrGuestTss); 443 437 if (rc != VINF_SUCCESS) 444 438 return rc; 445 439 goto l_tryagain; 446 440 } 447 AssertMsgFailed(("Unable to read TSS structure at % 08X\n", GCPtrTss));441 AssertMsgFailed(("Unable to read TSS structure at %RRv\n", GCPtrGuestTss)); 448 442 return rc; 449 443 } 450 451 #else /* !IN_GC */452 /* Reading too much. Could be cheaper than two seperate calls though. */453 rc = PGMPhysSimpleReadGCPtr(pVM, &tss, GCPtrTss, sizeof(VBOXTSS));454 if (VBOX_FAILURE(rc))455 {456 AssertReleaseMsgFailed(("Unable to read TSS structure at %08X\n", GCPtrTss));457 return rc;458 }459 #endif /* !IN_GC */460 444 461 445 #ifdef LOG_ENABLED
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器