Changeset 1830 in vbox for trunk/src/VBox/VMM/PATM
- Timestamp:
- Mar 30, 2007 2:16:35 PM (18 years ago)
- Location:
- trunk/src/VBox/VMM/PATM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/CSAM.cpp
r1800 r1830 226 226 pVM->csam.s.fScanningStarted = false; 227 227 228 VM_FF_CLEAR(pVM, VM_FF_CSAM_ FLUSH_DIRTY_PAGE);228 VM_FF_CLEAR(pVM, VM_FF_CSAM_PENDING_ACTION); 229 229 pVM->csam.s.cDirtyPages = 0; 230 230 /* not necessary */ … … 462 462 memcpy(pVM->csam.s.pvDirtyBasePage, csamInfo.pvDirtyBasePage, sizeof(pVM->csam.s.pvDirtyBasePage)); 463 463 memcpy(pVM->csam.s.pvDirtyFaultPage, csamInfo.pvDirtyFaultPage, sizeof(pVM->csam.s.pvDirtyFaultPage)); 464 465 /* Restore possible code page */ 466 pVM->csam.s.cPossibleCodePages = csamInfo.cPossibleCodePages; 467 memcpy(pVM->csam.s.pvPossibleCodePage, csamInfo.pvPossibleCodePage, sizeof(pVM->csam.s.pvPossibleCodePage)); 464 468 465 469 /* Restore pgdir bitmap (we'll change the pointers next). */ … … 2008 2012 * @param fScanned Mark as scanned or not 2009 2013 */ 2010 CSAM DECL(int) CSAMR3MarkCode(PVM pVM, RTGCPTR pInstr, uint32_t opsize, bool fScanned)2014 CSAMR3DECL(int) CSAMR3MarkCode(PVM pVM, RTGCPTR pInstr, uint32_t opsize, bool fScanned) 2011 2015 { 2012 2016 PCSAMPAGE pPage = 0; … … 2104 2108 * @param pVM The VM to operate on. 2105 2109 */ 2106 CSAMR3DECL(int) CSAMR3FlushDirtyPages(PVM pVM)2110 static int csamR3FlushDirtyPages(PVM pVM) 2107 2111 { 2108 2112 STAM_PROFILE_START(&pVM->csam.s.StatFlushDirtyPages, a); … … 2142 2146 } 2143 2147 pVM->csam.s.cDirtyPages = 0; 2144 VM_FF_CLEAR(pVM, VM_FF_CSAM_FLUSH_DIRTY_PAGE);2145 2148 STAM_PROFILE_STOP(&pVM->csam.s.StatFlushDirtyPages, a); 2149 return VINF_SUCCESS; 2150 } 2151 2152 /** 2153 * Flush potential new code pages 2154 * 2155 * @returns VBox status code. 2156 * @param pVM The VM to operate on. 2157 */ 2158 static int csamR3FlushCodePages(PVM pVM) 2159 { 2160 for (uint32_t i=0;i<pVM->csam.s.cPossibleCodePages;i++) 2161 { 2162 int rc; 2163 RTGCPTR GCPtr = pVM->csam.s.pvPossibleCodePage[i]; 2164 2165 GCPtr = GCPtr & PAGE_BASE_GC_MASK; 2166 2167 CSAMMarkPage(pVM, GCPtr, false); 2168 PGMInvalidatePage(pVM, GCPtr); 2169 PGMPrefetchPage(pVM, GCPtr); 2170 2171 CSAMMarkPage(pVM, GCPtr, true); 2172 } 2173 pVM->csam.s.cPossibleCodePages = 0; 2174 return VINF_SUCCESS; 2175 } 2176 2177 /** 2178 * Perform any pending actions 2179 * 2180 * @returns VBox status code. 2181 * @param pVM The VM to operate on. 2182 */ 2183 CSAMR3DECL(int) CSAMR3DoPendingAction(PVM pVM) 2184 { 2185 csamR3FlushDirtyPages(pVM); 2186 csamR3FlushCodePages(pVM); 2187 2188 VM_FF_CLEAR(pVM, VM_FF_CSAM_PENDING_ACTION); 2146 2189 return VINF_SUCCESS; 2147 2190 } -
trunk/src/VBox/VMM/PATM/CSAMInternal.h
r518 r1830 40 40 /** Scanned and approved by CSAM (tm). */ 41 41 /** NOTE: Must be identical to the one defined in PGMInternal.h!! */ 42 #define PGM_PTFLAGS_CSAM_VALIDATED BIT64(11)42 #define PGM_PTFLAGS_CSAM_VALIDATED BIT64(11) 43 43 #endif 44 44 45 45 /** @} */ 46 46 47 #define CSAM_SSM_VERSION 1348 49 #define CSAM_PGDIRBMP_CHUNKS 102450 51 #define CSAM_PAGE_BITMAP_SIZE (PAGE_SIZE/(sizeof(uint8_t)*8))47 #define CSAM_SSM_VERSION 14 48 49 #define CSAM_PGDIRBMP_CHUNKS 1024 50 51 #define CSAM_PAGE_BITMAP_SIZE (PAGE_SIZE/(sizeof(uint8_t)*8)) 52 52 53 53 /* Maximum nr of dirty page that are cached. */ 54 #define CSAM_MAX_DIRTY_PAGES 3254 #define CSAM_MAX_DIRTY_PAGES 32 55 55 56 56 /* Maximum number of cached addresses of dangerous instructions that have been scanned before. */ 57 #define CSAM_MAX_DANGR_INSTR 16 /* power of two! */ 58 #define CSAM_MAX_DANGR_INSTR_MASK (CSAM_MAX_DANGR_INSTR-1) 59 60 61 #define CSAM_MAX_CALLEXIT_RET 16 57 #define CSAM_MAX_DANGR_INSTR 16 /* power of two! */ 58 #define CSAM_MAX_DANGR_INSTR_MASK (CSAM_MAX_DANGR_INSTR-1) 59 60 /* Maximum number of possible dangerous code pages that we'll flush after a world switch */ 61 #define CSAM_MAX_CODE_PAGES_FLUSH 32 62 63 #define CSAM_MAX_CALLEXIT_RET 16 62 64 63 65 /* copy from PATMInternal.h */ 64 #define SIZEOF_NEARJUMP32 5 //opcode byte + 4 byte relative offset66 #define SIZEOF_NEARJUMP32 5 //opcode byte + 4 byte relative offset 65 67 66 68 typedef struct … … 174 176 RTGCPTR pvDirtyBasePage[CSAM_MAX_DIRTY_PAGES]; 175 177 RTGCPTR pvDirtyFaultPage[CSAM_MAX_DIRTY_PAGES]; 178 179 /* To keep track of possible code pages */ 180 uint32_t cPossibleCodePages; 181 RTGCPTR pvPossibleCodePage[CSAM_MAX_CODE_PAGES_FLUSH]; 176 182 177 183 /* Set when scanning has started. */ -
trunk/src/VBox/VMM/PATM/VMMAll/CSAMAll.cpp
r23 r1830 175 175 * @returns false if the page was already scanned. 176 176 * @param pVM The VM to operate on. 177 * @param GCPtr GC pointer of page table entry177 * @param GCPtr GC pointer of page 178 178 */ 179 179 CSAMDECL(bool) CSAMDoesPageNeedScanning(PVM pVM, RTGCPTR GCPtr) … … 189 189 } 190 190 191 192 /** 193 * Remember a possible code page for later inspection 194 * 195 * @returns VBox status code. 196 * @param pVM The VM to operate on. 197 * @param GCPtr GC pointer of page 198 */ 199 CSAMDECL(void) CSAMMarkPossibleCodePage(PVM pVM, RTGCPTR GCPtr) 200 { 201 if (pVM->csam.s.cPossibleCodePages < RT_ELEMENTS(pVM->csam.s.pvPossibleCodePage)) 202 { 203 pVM->csam.s.pvPossibleCodePage[pVM->csam.s.cPossibleCodePages++] = GCPtr; 204 } 205 return; 206 } 207 208 191 209 /** 192 210 * Turn on code scanning -
trunk/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp
r1352 r1830 114 114 } 115 115 116 VM_FF_SET(pVM, VM_FF_CSAM_ FLUSH_DIRTY_PAGE);116 VM_FF_SET(pVM, VM_FF_CSAM_PENDING_ACTION); 117 117 118 118 /* Note that pvFault might be a different address in case of aliases. So use pvRange + offset instead!. */
Note:
See TracChangeset
for help on using the changeset viewer.