Changeset 2121 in vbox
- Timestamp:
- Apr 17, 2007 9:42:38 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r2117 r2121 470 470 471 471 #ifdef IOMGC_MOVS_SUPPORT 472 473 inline int iomRamRead(PVM pVM, void *pDest, RTGCPTR GCSrc, uint32_t cb) 474 { 475 #ifdef IN_GC 476 return MMGCRamReadNoTrapHandler(pDest, GCSrc, cb); 477 #else 478 int rc; 479 RTGCPHYS GCPhys; 480 RTGCUINTPTR offset; 481 482 offset = GCSrc & PAGE_OFFSET_MASK; 483 484 /** @todo optimize the loop; no need to convert the address all the time */ 485 rc = PGMPhysGCPtr2GCPhys(pVM, GCSrc, &GCPhys); 486 AssertRCReturn(rc, rc); 487 PGMPhysRead(pVM, GCPhys + offset, pDest, cb); 488 return VINF_SUCCESS; 489 #endif 490 } 491 492 inline int iomRamWrite(PVM pVM, RTGCPTR GCDest, void *pSrc, uint32_t cb) 493 { 494 #ifdef IN_GC 495 return MMGCRamWriteNoTrapHandler(GCDest, pSrc, cb); 496 #else 497 int rc; 498 RTGCPHYS GCPhys; 499 RTGCUINTPTR offset; 500 501 /** @todo optimize the loop; no need to convert the address all the time */ 502 offset = GCDest & PAGE_OFFSET_MASK; 503 rc = PGMPhysGCPtr2GCPhys(pVM, GCDest, &GCPhys); 504 AssertRCReturn(rc, rc); 505 PGMPhysWrite(pVM, GCPhys + offset, pSrc, cb); 506 return VINF_SUCCESS; 507 #endif 508 } 509 472 510 /** 473 511 * [REP] MOVSB … … 542 580 543 581 /* Convert source address ds:esi. */ 544 uint8_t *pu8Virt;582 RTGCUINTPTR pu8Virt; 545 583 rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->ds, (RTGCPTR)pRegFrame->esi, &pRegFrame->dsHid, 546 584 SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL, … … 550 588 551 589 /* Access verification first; we currently can't recover properly from traps inside this instruction */ 552 rc = PGMVerifyAccess(pVM, (RTGCUINTPTR)pu8Virt, cTransfers * cbSize, (cpl == 3) ? X86_PTE_US : 0);590 rc = PGMVerifyAccess(pVM, pu8Virt, cTransfers * cbSize, (cpl == 3) ? X86_PTE_US : 0); 553 591 if (rc != VINF_SUCCESS) 554 592 { … … 558 596 } 559 597 598 #ifdef IN_GC 560 599 MMGCRamRegisterTrapHandler(pVM); 600 #endif 561 601 562 602 /* copy loop. */ … … 564 604 { 565 605 uint32_t u32Data = 0; 566 rc = MMGCRamReadNoTrapHandler(&u32Data,pu8Virt, cbSize);606 rc = iomRamRead(pVM, &u32Data, (RTGCPTR)pu8Virt, cbSize); 567 607 if (rc != VINF_SUCCESS) 568 608 break; … … 577 617 cTransfers--; 578 618 } 619 #ifdef IN_GC 579 620 MMGCRamDeregisterTrapHandler(pVM); 580 621 #endif 581 622 /* Update ecx. */ 582 623 if (pCpu->prefix & PREFIX_REP) … … 598 639 599 640 /* Convert destination address. */ 600 uint8_t *pu8Virt;641 RTGCUINTPTR pu8Virt; 601 642 rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->es, (RTGCPTR)pRegFrame->edi, &pRegFrame->esHid, 602 643 SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL, 603 ( PRTGCPTR)&pu8Virt, NULL);644 (RTGCPTR *)&pu8Virt, NULL); 604 645 if (VBOX_FAILURE(rc)) 605 646 return VINF_EM_RAW_GUEST_TRAP; … … 607 648 /* Check if destination address is MMIO. */ 608 649 RTGCPHYS PhysDst; 609 rc = PGMGstGetPage(pVM, pu8Virt, NULL, &PhysDst);650 rc = PGMGstGetPage(pVM, (RTGCPTR)pu8Virt, NULL, &PhysDst); 610 651 if ( VBOX_SUCCESS(rc) 611 652 && iomMMIOGetRangeHC(&pVM->iom.s, PhysDst)) … … 618 659 619 660 PhysDst |= (RTGCUINTPTR)pu8Virt & PAGE_OFFSET_MASK; 620 PIOMMMIORANGEGCpMMIODst = iomMMIOGetRange(&pVM->iom.s, PhysDst);661 CTXALLSUFF(PIOMMMIORANGE) pMMIODst = iomMMIOGetRange(&pVM->iom.s, PhysDst); 621 662 if ( !pMMIODst 622 663 || !pMMIODst->pfnWriteCallback) … … 655 696 656 697 /* Access verification first; we currently can't recover properly from traps inside this instruction */ 657 rc = PGMVerifyAccess(pVM, (RTGCUINTPTR)pu8Virt, cTransfers * cbSize, X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0));698 rc = PGMVerifyAccess(pVM, pu8Virt, cTransfers * cbSize, X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0)); 658 699 if (rc != VINF_SUCCESS) 659 700 { … … 664 705 665 706 /* copy loop. */ 707 #ifdef IN_GC 666 708 MMGCRamRegisterTrapHandler(pVM); 709 #endif 667 710 while (cTransfers) 668 711 { … … 671 714 if (rc != VINF_SUCCESS) 672 715 break; 673 rc = MMGCRamWriteNoTrapHandler(pu8Virt, &u32Data, cbSize);716 rc = iomRamWrite(pVM, (RTGCPTR)pu8Virt, &u32Data, cbSize); 674 717 if (rc != VINF_SUCCESS) 675 718 { … … 684 727 cTransfers--; 685 728 } 729 #ifdef IN_GC 686 730 MMGCRamDeregisterTrapHandler(pVM); 731 #endif 687 732 STAM_PROFILE_STOP(&pVM->iom.s.StatGCInstMovsFromMMIO, c); 688 733 }
Note:
See TracChangeset
for help on using the changeset viewer.