Changeset 5394 in vbox
- Timestamp:
- Oct 21, 2007 1:49:38 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25505
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/TRPM.cpp
r4071 r5394 394 394 395 395 396 /** 397 * Enable or disable tracking of Guest's IDT. 398 * @{ 399 */ 396 /** Enable or disable tracking of Guest's IDT. */ 400 397 #define TRPM_TRACK_GUEST_IDT_CHANGES 401 /** @} */ 402 403 /** 404 * Enable or disable tracking of Shadow IDT. 405 * @{ 406 */ 398 399 /** Enable or disable tracking of Shadow IDT. */ 407 400 #define TRPM_TRACK_SHADOW_IDT_CHANGES 408 /** @} */409 401 410 402 /** TRPM saved state version. */ … … 445 437 pVM->trpm.s.GCPtrIdt = ~0; 446 438 pVM->trpm.s.fDisableMonitoring = false; 439 pVM->trpm.s.fSafeToDropGuestIDTMonitoring = false; 440 441 /* 442 * Read the configuration (if any). 443 */ 444 PCFGMNODE pTRPMNode = CFGMR3GetChild(CFGMR3GetRoot(pVM), "TRPM"); 445 if (pTRPMNode) 446 { 447 bool f; 448 int rc = CFGMR3QueryBool(pTRPMNode, "SafeToDropGuestIDTMonitoring", &f); 449 if (RT_SUCCESS(rc)) 450 pVM->trpm.s.fSafeToDropGuestIDTMonitoring = f; 451 } 452 453 /* write config summary to log */ 454 if (pVM->trpm.s.fSafeToDropGuestIDTMonitoring) 455 LogRel(("TRPM: Dropping Guest IDT Monitoring.\n")); 447 456 448 457 /* … … 557 566 * Iterate the idt and set the addresses. 558 567 */ 559 PVBOXIDTE pIdte= &pVM->trpm.s.aIdt[0];560 PVBOXIDTE_GENERIC 568 PVBOXIDTE pIdte = &pVM->trpm.s.aIdt[0]; 569 PVBOXIDTE_GENERIC pIdteTemplate = &g_aIdt[0]; 561 570 for (unsigned i = 0; i < ELEMENTS(pVM->trpm.s.aIdt); i++, pIdte++, pIdteTemplate++) 562 571 { … … 673 682 if (pVM->trpm.s.GuestIdtr.pIdt != ~0U) 674 683 { 675 int rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt); 676 AssertRC(rc); 684 if (!pVM->trpm.s.fSafeToDropGuestIDTMonitoring) 685 { 686 int rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt); 687 AssertRC(rc); 688 } 677 689 pVM->trpm.s.GuestIdtr.pIdt = ~0U; 678 690 } … … 719 731 SSMR3PutGCUIntPtr(pSSM, pTrpm->uSavedCR2); 720 732 SSMR3PutGCUInt(pSSM, pTrpm->uPrevVector); 733 #if 0 /** @todo Enable this (+ load change) on the next version change. */ 734 SSMR3PutBool(pSSM, pTrpm->fDisableMonitoring); 735 #else 721 736 SSMR3PutGCUInt(pSSM, pTrpm->fDisableMonitoring); 737 #endif 722 738 SSMR3PutUInt(pSSM, VM_FF_ISSET(pVM, VM_FF_TRPM_SYNC_IDT)); 723 739 SSMR3PutMem(pSSM, &pTrpm->au32IdtPatched[0], sizeof(pTrpm->au32IdtPatched)); … … 780 796 SSMR3GetGCUIntPtr(pSSM, &pTrpm->uSavedCR2); 781 797 SSMR3GetGCUInt(pSSM, &pTrpm->uPrevVector); 782 SSMR3GetGCUInt(pSSM, &pTrpm->fDisableMonitoring); 798 #if 0 /** @todo Enable this + the corresponding save code on the next version change. */ 799 SSMR3GetBool(pSSM, &pTrpm->fDisableMonitoring); 800 #else 801 RTGCUINT fDisableMonitoring; 802 SSMR3GetGCUInt(pSSM, &fDisableMonitoring); 803 pTrpm->fDisableMonitoring = !!fDisableMonitoring; 804 #endif 783 805 784 806 RTUINT fSyncIDT; … … 892 914 { 893 915 Log(("TRPMR3UpdateFromCPUM: Guest's IDT is changed to pIdt=%08X cbIdt=%08X\n", IDTR.pIdt, IDTR.cbIdt)); 894 895 /* 896 * [Re]Register write virtual handler for guest's IDT. 897 */ 898 if (pVM->trpm.s.GuestIdtr.pIdt != ~0U) 899 { 900 rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt); 901 AssertRCReturn(rc, rc); 902 } 903 /* limit is including */ 904 rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, IDTR.pIdt, IDTR.pIdt + IDTR.cbIdt /* already inclusive */, 905 0, trpmGuestIDTWriteHandler, "trpmgcGuestIDTWriteHandler", 0, "Guest IDT write access handler"); 906 907 if (rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT) 908 { 909 /* Could be a conflict with CSAM */ 910 CSAMR3RemovePage(pVM, IDTR.pIdt); 911 if (PAGE_ADDRESS(IDTR.pIdt) != PAGE_ADDRESS(IDTR.pIdt + IDTR.cbIdt)) 912 CSAMR3RemovePage(pVM, IDTR.pIdt + IDTR.cbIdt); 913 916 if (!pVM->trpm.s.fSafeToDropGuestIDTMonitoring) 917 { 918 /* 919 * [Re]Register write virtual handler for guest's IDT. 920 */ 921 if (pVM->trpm.s.GuestIdtr.pIdt != ~0U) 922 { 923 rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt); 924 AssertRCReturn(rc, rc); 925 } 926 /* limit is including */ 914 927 rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, IDTR.pIdt, IDTR.pIdt + IDTR.cbIdt /* already inclusive */, 915 928 0, trpmGuestIDTWriteHandler, "trpmgcGuestIDTWriteHandler", 0, "Guest IDT write access handler"); 916 } 917 918 AssertRCReturn(rc, rc); 929 930 if (rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT) 931 { 932 /* Could be a conflict with CSAM */ 933 CSAMR3RemovePage(pVM, IDTR.pIdt); 934 if (PAGE_ADDRESS(IDTR.pIdt) != PAGE_ADDRESS(IDTR.pIdt + IDTR.cbIdt)) 935 CSAMR3RemovePage(pVM, IDTR.pIdt + IDTR.cbIdt); 936 937 rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, IDTR.pIdt, IDTR.pIdt + IDTR.cbIdt /* already inclusive */, 938 0, trpmGuestIDTWriteHandler, "trpmgcGuestIDTWriteHandler", 0, "Guest IDT write access handler"); 939 } 940 941 AssertRCReturn(rc, rc); 942 } 919 943 920 944 /* Update saved Guest IDTR. */ … … 962 986 if (pVM->trpm.s.GuestIdtr.pIdt != ~0U) 963 987 { 964 int rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt); 965 AssertRC(rc); 988 if (!pVM->trpm.s.fSafeToDropGuestIDTMonitoring) 989 { 990 int rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt); 991 AssertRC(rc); 992 } 966 993 pVM->trpm.s.GuestIdtr.pIdt = ~0U; 967 994 } -
trunk/src/VBox/VMM/TRPMInternal.h
r4829 r5394 117 117 RTGCUINT uPrevVector; 118 118 119 /** IDT monitoring and sync flag */ 120 RTUINT fDisableMonitoring; /** @todo r=bird: bool and 7 byte achPadding1. */ 119 /** IDT monitoring and sync flag (HWACC). */ 120 bool fDisableMonitoring; /** @todo r=bird: bool and 7 byte achPadding1. */ 121 122 /** Whether monitoring of the guest IDT is enabled or not. 123 * 124 * This configuration option is provided for speeding up guest like Solaris 125 * that put the IDT on the same page as a whole lot of other data that is 126 * freqently updated. The updates will cause #PFs and have to be interpreted 127 * by PGMInterpretInstruction which is slow compared to raw execution. 128 * 129 * If the guest is well behaved and doesn't change the IDT after loading it, 130 * there is no problem with dropping the IDT monitoring. 131 * 132 * @cfgm /TRPM/SafeToDropGuestIDTMonitoring boolean defaults to false. 133 */ 134 bool fSafeToDropGuestIDTMonitoring; 121 135 122 136 /** Padding to get the IDTs at a 16 byte alignement. */ 123 char achPadding1[4];137 uint8_t abPadding1[6]; 124 138 125 139 /** IDTs. Aligned at 16 byte offset for speed. */ -
trunk/src/VBox/VMM/TRPMInternal.mac
r4071 r5394 6 6 ; 7 7 ; Copyright (C) 2006-2007 innotek GmbH 8 ; 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as 10 10 ; available from http://www.virtualbox.org. This file is free software; … … 38 38 .uSavedCR2 resd 1 39 39 .uPrevVector resd 1 40 .fDisableMonitoring resd 1 41 .achPadding1 resb 4 40 .fDisableMonitoring resb 1 41 .fSafeToDropGuestIDTMonitoring resb 1 42 .abPadding1 resb 6 42 43 .aIdt resd 512 43 44 .au32IdtPatched resd 8
Note:
See TracChangeset
for help on using the changeset viewer.