Changeset 19141 in vbox
- Timestamp:
- Apr 23, 2009 1:52:18 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/csam.h
r12989 r19141 259 259 * @returns VBox status code. 260 260 * @param pVM The VM to operate on. 261 */ 262 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM); 261 * @param pVCpu The VMCPU to operate on. 262 */ 263 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu); 263 264 264 265 /** -
trunk/include/VBox/em.h
r18927 r19141 117 117 #define EMIsRawRing0Enabled(pVM) ((pVM)->fRawR0Enabled) 118 118 119 VMMDECL(void) EMSetInhibitInterruptsPC(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR PC);120 VMMDECL(RTGCUINTPTR) EMGetInhibitInterruptsPC(PVM pVM, PVMCPU pVCpu);119 VMMDECL(void) EMSetInhibitInterruptsPC(PVMCPU pVCpu, RTGCUINTPTR PC); 120 VMMDECL(RTGCUINTPTR) EMGetInhibitInterruptsPC(PVMCPU pVCpu); 121 121 VMMDECL(int) EMInterpretDisasOne(PVM pVM, PVMCPU pVCpu, PCCPUMCTXCORE pCtxCore, PDISCPUSTATE pCpu, unsigned *pcbInstr); 122 122 VMMDECL(int) EMInterpretDisasOneEx(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore, -
trunk/include/VBox/pdmapi.h
r18618 r19141 43 43 */ 44 44 45 VMMDECL(int) PDMGetInterrupt(PVM pVM, uint8_t *pu8Interrupt);45 VMMDECL(int) PDMGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Interrupt); 46 46 VMMDECL(int) PDMIsaSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level); 47 47 VMMDECL(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level); -
trunk/include/VBox/vm.h
r19015 r19141 82 82 /** Per CPU forced action. 83 83 * See the VMCPU_FF_* \#defines. Updated atomically. */ 84 uint32_t volatile f ForcedActions;84 uint32_t volatile fLocalForcedActions; 85 85 /** The CPU state. */ 86 86 VMCPUSTATE volatile enmState; … … 187 187 * @{ 188 188 */ 189 /** This action forces the VM to service check and pending interrups on the APIC. */190 #define VM_FF_INTERRUPT_APIC RT_BIT_32(0)191 /** This action forces the VM to service check and pending interrups on the PIC. */192 #define VM_FF_INTERRUPT_PIC RT_BIT_32(1)193 189 /** This action forces the VM to schedule and run pending timer (TM). */ 194 #define VM_FF_TIMER RT_BIT_32(2)190 #define VM_FF_TIMER RT_BIT_32(2) 195 191 /** PDM Queues are pending. */ 196 #define VM_FF_PDM_QUEUES RT_BIT_32(3)192 #define VM_FF_PDM_QUEUES RT_BIT_32(3) 197 193 /** PDM DMA transfers are pending. */ 198 #define VM_FF_PDM_DMA RT_BIT_32(4)194 #define VM_FF_PDM_DMA RT_BIT_32(4) 199 195 /** PDM critical section unlocking is pending, process promptly upon return to R3. */ 200 #define VM_FF_PDM_CRITSECT RT_BIT_32(5) 201 196 #define VM_FF_PDM_CRITSECT RT_BIT_32(5) 202 197 /** This action forces the VM to call DBGF so DBGF can service debugger 203 198 * requests in the emulation thread. 204 199 * This action flag stays asserted till DBGF clears it.*/ 205 #define VM_FF_DBGF RT_BIT_32(8)200 #define VM_FF_DBGF RT_BIT_32(8) 206 201 /** This action forces the VM to service pending requests from other 207 202 * thread or requests which must be executed in another context. */ 208 #define VM_FF_REQUEST RT_BIT_32(9)203 #define VM_FF_REQUEST RT_BIT_32(9) 209 204 /** Terminate the VM immediately. */ 210 #define VM_FF_TERMINATE RT_BIT_32(10)205 #define VM_FF_TERMINATE RT_BIT_32(10) 211 206 /** Reset the VM. (postponed) */ 212 #define VM_FF_RESET RT_BIT_32(11) 213 214 /** This action forces the VM to resync the page tables before going 215 * back to execute guest code. (GLOBAL FLUSH) */ 216 #define VM_FF_PGM_SYNC_CR3 RT_BIT_32(16) 217 /** Same as VM_FF_PGM_SYNC_CR3 except that global pages can be skipped. 218 * (NON-GLOBAL FLUSH) */ 219 #define VM_FF_PGM_SYNC_CR3_NON_GLOBAL RT_BIT_32(17) 207 #define VM_FF_RESET RT_BIT_32(11) 220 208 /** PGM needs to allocate handy pages. */ 221 #define VM_FF_PGM_NEED_HANDY_PAGES RT_BIT_32(18)209 #define VM_FF_PGM_NEED_HANDY_PAGES RT_BIT_32(18) 222 210 /** PGM is out of memory. 223 211 * Abandon all loops and code paths which can be resumed and get up to the EM 224 212 * loops. */ 225 #define VM_FF_PGM_NO_MEMORY RT_BIT_32(19) 213 #define VM_FF_PGM_NO_MEMORY RT_BIT_32(19) 214 /** REM needs to be informed about handler changes. */ 215 #define VM_FF_REM_HANDLER_NOTIFY RT_BIT_32(29) 216 /** Suspend the VM - debug only. */ 217 #define VM_FF_DEBUG_SUSPEND RT_BIT_32(31) 218 219 220 /** This action forces the VM to service check and pending interrups on the APIC. */ 221 #define VMCPU_FF_INTERRUPT_APIC RT_BIT_32(0) 222 /** This action forces the VM to service check and pending interrups on the PIC. */ 223 #define VMCPU_FF_INTERRUPT_PIC RT_BIT_32(1) 224 /** This action forces the VM to schedule and run pending timer (TM). (bogus for now; needed for PATM backwards compatibility) */ 225 #define VMCPU_FF_TIMER RT_BIT_32(2) 226 /** This action forces the VM to service pending requests from other 227 * thread or requests which must be executed in another context. */ 228 #define VMCPU_FF_REQUEST RT_BIT_32(9) 229 /** This action forces the VM to resync the page tables before going 230 * back to execute guest code. (GLOBAL FLUSH) */ 231 #define VMCPU_FF_PGM_SYNC_CR3 RT_BIT_32(16) 232 /** Same as VM_FF_PGM_SYNC_CR3 except that global pages can be skipped. 233 * (NON-GLOBAL FLUSH) */ 234 #define VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL RT_BIT_32(17) 226 235 /** Check the interupt and trap gates */ 227 #define VM _FF_TRPM_SYNC_IDTRT_BIT_32(20)236 #define VMCPU_FF_TRPM_SYNC_IDT RT_BIT_32(20) 228 237 /** Check Guest's TSS ring 0 stack */ 229 #define VM _FF_SELM_SYNC_TSSRT_BIT_32(21)238 #define VMCPU_FF_SELM_SYNC_TSS RT_BIT_32(21) 230 239 /** Check Guest's GDT table */ 231 #define VM _FF_SELM_SYNC_GDTRT_BIT_32(22)240 #define VMCPU_FF_SELM_SYNC_GDT RT_BIT_32(22) 232 241 /** Check Guest's LDT table */ 233 #define VM _FF_SELM_SYNC_LDTRT_BIT_32(23)242 #define VMCPU_FF_SELM_SYNC_LDT RT_BIT_32(23) 234 243 /** Inhibit interrupts pending. See EMGetInhibitInterruptsPC(). */ 235 #define VM_FF_INHIBIT_INTERRUPTS RT_BIT_32(24) 236 244 #define VMCPU_FF_INHIBIT_INTERRUPTS RT_BIT_32(24) 237 245 /** CSAM needs to scan the page that's being executed */ 238 #define VM _FF_CSAM_SCAN_PAGERT_BIT_32(26)246 #define VMCPU_FF_CSAM_SCAN_PAGE RT_BIT_32(26) 239 247 /** CSAM needs to do some homework. */ 240 #define VM_FF_CSAM_PENDING_ACTION RT_BIT_32(27) 241 248 #define VMCPU_FF_CSAM_PENDING_ACTION RT_BIT_32(27) 242 249 /** Force return to Ring-3. */ 243 #define VM_FF_TO_R3 RT_BIT_32(28) 244 245 /** REM needs to be informed about handler changes. */ 246 #define VM_FF_REM_HANDLER_NOTIFY RT_BIT_32(29) 247 248 /** Suspend the VM - debug only. */ 249 #define VM_FF_DEBUG_SUSPEND RT_BIT_32(31) 250 251 /** Externally forced actions. Used to quit the idle/wait loop. */ 252 #define VM_FF_EXTERNAL_SUSPENDED_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_REQUEST) 253 /** Externally forced actions. Used to quit the idle/wait loop. */ 254 #define VM_FF_EXTERNAL_HALTED_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_TIMER | VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA) 255 /** High priority pre-execution actions. */ 256 #define VM_FF_HIGH_PRIORITY_PRE_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_DEBUG_SUSPEND \ 257 | VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY) 258 /** High priority pre raw-mode execution mask. */ 259 #define VM_FF_HIGH_PRIORITY_PRE_RAW_MASK (VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT \ 260 | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_INHIBIT_INTERRUPTS | VM_FF_PGM_NO_MEMORY) 250 #define VMCPU_FF_TO_R3 RT_BIT_32(28) 251 252 /** Externally VM forced actions. Used to quit the idle/wait loop. */ 253 #define VM_FF_EXTERNAL_SUSPENDED_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_REQUEST) 254 /** Externally VMCPU forced actions. Used to quit the idle/wait loop. */ 255 #define VMCPU_FF_EXTERNAL_SUSPENDED_MASK (VMCPU_FF_REQUEST) 256 257 /** Externally forced VM actions. Used to quit the idle/wait loop. */ 258 #define VM_FF_EXTERNAL_HALTED_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_TIMER | VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA) 259 /** Externally forced VMCPU actions. Used to quit the idle/wait loop. */ 260 #define VMCPU_FF_EXTERNAL_HALTED_MASK (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_REQUEST) 261 262 /** High priority VM pre-execution actions. */ 263 #define VM_FF_HIGH_PRIORITY_PRE_MASK ( VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_TIMER | VM_FF_DEBUG_SUSPEND \ 264 | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY) 265 /** High priority VMCPU pre-execution actions. */ 266 #define VMCPU_FF_HIGH_PRIORITY_PRE_MASK ( VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC \ 267 | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT) 268 269 /** High priority VM pre raw-mode execution mask. */ 270 #define VM_FF_HIGH_PRIORITY_PRE_RAW_MASK (VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY) 271 /** High priority VMCPU pre raw-mode execution mask. */ 272 #define VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK ( VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT \ 273 | VMCPU_FF_INHIBIT_INTERRUPTS) 274 261 275 /** High priority post-execution actions. */ 262 #define VM_FF_HIGH_PRIORITY_POST_MASK (VM_FF_PDM_CRITSECT | VM_FF_CSAM_PENDING_ACTION | VM_FF_PGM_NO_MEMORY) 263 /** Normal priority post-execution actions. */ 264 #define VM_FF_NORMAL_PRIORITY_POST_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_CSAM_SCAN_PAGE | VM_FF_PGM_NO_MEMORY) 276 #define VM_FF_HIGH_PRIORITY_POST_MASK (VM_FF_PDM_CRITSECT | VM_FF_PGM_NO_MEMORY) 277 /** High priority post-execution actions. */ 278 #define VMCPU_FF_HIGH_PRIORITY_POST_MASK (VMCPU_FF_CSAM_PENDING_ACTION) 279 280 /** Normal priority VM post-execution actions. */ 281 #define VM_FF_NORMAL_PRIORITY_POST_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_PGM_NO_MEMORY) 282 /** Normal priority VMCPU post-execution actions. */ 283 #define VMCPU_FF_NORMAL_PRIORITY_POST_MASK (VMCPU_FF_CSAM_SCAN_PAGE) 284 265 285 /** Normal priority actions. */ 266 #define VM_FF_NORMAL_PRIORITY_MASK (VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_REM_HANDLER_NOTIFY) 286 #define VM_FF_NORMAL_PRIORITY_MASK (VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_REM_HANDLER_NOTIFY) 287 267 288 /** Flags to clear before resuming guest execution. */ 268 #define VM_FF_RESUME_GUEST_MASK (VM_FF_TO_R3) 269 /** Flags that causes the HWACCM loops to go back to ring-3. */ 270 #define VM_FF_HWACCM_TO_R3_MASK (VM_FF_TO_R3 | VM_FF_TIMER | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY) 289 #define VMCPU_FF_RESUME_GUEST_MASK (VMCPU_FF_TO_R3) 290 291 /** VM Flags that cause the HWACCM loops to go back to ring-3. */ 292 #define VM_FF_HWACCM_TO_R3_MASK (VM_FF_TIMER | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY) 293 /** VMCPU Flags that cause the HWACCM loops to go back to ring-3. */ 294 #define VMCPU_FF_HWACCM_TO_R3_MASK (VMCPU_FF_TO_R3) 295 271 296 /** All the forced flags. */ 272 #define VM_FF_ALL_MASK (~0U) 273 /** All the forced flags. */ 274 #define VM_FF_ALL_BUT_RAW_MASK (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_CSAM_PENDING_ACTION | VM_FF_PDM_CRITSECT) | VM_FF_PGM_NO_MEMORY) 297 #define VM_FF_ALL_MASK (~0U) 298 /** All the forced VM flags. */ 299 #define VM_FF_ALL_BUT_RAW_MASK (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_PDM_CRITSECT) | VM_FF_PGM_NO_MEMORY) 300 /** All the forced VMCPU flags. */ 301 #define VMCPU_FF_ALL_BUT_RAW_MASK (~(VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK | VMCPU_FF_CSAM_PENDING_ACTION)) 275 302 276 303 /** @} */ … … 283 310 */ 284 311 #if 1 285 # define VM_FF_SET(pVM, fFlag) ASMAtomicOrU32(&(pVM)->f ForcedActions, (fFlag))312 # define VM_FF_SET(pVM, fFlag) ASMAtomicOrU32(&(pVM)->fGlobalForcedActions, (fFlag)) 286 313 #else 287 314 # define VM_FF_SET(pVM, fFlag) \ 288 do { ASMAtomicOrU32(&(pVM)->f ForcedActions, (fFlag)); \289 RTLogPrintf("VM_FF_SET : %08x %s - %s(%d) %s\n", (pVM)->f ForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \315 do { ASMAtomicOrU32(&(pVM)->fGlobalForcedActions, (fFlag)); \ 316 RTLogPrintf("VM_FF_SET : %08x %s - %s(%d) %s\n", (pVM)->fGlobalForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \ 290 317 } while (0) 291 318 #endif 292 319 293 320 /** @def VMCPU_FF_SET 294 * Sets a force action flag for given VCPU. 295 * 296 * @param pVM VM Handle. 297 * @param idCpu Virtual CPU ID. 321 * Sets a force action flag for the given VCPU. 322 * 323 * @param pVCpu VMCPU Handle. 298 324 * @param fFlag The flag to set. 299 325 */ 300 #if def VBOX_WITH_SMP_GUESTS301 # define VMCPU_FF_SET(pV M, idCpu, fFlag) ASMAtomicOrU32(&(pVM)->aCpu[idCpu].fForcedActions, (fFlag))302 #else 303 # define VMCPU_FF_SET(pV M, idCpu, fFlag) VM_FF_SET(pVM, fFlag)326 #if 1 //def VBOX_WITH_SMP_GUESTS 327 # define VMCPU_FF_SET(pVCpu, fFlag) ASMAtomicOrU32(&(pVCpu)->fLocalForcedActions, (fFlag)) 328 #else 329 # define VMCPU_FF_SET(pVCpu, fFlag) ASMAtomicOrU32(&(pVCpu)->CTX_SUFF(pVM)->fGlobalForcedActions, (fFlag)) 304 330 #endif 305 331 … … 311 337 */ 312 338 #if 1 313 # define VM_FF_CLEAR(pVM, fFlag) ASMAtomicAndU32(&(pVM)->f ForcedActions, ~(fFlag))339 # define VM_FF_CLEAR(pVM, fFlag) ASMAtomicAndU32(&(pVM)->fGlobalForcedActions, ~(fFlag)) 314 340 #else 315 341 # define VM_FF_CLEAR(pVM, fFlag) \ 316 do { ASMAtomicAndU32(&(pVM)->f ForcedActions, ~(fFlag)); \317 RTLogPrintf("VM_FF_CLEAR: %08x %s - %s(%d) %s\n", (pVM)->f ForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \342 do { ASMAtomicAndU32(&(pVM)->fGlobalForcedActions, ~(fFlag)); \ 343 RTLogPrintf("VM_FF_CLEAR: %08x %s - %s(%d) %s\n", (pVM)->fGlobalForcedActions, #fFlag, __FILE__, __LINE__, __FUNCTION__); \ 318 344 } while (0) 319 345 #endif 320 346 321 347 /** @def VMCPU_FF_CLEAR 322 * Clears a force action flag for given VCPU. 323 * 324 * @param pVM VM Handle. 325 * @param idCpu Virtual CPU ID. 348 * Clears a force action flag for the given VCPU. 349 * 350 * @param pVCpu VMCPU Handle. 326 351 * @param fFlag The flag to clear. 327 352 */ 328 #if def VBOX_WITH_SMP_GUESTS329 # define VMCPU_FF_CLEAR(pV M, idCpu, fFlag) ASMAtomicAndU32(&(pVM)->aCpu[idCpu].fForcedActions, ~(fFlag))330 #else 331 # define VMCPU_FF_CLEAR(pV M, idCpu, fFlag) VM_FF_CLEAR(pVM, fFlag)353 #if 1 //def VBOX_WITH_SMP_GUESTS 354 # define VMCPU_FF_CLEAR(pVCpu, fFlag) ASMAtomicAndU32(&(pVCpu)->fLocalForcedActions, ~(fFlag)) 355 #else 356 # define VMCPU_FF_CLEAR(pVCpu, fFlag) ASMAtomicAndU32(&(pVCpu)->CTX_SUFF(pVM)->fGlobalForcedActions, ~(fFlag)) 332 357 #endif 333 358 … … 338 363 * @param fFlag The flag to check. 339 364 */ 340 #define VM_FF_ISSET(pVM, fFlag) (((pVM)->f ForcedActions & (fFlag)) == (fFlag))365 #define VM_FF_ISSET(pVM, fFlag) (((pVM)->fGlobalForcedActions & (fFlag)) == (fFlag)) 341 366 342 367 /** @def VMCPU_FF_ISSET 343 * Checks if a force action flag is set for given VCPU. 344 * 345 * @param pVM VM Handle. 346 * @param idCpu Virtual CPU ID. 368 * Checks if a force action flag is set for the given VCPU. 369 * 370 * @param pVCpu VMCPU Handle. 347 371 * @param fFlag The flag to check. 348 372 */ 349 #if def VBOX_WITH_SMP_GUESTS350 # define VMCPU_FF_ISSET(pV M, idCpu, fFlag) (((pVM)->aCpu[idCpu].fForcedActions & (fFlag)) == (fFlag))351 #else 352 # define VMCPU_FF_ISSET(pV M, idCpu, fFlag) VM_FF_ISSET(pVM, fFlag)373 #if 1 //def VBOX_WITH_SMP_GUESTS 374 # define VMCPU_FF_ISSET(pVCpu, fFlag) (((pVCpu)->fLocalForcedActions & (fFlag)) == (fFlag)) 375 #else 376 # define VMCPU_FF_ISSET(pVCpu, fFlag) (((pVCpu)->CTX_SUFF(pVM)->fGlobalForcedActions & (fFlag)) == (fFlag)) 353 377 #endif 354 378 … … 359 383 * @param fFlags The flags to check for. 360 384 */ 361 #define VM_FF_ISPENDING(pVM, fFlags) ((pVM)->f ForcedActions & (fFlags))385 #define VM_FF_ISPENDING(pVM, fFlags) ((pVM)->fGlobalForcedActions & (fFlags)) 362 386 363 387 /** @def VMCPU_FF_ISPENDING 364 * Checks if one or more force action in the specified set is pending for given VCPU. 365 * 366 * @param pVM VM Handle. 367 * @param idCpu Virtual CPU ID. 388 * Checks if one or more force action in the specified set is pending for the given VCPU. 389 * 390 * @param pVCpu VMCPU Handle. 368 391 * @param fFlags The flags to check for. 369 392 */ 370 #if def VBOX_WITH_SMP_GUESTS371 # define VMCPU_FF_ISPENDING(pV M, idCpu, fFlags) ((pVM)->aCpu[idCpu].fForcedActions & (fFlags))372 #else 373 # define VMCPU_FF_ISPENDING(pV M, idCpu, fFlags) VM_FF_ISPENDING(pVM, fFlags)393 #if 1 //def VBOX_WITH_SMP_GUESTS 394 # define VMCPU_FF_ISPENDING(pVCpu, fFlags) ((pVCpu)->fLocalForcedActions & (fFlags)) 395 #else 396 # define VMCPU_FF_ISPENDING(pVCpu, fFlags) ((pVCpu)->CTX_SUFF(pVM)->fGlobalForcedActions & (fFlags)) 374 397 #endif 375 398 … … 382 405 * @param fExcpt The flags that should not be set. 383 406 */ 384 #define VM_FF_IS_PENDING_EXCEPT(pVM, fFlags, fExcpt) ( ((pVM)->f ForcedActions & (fFlags)) && !((pVM)->fForcedActions & (fExcpt)) )407 #define VM_FF_IS_PENDING_EXCEPT(pVM, fFlags, fExcpt) ( ((pVM)->fGlobalForcedActions & (fFlags)) && !((pVM)->fGlobalForcedActions & (fExcpt)) ) 385 408 386 409 /** @def VMCPU_FF_IS_PENDING_EXCEPT 387 * Checks if one or more force action in the specified set is pending for given410 * Checks if one or more force action in the specified set is pending for the given 388 411 * VCPU while one or more other ones are not. 389 412 * 390 * @param pVM VM Handle. 391 * @param idCpu Virtual CPU ID. 413 * @param pVCpu VMCPU Handle. 392 414 * @param fFlags The flags to check for. 393 415 * @param fExcpt The flags that should not be set. 394 416 */ 395 #if def VBOX_WITH_SMP_GUESTS396 # define VMCPU_FF_IS_PENDING_EXCEPT(pV M, idCpu, fFlags, fExcpt) ( ((pVM)->aCpu[idCpu].fForcedActions & (fFlags)) && !((pVM)->aCpu[idCpu].fForcedActions & (fExcpt)) )397 #else 398 # define VMCPU_FF_IS_PENDING_EXCEPT(pV M, idCpu, fFlags, fExcpt) VM_FF_ISPENDING(pVM, fFlags, fExcpt)417 #if 1 //def VBOX_WITH_SMP_GUESTS 418 # define VMCPU_FF_IS_PENDING_EXCEPT(pVCpu, fFlags, fExcpt) ( ((pVCpu)->fLocalForcedActions & (fFlags)) && !((pVCpu)->fLocalForcedActions & (fExcpt)) ) 419 #else 420 # define VMCPU_FF_IS_PENDING_EXCEPT(pVCpu, fFlags, fExcpt) ( ((pVCpu)->CTX_SUFF(pVM)->fGlobalForcedActions & (fFlags)) && !((pVCpu)->CTX_SUFF(pVM)->fGlobalForcedActions & (fExcpt)) ) 399 421 #endif 400 422 … … 487 509 * See the VM_FF_* \#defines. Updated atomically. 488 510 */ 489 volatile uint32_t f ForcedActions;511 volatile uint32_t fGlobalForcedActions; 490 512 /** Pointer to the array of page descriptors for the VM structure allocation. */ 491 513 R3PTRTYPE(PSUPPAGE) paVMPagesR3; -
trunk/include/VBox/vm.mac
r18927 r19141 35 35 36 36 ;/** This action forces the VM to service check and pending interrups on the APIC. */ 37 %define VM _FF_INTERRUPT_APIC (1 << 0)37 %define VMCPU_FF_INTERRUPT_APIC (1 << 0) 38 38 ;/** This action forces the VM to service check and pending interrups on the PIC. */ 39 %define VM _FF_INTERRUPT_PIC (1 << 1)39 %define VMCPU_FF_INTERRUPT_PIC (1 << 1) 40 40 ;/** This action forces the VM to schedule and run pending timer (TM). */ 41 %define VM _FF_TIMER (1 << 2)41 %define VMCPU_FF_TIMER (1 << 2) 42 42 ;/** This action forces the VM to service pending requests from other 43 43 ; * thread or requests which must be executed in another context. */ 44 %define VM _FF_REQUEST (1 << 9)44 %define VMCPU_FF_REQUEST (1 << 9) 45 45 46 46 ;; … … 48 48 struc VM 49 49 .enmVMState resd 1 50 .f ForcedActionsresd 150 .fGlobalForcedActions resd 1 51 51 .paVMPagesR3 RTR3PTR_RES 1 52 52 .pSession RTR0PTR_RES 1 … … 105 105 ; This is part of the VMCPU structure. 106 106 struc VMCPU 107 .f ForcedActionsresd 1108 .enmState resd 1109 .pVMR3 RTR3PTR_RES 1110 .pVMR0 RTR0PTR_RES 1111 .pVMRC RTRCPTR_RES 1112 .idCpu resd 1107 .fLocalForcedActions resd 1 108 .enmState resd 1 109 .pVMR3 RTR3PTR_RES 1 110 .pVMR0 RTR0PTR_RES 1 111 .pVMRC RTRCPTR_RES 1 112 .idCpu resd 1 113 113 114 .hNativeThread RTR0PTR_RES 1114 .hNativeThread RTR0PTR_RES 1 115 115 116 116 alignb 64 117 117 118 .cpum resb 2048118 .cpum resb 4096 119 119 endstruc 120 120 -
trunk/include/VBox/vmapi.h
r18649 r19141 432 432 VMMR3DECL(void) VMR3NotifyFF(PVM pVM, bool fNotifiedREM); 433 433 VMMR3DECL(void) VMR3NotifyFFU(PUVM pUVM, bool fNotifiedREM); 434 VMMR3DECL(int) VMR3WaitHalted(PVM pVM, bool fIgnoreInterrupts);434 VMMR3DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts); 435 435 VMMR3DECL(int) VMR3WaitU(PUVM pUVM); 436 436 VMMR3DECL(RTCPUID) VMR3GetVMCPUId(PVM pVM); -
trunk/src/VBox/VMM/DBGF.cpp
r18927 r19141 296 296 * Clear the FF DBGF request flag. 297 297 */ 298 Assert(pVM->f ForcedActions & VM_FF_DBGF);298 Assert(pVM->fGlobalForcedActions & VM_FF_DBGF); 299 299 VM_FF_CLEAR(pVM, VM_FF_DBGF); 300 300 -
trunk/src/VBox/VMM/EM.cpp
r19076 r19141 926 926 if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST | VM_FF_TIMER | VM_FF_PDM_QUEUES | VM_FF_DBGF | VM_FF_TERMINATE | VM_FF_RESET)) 927 927 { 928 LogFlow(("emR3RemExecute: Skipping run, because FF is set. %#x\n", pVM->f ForcedActions));928 LogFlow(("emR3RemExecute: Skipping run, because FF is set. %#x\n", pVM->fGlobalForcedActions)); 929 929 goto l_REMDoForcedActions; 930 930 } … … 943 943 * Deal with high priority post execution FFs before doing anything else. 944 944 */ 945 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK)) 945 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK) 946 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 946 947 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc); 947 948 … … 973 974 TMTimerPoll(pVM); 974 975 #endif 975 if (VM_FF_ISPENDING(pVM, VM_FF_ALL_BUT_RAW_MASK & ~(VM_FF_CSAM_PENDING_ACTION | VM_FF_CSAM_SCAN_PAGE))) 976 if ( VM_FF_ISPENDING(pVM, VM_FF_ALL_BUT_RAW_MASK) 977 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_ALL_BUT_RAW_MASK & ~(VMCPU_FF_CSAM_PENDING_ACTION | VMCPU_FF_CSAM_SCAN_PAGE))) 976 978 { 977 979 l_REMDoForcedActions: … … 1037 1039 Log(("emR3RawStep: cs:eip=%RTsel:%RGr efl=%RGr - returned from GC with rc=%Rrc\n", pCtx->cs, pCtx->eip, pCtx->eflags, rc)); 1038 1040 rc = CPUMRawLeave(pVCpu, NULL, rc); 1039 VM _FF_CLEAR(pVM, VM_FF_RESUME_GUEST_MASK);1041 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); 1040 1042 1041 1043 /* … … 1073 1075 * Check vital forced actions, but ignore pending interrupts and timers. 1074 1076 */ 1075 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 1077 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) 1078 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 1076 1079 { 1077 1080 rc = emR3RawForcedActions(pVM, pVCpu, pCtx); … … 1106 1109 || rc == VINF_EM_RAW_INTERRUPT); 1107 1110 rc = CPUMRawLeave(pVCpu, NULL, rc); 1108 VM _FF_CLEAR(pVM, VM_FF_RESUME_GUEST_MASK);1111 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); 1109 1112 1110 1113 /* … … 1142 1145 int rc; 1143 1146 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 1144 VM _FF_CLEAR(pVM, (VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_TSS));1147 VMCPU_FF_CLEAR(pVCpu, (VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_TSS)); 1145 1148 1146 1149 /* 1147 1150 * Check vital forced actions, but ignore pending interrupts and timers. 1148 1151 */ 1149 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 1152 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) 1153 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 1150 1154 { 1151 1155 rc = emR3RawForcedActions(pVM, pVCpu, pCtx); … … 1167 1171 } while ( rc == VINF_SUCCESS 1168 1172 || rc == VINF_EM_RAW_INTERRUPT); 1169 VM _FF_CLEAR(pVM, VM_FF_RESUME_GUEST_MASK);1173 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); 1170 1174 1171 1175 /* … … 2113 2117 case OP_STI: 2114 2118 pCtx->eflags.u32 |= X86_EFL_IF; 2115 EMSetInhibitInterruptsPC(pV M, pVCpu, pCtx->rip + Cpu.opsize);2119 EMSetInhibitInterruptsPC(pVCpu, pCtx->rip + Cpu.opsize); 2116 2120 Assert(Cpu.opsize == 1); 2117 2121 pCtx->rip += Cpu.opsize; … … 2360 2364 */ 2361 2365 case VINF_PGM_SYNC_CR3: 2362 AssertMsg(VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL),2363 ("VINF_PGM_SYNC_CR3 and no VM _FF_PGM_SYNC_CR3*!\n"));2366 AssertMsg(VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL), 2367 ("VINF_PGM_SYNC_CR3 and no VMCPU_FF_PGM_SYNC_CR3*!\n")); 2364 2368 rc = VINF_SUCCESS; 2365 2369 break; … … 2587 2591 * Sync selector tables. 2588 2592 */ 2589 if (VM _FF_ISPENDING(pVM, VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT))2593 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT)) 2590 2594 { 2591 2595 int rc = SELMR3UpdateFromCPUM(pVM, pVCpu); … … 2601 2605 * PGMSyncCR3+pgmPoolClearAll is pending. 2602 2606 */ 2603 if (VM _FF_ISPENDING(pVM, VM_FF_TRPM_SYNC_IDT))2604 { 2605 if ( VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3)2607 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TRPM_SYNC_IDT)) 2608 { 2609 if ( VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3) 2606 2610 && EMIsRawRing0Enabled(pVM) 2607 2611 && CSAMIsEnabled(pVM)) 2608 2612 { 2609 int rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));2613 int rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 2610 2614 if (RT_FAILURE(rc)) 2611 2615 return rc; … … 2620 2624 * Sync TSS. 2621 2625 */ 2622 if (VM _FF_ISPENDING(pVM, VM_FF_SELM_SYNC_TSS))2626 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_SELM_SYNC_TSS)) 2623 2627 { 2624 2628 int rc = SELMR3SyncTSS(pVM, pVCpu); … … 2630 2634 * Sync page directory. 2631 2635 */ 2632 if (VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL))2633 { 2634 int rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));2636 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)) 2637 { 2638 int rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 2635 2639 if (RT_FAILURE(rc)) 2636 2640 return rc; 2637 2641 2638 Assert(!VM _FF_ISPENDING(pVM, VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT));2642 Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT)); 2639 2643 2640 2644 /* Prefetch pages for EIP and ESP. */ … … 2650 2654 return rc; 2651 2655 } 2652 rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));2656 rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 2653 2657 if (RT_FAILURE(rc)) 2654 2658 return rc; 2655 2659 } 2656 2660 /** @todo maybe prefetch the supervisor stack page as well */ 2657 Assert(!VM _FF_ISPENDING(pVM, VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT));2661 Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT)); 2658 2662 } 2659 2663 … … 2726 2730 || PATMShouldUseRawMode(pVM, (RTGCPTR)pCtx->eip), 2727 2731 ("Tried to execute code with IF at EIP=%08x!\n", pCtx->eip)); 2728 if ( !VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL)2732 if ( !VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL) 2729 2733 && PGMMapHasConflicts(pVM)) 2730 2734 { … … 2738 2742 * Process high priority pre-execution raw-mode FFs. 2739 2743 */ 2740 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 2744 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) 2745 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 2741 2746 { 2742 2747 rc = emR3RawForcedActions(pVM, pVCpu, pCtx); … … 2767 2772 CSAMR3CheckCodeEx(pVM, CPUMCTX2CORE(pCtx), pCtx->eip); 2768 2773 STAM_PROFILE_ADV_RESUME(&pVCpu->em.s.StatRAWEntry, b); 2769 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 2774 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) 2775 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 2770 2776 { 2771 2777 rc = emR3RawForcedActions(pVM, pVCpu, pCtx); … … 2817 2823 */ 2818 2824 rc = CPUMRawLeave(pVCpu, NULL, rc); 2819 VM_FF_CLEAR(pVM, VM_FF_RESUME_GUEST_MASK); 2820 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK)) 2825 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); 2826 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK) 2827 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 2821 2828 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc); 2822 2829 … … 2825 2832 * Assert TSS consistency & rc vs patch code. 2826 2833 */ 2827 if ( !VM _FF_ISPENDING(pVM, VM_FF_SELM_SYNC_TSS | VM_FF_SELM_SYNC_GDT) /* GDT implies TSS at the moment. */2834 if ( !VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_SELM_SYNC_GDT) /* GDT implies TSS at the moment. */ 2828 2835 && EMIsRawRing0Enabled(pVM)) 2829 2836 SELMR3CheckTSS(pVM); … … 2849 2856 * Let's go paranoid! 2850 2857 */ 2851 if ( !VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL)2858 if ( !VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL) 2852 2859 && PGMMapHasConflicts(pVM)) 2853 2860 { … … 2884 2891 #endif 2885 2892 STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatRAWTail, d); 2886 if (VM_FF_ISPENDING(pVM, ~VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_PGM_NO_MEMORY)) 2893 if ( VM_FF_ISPENDING(pVM, ~VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_PGM_NO_MEMORY) 2894 || VMCPU_FF_ISPENDING(pVCpu, ~VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 2887 2895 { 2888 2896 Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss & X86_SEL_RPL) != 1); … … 2953 2961 * Process high priority pre-execution raw-mode FFs. 2954 2962 */ 2955 VM_FF_CLEAR(pVM, (VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_TSS)); /* not relevant in HWACCM mode; shouldn't be set really. */ 2956 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 2963 VMCPU_FF_CLEAR(pVCpu, (VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_TSS)); /* not relevant in HWACCM mode; shouldn't be set really. */ 2964 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) 2965 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 2957 2966 { 2958 2967 rc = emR3RawForcedActions(pVM, pVCpu, pCtx); … … 2990 2999 * Deal with high priority post execution FFs before doing anything else. 2991 3000 */ 2992 VM_FF_CLEAR(pVM, VM_FF_RESUME_GUEST_MASK); 2993 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK)) 3001 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); 3002 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK) 3003 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 2994 3004 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc); 2995 3005 … … 3194 3204 PDMR3CritSectFF(pVM); 3195 3205 3196 if (VM _FF_ISPENDING(pVM, VM_FF_CSAM_PENDING_ACTION))3197 CSAMR3DoPendingAction(pVM );3206 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION)) 3207 CSAMR3DoPendingAction(pVM, pVCpu); 3198 3208 3199 3209 if (VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) … … 3246 3256 * Post execution chunk first. 3247 3257 */ 3248 if (VM_FF_ISPENDING(pVM, VM_FF_NORMAL_PRIORITY_POST_MASK)) 3258 if ( VM_FF_ISPENDING(pVM, VM_FF_NORMAL_PRIORITY_POST_MASK) 3259 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_NORMAL_PRIORITY_POST_MASK)) 3249 3260 { 3250 3261 /* … … 3280 3291 * CSAM page scanning. 3281 3292 */ 3282 if (VM_FF_IS_PENDING_EXCEPT(pVM, VM_FF_CSAM_SCAN_PAGE, VM_FF_PGM_NO_MEMORY)) 3293 if ( !VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY) 3294 && VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_CSAM_SCAN_PAGE)) 3283 3295 { 3284 3296 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 3285 3297 3286 3298 /** @todo: check for 16 or 32 bits code! (D bit in the code selector) */ 3287 Log(("Forced action VM _FF_CSAM_SCAN_PAGE\n"));3299 Log(("Forced action VMCPU_FF_CSAM_SCAN_PAGE\n")); 3288 3300 3289 3301 CSAMR3CheckCodeEx(pVM, CPUMCTX2CORE(pCtx), pCtx->eip); 3290 VM _FF_CLEAR(pVM, VM_FF_CSAM_SCAN_PAGE);3302 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_CSAM_SCAN_PAGE); 3291 3303 } 3292 3304 … … 3303 3315 3304 3316 /* check that we got them all */ 3305 Assert(!(VM_FF_NORMAL_PRIORITY_POST_MASK & ~(VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_CSAM_SCAN_PAGE | VM_FF_PGM_NO_MEMORY))); 3317 Assert(!(VM_FF_NORMAL_PRIORITY_POST_MASK & ~(VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_PGM_NO_MEMORY))); 3318 Assert(!(VMCPU_FF_NORMAL_PRIORITY_POST_MASK & ~(VMCPU_FF_CSAM_SCAN_PAGE))); 3306 3319 } 3307 3320 … … 3351 3364 * (Executed in ascending priority order.) 3352 3365 */ 3353 if (VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_MASK)) 3366 if ( VM_FF_ISPENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_MASK) 3367 || VMCPU_FF_ISPENDING(pVCpu, VM_FF_HIGH_PRIORITY_PRE_MASK)) 3354 3368 { 3355 3369 /* … … 3362 3376 * The instruction following an emulated STI should *always* be executed! 3363 3377 */ 3364 if (VM_FF_IS_PENDING_EXCEPT(pVM, VM_FF_INHIBIT_INTERRUPTS, VM_FF_PGM_NO_MEMORY)) 3365 { 3366 Log(("VM_FF_EMULATED_STI at %RGv successor %RGv\n", (RTGCPTR)CPUMGetGuestRIP(pVCpu), EMGetInhibitInterruptsPC(pVM, pVCpu))); 3367 if (CPUMGetGuestEIP(pVCpu) != EMGetInhibitInterruptsPC(pVM, pVCpu)) 3378 if ( !VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY) 3379 && VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 3380 { 3381 Log(("VM_FF_EMULATED_STI at %RGv successor %RGv\n", (RTGCPTR)CPUMGetGuestRIP(pVCpu), EMGetInhibitInterruptsPC(pVCpu))); 3382 if (CPUMGetGuestEIP(pVCpu) != EMGetInhibitInterruptsPC(pVCpu)) 3368 3383 { 3369 3384 /* Note: we intentionally don't clear VM_FF_INHIBIT_INTERRUPTS here if the eip is the same as the inhibited instr address. … … 3372 3387 * break the guest. Sounds very unlikely, but such timing sensitive problem are not as rare as you might think. 3373 3388 */ 3374 VM _FF_CLEAR(pVM, VM_FF_INHIBIT_INTERRUPTS);3389 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 3375 3390 } 3376 3391 if (HWACCMR3IsActive(pVM)) … … 3385 3400 * Interrupts. 3386 3401 */ 3387 if ( !VM_FF_ISPENDING(pVM, VM_FF_INHIBIT_INTERRUPTS | VM_FF_PGM_NO_MEMORY) 3402 if ( !VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY) 3403 && !VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) 3388 3404 && (!rc || rc >= VINF_EM_RESCHEDULE_HWACC) 3389 3405 && !TRPMHasTrap(pVCpu) /* an interrupt could already be scheduled for dispatching in the recompiler. */ … … 3391 3407 && !HWACCMR3IsEventPending(pVM)) 3392 3408 { 3393 if (VM _FF_ISPENDING(pVM, VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC))3409 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)) 3394 3410 { 3395 3411 /* Note: it's important to make sure the return code from TRPMR3InjectEvent isn't ignored! */ … … 3464 3480 #endif 3465 3481 /* check that we got them all */ 3466 Assert(!(VM_FF_HIGH_PRIORITY_PRE_MASK & ~(VM_FF_TIMER | VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_DBGF | VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_TERMINATE | VM_FF_DEBUG_SUSPEND | VM_FF_INHIBIT_INTERRUPTS | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY))); 3482 Assert(!(VM_FF_HIGH_PRIORITY_PRE_MASK & ~(VM_FF_TIMER | VM_FF_DBGF | VM_FF_TERMINATE | VM_FF_DEBUG_SUSPEND | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY))); 3483 Assert(!(VMCPU_FF_HIGH_PRIORITY_PRE_MASK & ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_INHIBIT_INTERRUPTS))); 3467 3484 } 3468 3485 … … 3796 3813 { 3797 3814 STAM_REL_PROFILE_START(&pVCpu->em.s.StatHalted, y); 3798 rc = VMR3WaitHalted(pVM, !(CPUMGetGuestEFlags(pVCpu) & X86_EFL_IF));3815 rc = VMR3WaitHalted(pVM, pVCpu, !(CPUMGetGuestEFlags(pVCpu) & X86_EFL_IF)); 3799 3816 STAM_REL_PROFILE_STOP(&pVCpu->em.s.StatHalted, y); 3800 3817 break; -
trunk/src/VBox/VMM/PATM/CSAM.cpp
r18992 r19141 228 228 pVM->csam.s.fScanningStarted = false; 229 229 230 VM_FF_CLEAR(pVM, VM_FF_CSAM_PENDING_ACTION); 230 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies 1 VPCU */ 231 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION); 231 232 pVM->csam.s.cDirtyPages = 0; 232 233 /* not necessary */ … … 2263 2264 * @returns VBox status code. 2264 2265 * @param pVM The VM to operate on. 2265 */ 2266 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM) 2266 * @param pVCpu The VMCPU to operate on. 2267 */ 2268 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu) 2267 2269 { 2268 2270 csamR3FlushDirtyPages(pVM); 2269 2271 csamR3FlushCodePages(pVM); 2270 2272 2271 VM _FF_CLEAR(pVM, VM_FF_CSAM_PENDING_ACTION);2273 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION); 2272 2274 return VINF_SUCCESS; 2273 2275 } -
trunk/src/VBox/VMM/PATM/PATM.cpp
r18988 r19141 112 112 Log(("PATMR3Init: Patch record size %d\n", sizeof(PATCHINFO))); 113 113 114 AssertReleaseMsg(PATMInterruptFlag == (VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST), 115 ("Interrupt flags out of sync!! PATMInterruptFlag=%#x expected %#x. broken assembler?\n", PATMInterruptFlag, VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST)); 114 /* These values can't change as they are hardcoded in patch code (old saved states!) */ 115 AssertCompile(VM_FF_TIMER == VMCPU_FF_TIMER); 116 AssertCompile(VM_FF_REQUEST == VMCPU_FF_REQUEST); 117 AssertCompile(VMCPU_FF_INTERRUPT_APIC == RT_BIT_32(0)); 118 AssertCompile(VMCPU_FF_INTERRUPT_PIC == RT_BIT_32(1)); 119 120 AssertReleaseMsg(PATMInterruptFlag == (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST), 121 ("Interrupt flags out of sync!! PATMInterruptFlag=%#x expected %#x. broken assembler?\n", PATMInterruptFlag, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST)); 116 122 117 123 /* Allocate patch memory and GC patch state memory. */ … … 6233 6239 } 6234 6240 #endif 6235 EMSetInhibitInterruptsPC(pV M, pVCpu, pNewEip);6241 EMSetInhibitInterruptsPC(pVCpu, pNewEip); 6236 6242 pVM->patm.s.pGCStateHC->GCPtrInhibitInterrupts = 0; 6237 6243 } -
trunk/src/VBox/VMM/PATM/PATMA.asm
r11979 r19141 146 146 147 147 ; if interrupts are pending, then we must go back to the host context to handle them! 148 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST148 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 149 149 jz PATMClearInhibitIRQFaultIF0_Continue 150 150 … … 221 221 222 222 ; if interrupts are pending, then we must go back to the host context to handle them! 223 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST223 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 224 224 jz PATMClearInhibitIRQContIF0_Continue 225 225 … … 744 744 745 745 ; if interrupts are pending, then we must go back to the host context to handle them! 746 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST746 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 747 747 jz PATMPopf32_Continue 748 748 … … 834 834 835 835 ; if interrupts are pending, then we must go back to the host context to handle them! 836 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST836 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 837 837 jz PATMPopf32_NoExit_Continue 838 838 … … 922 922 ; if interrupts are pending, then we must go back to the host context to handle them! 923 923 ; @note we destroy the flags here, but that should really not matter (PATM_INT3 case) 924 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST924 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 925 925 jz PATMPopf16_Continue 926 926 mov dword [ss:PATM_INTERRUPTFLAG], 1 … … 987 987 ; if interrupts are pending, then we must go back to the host context to handle them! 988 988 ; @note we destroy the flags here, but that should really not matter (PATM_INT3 case) 989 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST989 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 990 990 jz PATMPopf16_Continue_NoExit 991 991 mov dword [ss:PATM_INTERRUPTFLAG], 1 … … 1238 1238 ; Note: This is very important as pending pic interrupts can be overriden by apic interrupts if we don't check early enough (Fedora 5 boot) 1239 1239 ; @@todo fix this properly, so we can dispatch pending interrupts in GC 1240 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC1240 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC 1241 1241 jz iret_continue 1242 1242 … … 2582 2582 ; For assertion during init (to make absolutely sure the flags are in sync in vm.mac & vm.h) 2583 2583 GLOBALNAME PATMInterruptFlag 2584 DD VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST2585 2584 DD VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 2585 -
trunk/src/VBox/VMM/PATM/PATMInternal.h
r18927 r19141 41 41 #else 42 42 # define PATM_SSM_VERSION 54 43 # define PATM_SSM_VERSION_FIXUP_HACK 54 43 44 # define PATM_SSM_VERSION_VER16 53 44 45 #endif … … 134 135 #define PATM_STAT_MEMSIZE (PATM_STAT_MAX_COUNTERS*sizeof(STAMRATIOU32)) 135 136 137 /** aCpus[0].fLocalForcedActions fixup (must be uneven to avoid theoretical clashes with valid pointers) */ 138 #define PATM_FIXUP_CPU_FF_ACTION 0xffffff01 139 /** default cpuid pointer fixup */ 140 #define PATM_FIXUP_CPUID_DEFAULT 0xffffff03 141 /** standard cpuid pointer fixup */ 142 #define PATM_FIXUP_CPUID_STANDARD 0xffffff05 143 /** extended cpuid pointer fixup */ 144 #define PATM_FIXUP_CPUID_EXTENDED 0xffffff07 145 /** centaur cpuid pointer fixup */ 146 #define PATM_FIXUP_CPUID_CENTAUR 0xffffff09 136 147 137 148 typedef struct -
trunk/src/VBox/VMM/PATM/PATMPatch.cpp
r19075 r19141 287 287 case PATM_VM_FORCEDACTIONS: 288 288 /* @todo dirty assumptions when correcting this fixup during saved state loading. */ 289 dest = pVM->pVMRC + RT_OFFSETOF(VM, fForcedActions);289 dest = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions); 290 290 break; 291 291 -
trunk/src/VBox/VMM/PATM/PATMSSM.cpp
r19075 r19141 142 142 PSSMHANDLE pSSM = pVM->patm.s.savedstate.pSSM; 143 143 RELOCREC rec = *(PRELOCREC)pNode; 144 RTRCPTR *pFixup = (RTRCPTR *)rec.pRelocPos; 144 145 145 146 Assert(rec.pRelocPos); 147 /* Convert pointer to an offset into patch memory. */ 146 148 PATM_SUBTRACT_PTR(rec.pRelocPos, pVM->patm.s.pPatchMemHC); 149 150 if (rec.uType == FIXUP_ABSOLUTE) 151 { 152 /* Core.Key abused to store the fixup type. */ 153 if (*pFixup == pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions)) 154 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPU_FF_ACTION; 155 else 156 if (*pFixup == CPUMR3GetGuestCpuIdDefRCPtr(pVM)) 157 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_DEFAULT; 158 else 159 if (*pFixup == CPUMR3GetGuestCpuIdStdRCPtr(pVM)) 160 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_STANDARD; 161 else 162 if (*pFixup == CPUMR3GetGuestCpuIdExtRCPtr(pVM)) 163 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_EXTENDED; 164 else 165 if (*pFixup == CPUMR3GetGuestCpuIdCentaurRCPtr(pVM)) 166 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_CENTAUR; 167 } 147 168 148 169 /* Save the lookup record. */ … … 286 307 287 308 if ( u32Version != PATM_SSM_VERSION 309 && u32Version != PATM_SSM_VERSION_FIXUP_HACK 288 310 && u32Version != PATM_SSM_VERSION_VER16 289 311 #ifdef PATM_WITH_NEW_SSM … … 874 896 } 875 897 else 876 /* Note: rather assumptive! */877 if (*pFixup >= pVM->pVMRC898 if ( ulSSMVersion <= PATM_SSM_VERSION_FIXUP_HACK 899 && *pFixup >= pVM->pVMRC 878 900 && *pFixup < pVM->pVMRC + 32) 879 901 { 880 LogFlow(("Changing f ForcedActions fixup from %x to %x\n", *pFixup, pVM->pVMRC + RT_OFFSETOF(VM, fForcedActions)));881 *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, fForcedActions);902 LogFlow(("Changing fLocalForcedActions fixup from %x to %x\n", *pFixup, pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions))); 903 *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions); 882 904 } 883 905 else 884 if ( *pFixup >= pVM->pVMRC 906 if ( ulSSMVersion <= PATM_SSM_VERSION_FIXUP_HACK 907 && *pFixup >= pVM->pVMRC 885 908 && *pFixup < pVM->pVMRC + 8192) 886 909 { … … 909 932 } 910 933 else 911 AssertMsgFailed(("Unexpected fixup value %x\n", *pFixup)); 934 if (ulSSMVersion >= PATM_SSM_VERSION) 935 { 936 #ifdef LOG_ENABLED 937 RTRCPTR oldFixup = *pFixup; 938 #endif 939 /* Core.Key abused to store the type of fixup */ 940 switch ((uint32_t)pRec->Core.Key) 941 { 942 case PATM_FIXUP_CPU_FF_ACTION: 943 *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions); 944 LogFlow(("Changing cpu ff action fixup from %x to %x\n", oldFixup, *pFixup)); 945 break; 946 case PATM_FIXUP_CPUID_DEFAULT: 947 *pFixup = CPUMR3GetGuestCpuIdDefRCPtr(pVM); 948 LogFlow(("Changing cpuid def fixup from %x to %x\n", oldFixup, *pFixup)); 949 break; 950 case PATM_FIXUP_CPUID_STANDARD: 951 *pFixup = CPUMR3GetGuestCpuIdStdRCPtr(pVM); 952 LogFlow(("Changing cpuid std fixup from %x to %x\n", oldFixup, *pFixup)); 953 break; 954 case PATM_FIXUP_CPUID_EXTENDED: 955 *pFixup = CPUMR3GetGuestCpuIdExtRCPtr(pVM); 956 LogFlow(("Changing cpuid ext fixup from %x to %x\n", oldFixup, *pFixup)); 957 break; 958 case PATM_FIXUP_CPUID_CENTAUR: 959 *pFixup = CPUMR3GetGuestCpuIdCentaurRCPtr(pVM); 960 LogFlow(("Changing cpuid centaur fixup from %x to %x\n", oldFixup, *pFixup)); 961 break; 962 default: 963 AssertMsgFailed(("Unexpected fixup value %x\n", *pFixup)); 964 break; 965 } 966 } 912 967 913 968 #ifdef RT_OS_WINDOWS 914 AssertCompile(RT_OFFSETOF(VM, f ForcedActions) < 32);969 AssertCompile(RT_OFFSETOF(VM, fGlobalForcedActions) < 32); 915 970 #endif 916 971 break; -
trunk/src/VBox/VMM/PATM/VMMAll/CSAMAll.cpp
r14299 r19141 37 37 #include "CSAMInternal.h" 38 38 #include <VBox/vm.h> 39 #include <VBox/vmm.h> 39 40 #include <VBox/dbg.h> 40 41 #include <VBox/err.h> … … 68 69 69 70 STAM_COUNTER_ADD(&pVM->csam.s.StatNrTraps, 1); 70 VM _FF_SET(pVM, VM_FF_CSAM_SCAN_PAGE);71 VMCPU_FF_SET(VMMGetCpu0(pVM), VMCPU_FF_CSAM_SCAN_PAGE); 71 72 return VINF_CSAM_PENDING_ACTION; 72 73 } … … 205 206 { 206 207 pVM->csam.s.pvPossibleCodePage[pVM->csam.s.cPossibleCodePages++] = (RTRCPTR)GCPtr; 207 VM _FF_SET(pVM, VM_FF_CSAM_PENDING_ACTION);208 VMCPU_FF_SET(VMMGetCpu0(pVM), VMCPU_FF_CSAM_PENDING_ACTION); 208 209 } 209 210 return; -
trunk/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp
r18927 r19141 191 191 if (CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts == (RTRCPTR)pCtxCore->eip) 192 192 { 193 EMSetInhibitInterruptsPC( pVM,VMMGetCpu0(pVM), pCtxCore->eip);193 EMSetInhibitInterruptsPC(VMMGetCpu0(pVM), pCtxCore->eip); 194 194 } 195 195 CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts = 0; -
trunk/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp
r18988 r19141 117 117 } 118 118 119 VM _FF_SET(pVM, VM_FF_CSAM_PENDING_ACTION);119 VMCPU_FF_SET(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION); 120 120 121 121 /* Note that pvFault might be a different address in case of aliases. So use pvRange + offset instead!. */ -
trunk/src/VBox/VMM/PDM.cpp
r18618 r19141 641 641 * Save interrupt and DMA states. 642 642 */ 643 SSMR3PutUInt(pSSM, VM_FF_ISSET(pVM, VM_FF_INTERRUPT_APIC)); 644 SSMR3PutUInt(pSSM, VM_FF_ISSET(pVM, VM_FF_INTERRUPT_PIC)); 643 for (unsigned idCpu=0;idCpu<pVM->cCPUs;idCpu++) 644 { 645 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 646 SSMR3PutUInt(pSSM, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC)); 647 SSMR3PutUInt(pSSM, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC)); 648 } 645 649 SSMR3PutUInt(pSSM, VM_FF_ISSET(pVM, VM_FF_PDM_DMA)); 646 650 … … 675 679 LogFlow(("pdmR3LoadPrep: %s%s%s%s\n", 676 680 VM_FF_ISSET(pVM, VM_FF_PDM_QUEUES) ? " VM_FF_PDM_QUEUES" : "", 677 VM_FF_ISSET(pVM, VM_FF_PDM_DMA) ? " VM_FF_PDM_DMA" : "", 678 VM_FF_ISSET(pVM, VM_FF_INTERRUPT_APIC) ? " VM_FF_INTERRUPT_APIC" : "", 679 VM_FF_ISSET(pVM, VM_FF_INTERRUPT_PIC) ? " VM_FF_INTERRUPT_PIC" : "" 681 VM_FF_ISSET(pVM, VM_FF_PDM_DMA) ? " VM_FF_PDM_DMA" : "" 680 682 )); 683 #ifdef LOG_ENABLED 684 for (unsigned idCpu=0;idCpu<pVM->cCPUs;idCpu++) 685 { 686 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 687 LogFlow(("pdmR3LoadPrep: VCPU %d %s%s%s%s\n", idCpu, 688 VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC) ? " VMCPU_FF_INTERRUPT_APIC" : "", 689 VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC) ? " VMCPU_FF_INTERRUPT_PIC" : "" 690 )); 691 } 692 #endif 681 693 682 694 /* … … 688 700 689 701 /* Clear the FFs. */ 690 VM_FF_CLEAR(pVM, VM_FF_INTERRUPT_APIC); 691 VM_FF_CLEAR(pVM, VM_FF_INTERRUPT_PIC); 702 for (unsigned idCpu=0;idCpu<pVM->cCPUs;idCpu++) 703 { 704 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 705 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 706 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 707 } 692 708 VM_FF_CLEAR(pVM, VM_FF_PDM_DMA); 693 709 … … 706 722 static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 707 723 { 724 int rc; 725 708 726 LogFlow(("pdmR3Load:\n")); 709 727 … … 720 738 * Load the interrupt and DMA states. 721 739 */ 722 /* APIC interrupt */ 723 RTUINT fInterruptPending = 0; 724 int rc = SSMR3GetUInt(pSSM, &fInterruptPending); 725 if (RT_FAILURE(rc)) 726 return rc; 727 if (fInterruptPending & ~1) 728 { 729 AssertMsgFailed(("fInterruptPending=%#x (APIC)\n", fInterruptPending)); 730 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 731 } 732 AssertRelease(!VM_FF_ISSET(pVM, VM_FF_INTERRUPT_APIC)); 733 if (fInterruptPending) 734 VM_FF_SET(pVM, VM_FF_INTERRUPT_APIC); 735 736 /* PIC interrupt */ 737 fInterruptPending = 0; 738 rc = SSMR3GetUInt(pSSM, &fInterruptPending); 739 if (RT_FAILURE(rc)) 740 return rc; 741 if (fInterruptPending & ~1) 742 { 743 AssertMsgFailed(("fInterruptPending=%#x (PIC)\n", fInterruptPending)); 744 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 745 } 746 AssertRelease(!VM_FF_ISSET(pVM, VM_FF_INTERRUPT_PIC)); 747 if (fInterruptPending) 748 VM_FF_SET(pVM, VM_FF_INTERRUPT_PIC); 740 for (unsigned idCpu=0;idCpu<pVM->cCPUs;idCpu++) 741 { 742 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 743 744 /* APIC interrupt */ 745 RTUINT fInterruptPending = 0; 746 rc = SSMR3GetUInt(pSSM, &fInterruptPending); 747 if (RT_FAILURE(rc)) 748 return rc; 749 if (fInterruptPending & ~1) 750 { 751 AssertMsgFailed(("fInterruptPending=%#x (APIC)\n", fInterruptPending)); 752 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 753 } 754 AssertRelease(!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC)); 755 if (fInterruptPending) 756 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC); 757 758 /* PIC interrupt */ 759 fInterruptPending = 0; 760 rc = SSMR3GetUInt(pSSM, &fInterruptPending); 761 if (RT_FAILURE(rc)) 762 return rc; 763 if (fInterruptPending & ~1) 764 { 765 AssertMsgFailed(("fInterruptPending=%#x (PIC)\n", fInterruptPending)); 766 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 767 } 768 AssertRelease(!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC)); 769 if (fInterruptPending) 770 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 771 } 749 772 750 773 /* DMA pending */ … … 903 926 * Clear all pending interrupts and DMA operations. 904 927 */ 905 VM_FF_CLEAR(pVM, VM_FF_INTERRUPT_APIC); 906 VM_FF_CLEAR(pVM, VM_FF_INTERRUPT_PIC); 928 for (unsigned idCpu=0;idCpu<pVM->cCPUs;idCpu++) 929 { 930 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 931 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 932 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 933 } 907 934 VM_FF_CLEAR(pVM, VM_FF_PDM_DMA); 908 935 -
trunk/src/VBox/VMM/PDMDevMiscHlp.cpp
r18927 r19141 48 48 PDMDEV_ASSERT_DEVINS(pDevIns); 49 49 PVM pVM = pDevIns->Internal.s.pVMR3; 50 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 51 50 52 LogFlow(("pdmR3PicHlp_SetInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT_PIC %d -> 1\n", 51 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pVM, 0, VM_FF_INTERRUPT_PIC))); 52 53 /* for PIC we always deliver to CPU 0, MP use APIC */ 54 VMCPU_FF_SET(pVM, 0, VM_FF_INTERRUPT_PIC); 55 REMR3NotifyInterruptSet(pVM, VMMGetCpu(pVM)); 53 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 54 55 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 56 REMR3NotifyInterruptSet(pVM, pVCpu); 56 57 VMR3NotifyFF(pVM, true); /** @todo SMP: notify the right cpu. */ 57 58 } … … 62 63 { 63 64 PDMDEV_ASSERT_DEVINS(pDevIns); 65 PVM pVM = pDevIns->Internal.s.pVMR3; 66 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 67 64 68 LogFlow(("pdmR3PicHlp_ClearInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT_PIC %d -> 0\n", 65 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMR3, 0, VM_FF_INTERRUPT_PIC))); 66 67 /* for PIC we always deliver to CPU 0, MP use APIC */ 68 VMCPU_FF_CLEAR(pDevIns->Internal.s.pVMR3, 0, VM_FF_INTERRUPT_PIC); 69 REMR3NotifyInterruptClear(pDevIns->Internal.s.pVMR3, VMMGetCpu(pDevIns->Internal.s.pVMR3)); 69 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 70 71 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 72 REMR3NotifyInterruptClear(pVM, pVCpu); 70 73 } 71 74 … … 146 149 PDMDEV_ASSERT_DEVINS(pDevIns); 147 150 PVM pVM = pDevIns->Internal.s.pVMR3; 151 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 152 153 AssertReturnVoid(idCpu < pVM->cCPUs); 154 148 155 LogFlow(("pdmR3ApicHlp_SetInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT(%d) %d -> 1\n", 149 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, idCpu, VMCPU_FF_ISSET(pV M, idCpu, VM_FF_INTERRUPT_APIC)));150 151 VMCPU_FF_SET(pV M, idCpu, VM_FF_INTERRUPT_APIC);152 REMR3NotifyInterruptSet(pVM, VMMGetCpu(pVM));156 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, idCpu, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); 157 158 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC); 159 REMR3NotifyInterruptSet(pVM, pVCpu); 153 160 VMR3NotifyFF(pVM, true); /** @todo SMP: notify the right cpu. */ 154 161 } … … 159 166 { 160 167 PDMDEV_ASSERT_DEVINS(pDevIns); 168 PVM pVM = pDevIns->Internal.s.pVMR3; 169 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 170 171 AssertReturnVoid(idCpu < pVM->cCPUs); 172 161 173 LogFlow(("pdmR3ApicHlp_ClearInterruptFF: caller='%s'/%d: VM_FF_INTERRUPT(%d) %d -> 0\n", 162 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, idCpu, VMCPU_FF_ISSET(p DevIns->Internal.s.pVMR3, idCpu, VM_FF_INTERRUPT_APIC)));163 164 VMCPU_FF_CLEAR(p DevIns->Internal.s.pVMR3, idCpu, VM_FF_INTERRUPT_APIC);165 REMR3NotifyInterruptClear(p DevIns->Internal.s.pVMR3, VMMGetCpu(pDevIns->Internal.s.pVMR3));174 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, idCpu, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); 175 176 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 177 REMR3NotifyInterruptClear(pVM, pVCpu); 166 178 } 167 179 -
trunk/src/VBox/VMM/PGM.cpp
r19077 r19141 611 611 /** Saved state data unit version for 2.5.x and later. */ 612 612 #define PGM_SAVED_STATE_VERSION 9 613 /** Saved state data unit version for 2.2.2 and later. */ 614 #define PGM_SAVED_STATE_VERSION_2_2_2 8 613 615 /** Saved state data unit version for 2.2.0. */ 614 616 #define PGM_SAVED_STATE_VERSION_RR_DESC 7 … … 2173 2175 * Clear the FFs PGM owns. 2174 2176 */ 2175 VM _FF_CLEAR(pVM, VM_FF_PGM_SYNC_CR3);2176 VM _FF_CLEAR(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL);2177 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 2178 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 2177 2179 } 2178 2180 … … 3009 3011 */ 3010 3012 if ( u32Version != PGM_SAVED_STATE_VERSION 3013 && u32Version != PGM_SAVED_STATE_VERSION_2_2_2 3011 3014 && u32Version != PGM_SAVED_STATE_VERSION_RR_DESC 3012 3015 && u32Version != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE) … … 3036 3039 { 3037 3040 PVMCPU pVCpu = &pVM->aCpus[i]; 3038 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL);3039 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);3041 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 3042 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 3040 3043 3041 3044 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; … … 3887 3890 * Always flag the necessary updates 3888 3891 */ 3889 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);3892 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 3890 3893 3891 3894 /* … … 4086 4089 pVCpu->pgm.s.enmShadowMode = PGMMODE_INVALID; 4087 4090 int rc = PGMR3ChangeMode(pVM, pVCpu, PGMGetGuestMode(pVCpu)); 4088 Assert(VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));4091 Assert(VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 4089 4092 AssertRCReturn(rc, rc); 4090 4093 AssertRCSuccessReturn(rc, VERR_IPE_UNEXPECTED_INFO_STATUS); … … 4849 4852 static DECLCALLBACK(int) pgmR3CmdSync(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult) 4850 4853 { 4854 /** @todo SMP support */ 4855 PVMCPU pVCpu = &pVM->aCpus[0]; 4856 4851 4857 /* 4852 4858 * Validate input. … … 4858 4864 * Force page directory sync. 4859 4865 */ 4860 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);4866 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 4861 4867 4862 4868 int rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Forcing page directory sync.\n"); … … 4933 4939 { 4934 4940 ASMAtomicOrU32(&pVCpu->pgm.s.fSyncFlags, PGM_SYNC_ALWAYS); 4935 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);4941 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 4936 4942 return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Enabled permanent forced page directory syncing.\n"); 4937 4943 } -
trunk/src/VBox/VMM/PGMBth.h
r18992 r19141 174 174 { 175 175 Log(("Bth-Enter: PGM pool flushed -> signal sync cr3\n")); 176 Assert(VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));176 Assert(VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 177 177 return VINF_PGM_SYNC_CR3; 178 178 } -
trunk/src/VBox/VMM/PGMHandler.cpp
r18986 r19141 394 394 395 395 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; 396 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);396 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 397 397 } 398 398 pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL; … … 480 480 481 481 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; 482 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);482 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 483 483 } 484 484 pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL; -
trunk/src/VBox/VMM/PGMMap.cpp
r18992 r19141 214 214 } 215 215 216 VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3); 216 for (unsigned i=0;i<pVM->cCPUs;i++) 217 { 218 PVMCPU pVCpu = &pVM->aCpus[i]; 219 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 220 } 217 221 return VINF_SUCCESS; 218 222 } … … 267 271 MMHyperFree(pVM, pCur); 268 272 269 VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3); 273 for (unsigned i=0;i<pVM->cCPUs;i++) 274 { 275 PVMCPU pVCpu = &pVM->aCpus[i]; 276 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 277 } 270 278 return VINF_SUCCESS; 271 279 } … … 649 657 PVMCPU pVCpu = &pVM->aCpus[i]; 650 658 pVCpu->pgm.s.fSyncFlags &= ~PGM_SYNC_MONITOR_CR3; 651 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);659 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 652 660 } 653 661 return VINF_SUCCESS; … … 684 692 685 693 pVCpu->pgm.s.fSyncFlags &= ~PGM_SYNC_MONITOR_CR3; 686 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);694 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 687 695 } 688 696 return VINF_SUCCESS; … … 712 720 PVMCPU pVCpu = &pVM->aCpus[i]; 713 721 714 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);722 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 715 723 } 716 724 return VINF_SUCCESS; -
trunk/src/VBox/VMM/PGMPool.cpp
r18927 r19141 128 128 int pgmR3PoolInit(PVM pVM) 129 129 { 130 AssertCompile(NIL_PGMPOOL_IDX == 0); 131 130 132 /* 131 133 * Query Pool config. -
trunk/src/VBox/VMM/SELM.cpp
r18988 r19141 223 223 * Default action when entering raw mode for the first time 224 224 */ 225 VM_FF_SET(pVM, VM_FF_SELM_SYNC_TSS); 226 VM_FF_SET(pVM, VM_FF_SELM_SYNC_GDT); 227 VM_FF_SET(pVM, VM_FF_SELM_SYNC_LDT); 225 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies on VCPU */ 226 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 227 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 228 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 228 229 229 230 /* … … 579 580 * Default action when entering raw mode for the first time 580 581 */ 581 VM_FF_SET(pVM, VM_FF_SELM_SYNC_TSS); 582 VM_FF_SET(pVM, VM_FF_SELM_SYNC_GDT); 583 VM_FF_SET(pVM, VM_FF_SELM_SYNC_LDT); 582 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies on VCPU */ 583 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 584 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 585 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 584 586 } 585 587 … … 651 653 #endif 652 654 653 VM_FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS); 654 VM_FF_CLEAR(pVM, VM_FF_SELM_SYNC_GDT); 655 VM_FF_CLEAR(pVM, VM_FF_SELM_SYNC_LDT); 655 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies on VCPU */ 656 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 657 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 658 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 656 659 657 660 pVM->selm.s.fDisableMonitoring = true; … … 774 777 if (PGMGetGuestMode(pVCpu) != PGMMODE_REAL) 775 778 { 776 VM _FF_SET(pVM, VM_FF_SELM_SYNC_GDT);777 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);778 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);779 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 780 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 781 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 779 782 SELMR3UpdateFromCPUM(pVM, pVCpu); 780 783 } … … 783 786 * Flag everything for resync on next raw mode entry. 784 787 */ 785 VM _FF_SET(pVM, VM_FF_SELM_SYNC_GDT);786 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);787 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);788 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 789 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 790 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 788 791 789 792 return VINF_SUCCESS; … … 804 807 if (pVM->selm.s.fDisableMonitoring) 805 808 { 806 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_GDT);807 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_LDT);808 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS);809 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 810 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 811 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 809 812 810 813 return VINF_SUCCESS; … … 816 819 * GDT sync 817 820 */ 818 if (VM _FF_ISSET(pVM, VM_FF_SELM_SYNC_GDT))821 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_SELM_SYNC_GDT)) 819 822 { 820 823 /* 821 824 * Always assume the best 822 825 */ 823 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_GDT);826 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 824 827 825 828 /* If the GDT was changed, then make sure the LDT is checked too */ 826 829 /** @todo only do this if the actual ldtr selector was changed; this is a bit excessive */ 827 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);830 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 828 831 /* Same goes for the TSS selector */ 829 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);832 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 830 833 831 834 /* … … 1074 1077 * TSS sync 1075 1078 */ 1076 if (VM _FF_ISSET(pVM, VM_FF_SELM_SYNC_TSS))1079 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_SELM_SYNC_TSS)) 1077 1080 { 1078 1081 SELMR3SyncTSS(pVM, pVCpu); … … 1082 1085 * LDT sync 1083 1086 */ 1084 if (VM _FF_ISSET(pVM, VM_FF_SELM_SYNC_LDT))1087 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_SELM_SYNC_LDT)) 1085 1088 { 1086 1089 /* 1087 1090 * Always assume the best 1088 1091 */ 1089 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_LDT);1092 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 1090 1093 1091 1094 /* … … 1368 1371 Assert(enmAccessType == PGMACCESSTYPE_WRITE); 1369 1372 Log(("selmR3GuestGDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); 1370 VM_FF_SET(pVM, VM_FF_SELM_SYNC_GDT); 1371 1373 1374 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_SELM_SYNC_GDT); 1372 1375 return VINF_PGM_HANDLER_DO_DEFAULT; 1373 1376 } … … 1394 1397 Assert(enmAccessType == PGMACCESSTYPE_WRITE); 1395 1398 Log(("selmR3GuestLDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); 1396 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);1399 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_SELM_SYNC_LDT); 1397 1400 return VINF_PGM_HANDLER_DO_DEFAULT; 1398 1401 } … … 1425 1428 * changes while we're in REM. */ 1426 1429 1427 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);1430 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_SELM_SYNC_TSS); 1428 1431 1429 1432 return VINF_PGM_HANDLER_DO_DEFAULT; … … 1449 1452 if (pVM->selm.s.fDisableMonitoring) 1450 1453 { 1451 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS);1454 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 1452 1455 return VINF_SUCCESS; 1453 1456 } 1454 1457 1455 1458 STAM_PROFILE_START(&pVM->selm.s.StatTSSSync, a); 1456 Assert(VM _FF_ISSET(pVM, VM_FF_SELM_SYNC_TSS));1459 Assert(VMCPU_FF_ISSET(pVCpu, VMCPU_FF_SELM_SYNC_TSS)); 1457 1460 1458 1461 /* … … 1632 1635 } 1633 1636 1634 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS);1637 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 1635 1638 1636 1639 STAM_PROFILE_STOP(&pVM->selm.s.StatTSSSync, a); … … 1789 1792 PVMCPU pVCpu = VMMGetCpu(pVM); 1790 1793 1791 if (VM _FF_ISSET(pVM, VM_FF_SELM_SYNC_TSS))1794 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_SELM_SYNC_TSS)) 1792 1795 return true; 1793 1796 -
trunk/src/VBox/VMM/TRPM.cpp
r19015 r19141 564 564 * Default action when entering raw mode for the first time 565 565 */ 566 VM_FF_SET(pVM, VM_FF_TRPM_SYNC_IDT); 566 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies on VCPU */ 567 VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 567 568 return 0; 568 569 } … … 753 754 * Default action when entering raw mode for the first time 754 755 */ 755 VM_FF_SET(pVM, VM_FF_TRPM_SYNC_IDT); 756 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies on VCPU */ 757 VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 756 758 } 757 759 … … 787 789 } 788 790 SSMR3PutBool(pSSM, pTrpm->fDisableMonitoring); 789 SSMR3PutUInt(pSSM, VM_FF_ISSET(pVM, VM_FF_TRPM_SYNC_IDT)); 791 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies 1 VCPU */ 792 SSMR3PutUInt(pSSM, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT)); 790 793 SSMR3PutMem(pSSM, &pTrpm->au32IdtPatched[0], sizeof(pTrpm->au32IdtPatched)); 791 794 SSMR3PutU32(pSSM, ~0); /* separator. */ … … 886 889 } 887 890 if (fSyncIDT) 888 VM_FF_SET(pVM, VM_FF_TRPM_SYNC_IDT); 891 { 892 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies 1 VCPU */ 893 VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 894 } 889 895 /* else: cleared by reset call above. */ 890 896 … … 938 944 /** 939 945 * Check if gate handlers were updated 940 * (callback for the VM _FF_TRPM_SYNC_IDT forced action).946 * (callback for the VMCPU_FF_TRPM_SYNC_IDT forced action). 941 947 * 942 948 * @returns VBox status code. … … 952 958 if (pVM->trpm.s.fDisableMonitoring) 953 959 { 954 VM _FF_CLEAR(pVM, VM_FF_TRPM_SYNC_IDT);960 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 955 961 return VINF_SUCCESS; /* Nothing to do */ 956 962 } … … 1040 1046 * Clear the FF and we're done. 1041 1047 */ 1042 VM _FF_CLEAR(pVM, VM_FF_TRPM_SYNC_IDT);1048 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 1043 1049 STAM_PROFILE_STOP(&pVM->trpm.s.StatSyncIDT, a); 1044 1050 return VINF_SUCCESS; … … 1078 1084 #endif 1079 1085 1080 VM_FF_CLEAR(pVM, VM_FF_TRPM_SYNC_IDT); 1086 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies on VCPU */ 1087 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 1081 1088 1082 1089 pVM->trpm.s.fDisableMonitoring = true; … … 1104 1111 Assert(enmAccessType == PGMACCESSTYPE_WRITE); 1105 1112 Log(("trpmR3GuestIDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); 1106 VM _FF_SET(pVM, VM_FF_TRPM_SYNC_IDT);1113 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TRPM_SYNC_IDT); 1107 1114 return VINF_PGM_HANDLER_DO_DEFAULT; 1108 1115 } … … 1432 1439 pCtx = CPUMQueryGuestCtxPtr(pVCpu); 1433 1440 Assert(!PATMIsPatchGCAddr(pVM, (RTGCPTR)pCtx->eip)); 1434 Assert(!VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS));1441 Assert(!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)); 1435 1442 1436 1443 /* Currently only useful for external hardware interrupts. */ … … 1447 1454 1448 1455 uint8_t u8Interrupt; 1449 rc = PDMGetInterrupt(pV M, &u8Interrupt);1456 rc = PDMGetInterrupt(pVCpu, &u8Interrupt); 1450 1457 Log(("TRPMR3InjectEvent: u8Interrupt=%d (%#x) rc=%Rrc\n", u8Interrupt, u8Interrupt, rc)); 1451 1458 if (RT_SUCCESS(rc)) … … 1475 1482 if (rc == VINF_SUCCESS /* Don't use RT_SUCCESS */) 1476 1483 { 1477 Assert(!VM _FF_ISPENDING(pVM, VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_TSS));1484 Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_TSS)); 1478 1485 1479 1486 STAM_COUNTER_INC(&pVM->trpm.s.paStatForwardedIRQR3[u8Interrupt]); … … 1492 1499 { 1493 1500 uint8_t u8Interrupt; 1494 rc = PDMGetInterrupt(pV M, &u8Interrupt);1501 rc = PDMGetInterrupt(pVCpu, &u8Interrupt); 1495 1502 Log(("TRPMR3InjectEvent: u8Interrupt=%d (%#x) rc=%Rrc\n", u8Interrupt, u8Interrupt, rc)); 1496 1503 if (RT_SUCCESS(rc)) -
trunk/src/VBox/VMM/VM.cpp
r19102 r19141 1172 1172 } 1173 1173 1174 1174 /* 1175 1175 * Request the operation in EMT. 1176 1176 */ … … 1706 1706 */ 1707 1707 ASMAtomicUoWriteBool(&pVM->pUVM->vm.s.fTerminateEMT, true); 1708 ASMAtomicWriteU32(&pVM->f ForcedActions, VM_FF_TERMINATE);1708 ASMAtomicWriteU32(&pVM->fGlobalForcedActions, VM_FF_TERMINATE); 1709 1709 LogFlow(("vmR3Destroy: returning %Rrc\n", VINF_EM_TERMINATE)); 1710 1710 return VINF_EM_TERMINATE; -
trunk/src/VBox/VMM/VMEmt.cpp
r19032 r19141 344 344 * @param pUVM Pointer to the user mode VM structure. 345 345 */ 346 static DECLCALLBACK(int) vmR3HaltOldDoHalt(PUVM pUVM, const uint32_t fMask, uint64_t /* u64Now*/)346 static DECLCALLBACK(int) vmR3HaltOldDoHalt(PUVM pUVM, PVMCPU pVCpu, const uint32_t fMask, uint64_t /* u64Now*/) 347 347 { 348 348 /* … … 363 363 TMR3TimerQueuesDo(pVM); 364 364 STAM_REL_PROFILE_STOP(&pUVM->vm.s.StatHaltTimers, b); 365 if (VM_FF_ISPENDING(pVM, fMask)) 365 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 366 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 366 367 break; 367 368 uint64_t u64NanoTS = TMVirtualToNano(pVM, TMTimerPoll(pVM)); 368 if (VM_FF_ISPENDING(pVM, fMask)) 369 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 370 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 369 371 break; 370 372 … … 498 500 * the lag has been eliminated. 499 501 */ 500 static DECLCALLBACK(int) vmR3HaltMethod1Halt(PUVM pUVM, const uint32_t fMask, uint64_t u64Now)502 static DECLCALLBACK(int) vmR3HaltMethod1Halt(PUVM pUVM, PVMCPU pVCpu, const uint32_t fMask, uint64_t u64Now) 501 503 { 502 504 PVM pVM = pUVM->pVM; … … 557 559 TMR3TimerQueuesDo(pVM); 558 560 STAM_REL_PROFILE_STOP(&pUVM->vm.s.StatHaltTimers, b); 559 if (VM_FF_ISPENDING(pVM, fMask)) 561 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 562 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 560 563 break; 561 564 … … 564 567 */ 565 568 uint64_t u64NanoTS = TMVirtualToNano(pVM, TMTimerPoll(pVM)); 566 if (VM_FF_ISPENDING(pVM, fMask)) 569 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 570 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 567 571 break; 568 572 … … 653 657 * try take care of the global scheduling of EMT threads. 654 658 */ 655 static DECLCALLBACK(int) vmR3HaltGlobal1Halt(PUVM pUVM, const uint32_t fMask, uint64_t u64Now)659 static DECLCALLBACK(int) vmR3HaltGlobal1Halt(PUVM pUVM, PVMCPU pVCpu, const uint32_t fMask, uint64_t u64Now) 656 660 { 657 661 PVM pVM = pUVM->pVM; … … 671 675 TMR3TimerQueuesDo(pVM); 672 676 STAM_REL_PROFILE_STOP(&pUVM->vm.s.StatHaltTimers, b); 673 if (VM_FF_ISPENDING(pVM, fMask)) 677 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 678 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 674 679 break; 675 680 … … 679 684 uint64_t u64Delta; 680 685 uint64_t u64GipTime = TMTimerPollGIP(pVM, &u64Delta); 681 if (VM_FF_ISPENDING(pVM, fMask)) 686 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 687 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 682 688 break; 683 689 … … 688 694 { 689 695 VMMR3YieldStop(pVM); 690 if (VM_FF_ISPENDING(pVM, fMask)) 691 break; 696 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 697 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 698 break; 692 699 693 700 //RTLogRelPrintf("u64NanoTS=%RI64 cLoops=%3d sleep %02dms (%7RU64) ", u64NanoTS, cLoops, cMilliSecs, u64NanoTS); … … 734 741 ASMAtomicWriteBool(&pUVM->vm.s.fWait, true); 735 742 736 PVM pVM = pUVM->pVM; 743 PVM pVM = pUVM->pVM; 744 PVMCPU pVCpu = VMMGetCpu(pVM); 745 737 746 int rc = VINF_SUCCESS; 738 747 for (;;) … … 741 750 * Check Relevant FFs. 742 751 */ 743 if (VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_SUSPENDED_MASK)) 752 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_SUSPENDED_MASK) 753 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_EXTERNAL_SUSPENDED_MASK)) 744 754 break; 745 755 … … 804 814 break; 805 815 if ( pUVM->pVM 806 && VM_FF_ISPENDING(pUVM->pVM, VM_FF_EXTERNAL_SUSPENDED_MASK)) 816 && ( VM_FF_ISPENDING(pUVM->pVM, VM_FF_EXTERNAL_SUSPENDED_MASK) 817 || VMCPU_FF_ISPENDING(VMMGetCpu(pUVM->pVM), VMCPU_FF_EXTERNAL_SUSPENDED_MASK) 818 ) 819 ) 807 820 break; 808 821 if (pUVM->vm.s.fTerminateEMT) … … 859 872 ASMAtomicWriteBool(&pUVM->vm.s.fWait, true); 860 873 861 PVM pVM = pUVM->pVM; 862 int rc = VINF_SUCCESS; 874 PVM pVM = pUVM->pVM; 875 PVMCPU pVCpu = VMMGetCpu(pVM); 876 int rc = VINF_SUCCESS; 863 877 for (;;) 864 878 { … … 866 880 * Check Relevant FFs. 867 881 */ 868 if (VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_SUSPENDED_MASK)) 882 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_SUSPENDED_MASK) 883 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_EXTERNAL_SUSPENDED_MASK)) 869 884 break; 870 885 … … 923 938 DECLR3CALLBACKMEMBER(void, pfnTerm,(PUVM pUVM)); 924 939 /** The halt function. */ 925 DECLR3CALLBACKMEMBER(int, pfnHalt,(PUVM pUVM, const uint32_t fMask, uint64_t u64Now));940 DECLR3CALLBACKMEMBER(int, pfnHalt,(PUVM pUVM, PVMCPU pVCpu, const uint32_t fMask, uint64_t u64Now)); 926 941 /** The wait function. */ 927 942 DECLR3CALLBACKMEMBER(int, pfnWait,(PUVM pUVM)); … … 980 995 * case an appropriate status code is returned. 981 996 * @param pVM VM handle. 997 * @param pVCpu VMCPU handle. 982 998 * @param fIgnoreInterrupts If set the VM_FF_INTERRUPT flags is ignored. 983 999 * @thread The emulation thread. 984 1000 */ 985 VMMR3DECL(int) VMR3WaitHalted(PVM pVM, bool fIgnoreInterrupts) 986 { 987 PVMCPU pVCpu = VMMGetCpu(pVM); /* @todo SMP: get rid of this */ 988 1001 VMMR3DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts) 1002 { 989 1003 LogFlow(("VMR3WaitHalted: fIgnoreInterrupts=%d\n", fIgnoreInterrupts)); 990 1004 … … 993 1007 */ 994 1008 const uint32_t fMask = !fIgnoreInterrupts 995 ? VM_FF_EXTERNAL_HALTED_MASK 996 : VM_FF_EXTERNAL_HALTED_MASK & ~(VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC); 997 if (VM_FF_ISPENDING(pVM, fMask)) 998 { 999 LogFlow(("VMR3WaitHalted: returns VINF_SUCCESS (FF %#x)\n", pVM->fForcedActions)); 1009 ? VMCPU_FF_EXTERNAL_HALTED_MASK 1010 : VMCPU_FF_EXTERNAL_HALTED_MASK & ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC); 1011 if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK) 1012 || VMCPU_FF_ISPENDING(pVCpu, fMask)) 1013 { 1014 LogFlow(("VMR3WaitHalted: returns VINF_SUCCESS (FF %#x FFCPU %#x)\n", pVM->fGlobalForcedActions, pVCpu->fLocalForcedActions)); 1000 1015 return VINF_SUCCESS; 1001 1016 } … … 1034 1049 * Do the halt. 1035 1050 */ 1036 int rc = g_aHaltMethods[pUVM->vm.s.iHaltMethod].pfnHalt(pUVM, fMask, u64Now);1051 int rc = g_aHaltMethods[pUVM->vm.s.iHaltMethod].pfnHalt(pUVM, pVCpu, fMask, u64Now); 1037 1052 1038 1053 /* … … 1042 1057 VMMR3YieldResume(pVM); 1043 1058 1044 LogFlow(("VMR3WaitHalted: returns %Rrc (FF %#x)\n", rc, pVM->f ForcedActions));1059 LogFlow(("VMR3WaitHalted: returns %Rrc (FF %#x)\n", rc, pVM->fGlobalForcedActions)); 1045 1060 return rc; 1046 1061 } … … 1064 1079 * Check Relevant FFs. 1065 1080 */ 1066 PVM pVM = pUVM->pVM; 1081 PVM pVM = pUVM->pVM; 1082 1067 1083 if ( pVM 1068 && VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_SUSPENDED_MASK)) 1069 { 1070 LogFlow(("VMR3Wait: returns VINF_SUCCESS (FF %#x)\n", pVM->fForcedActions)); 1084 && ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_SUSPENDED_MASK) 1085 || VMCPU_FF_ISPENDING(VMMGetCpu(pVM), VMCPU_FF_EXTERNAL_SUSPENDED_MASK) 1086 ) 1087 ) 1088 { 1089 LogFlow(("VMR3Wait: returns VINF_SUCCESS (FF %#x)\n", pVM->fGlobalForcedActions)); 1071 1090 return VINF_SUCCESS; 1072 1091 } … … 1077 1096 */ 1078 1097 int rc = g_aHaltMethods[pUVM->vm.s.iHaltMethod].pfnWait(pUVM); 1079 LogFlow(("VMR3WaitU: returns %Rrc (FF %#x)\n", rc, pVM ? pVM->f ForcedActions : 0));1098 LogFlow(("VMR3WaitU: returns %Rrc (FF %#x)\n", rc, pVM ? pVM->fGlobalForcedActions : 0)); 1080 1099 return rc; 1081 1100 } -
trunk/src/VBox/VMM/VMM.cpp
r18927 r19141 1518 1518 static DECLCALLBACK(void) vmmR3InfoFF(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs) 1519 1519 { 1520 const uint32_t fForcedActions = pVM->fForcedActions; 1521 1522 pHlp->pfnPrintf(pHlp, "Forced action Flags: %#RX32", fForcedActions); 1520 const uint32_t fGlobalForcedActions = pVM->fGlobalForcedActions; 1521 1522 pHlp->pfnPrintf(pHlp, "Forced action Flags: %#RX32", fGlobalForcedActions); 1523 for (unsigned i=0;i<pVM->cCPUs;i++) 1524 { 1525 PVMCPU pVCpu = &pVM->aCpus[i]; 1526 1527 pHlp->pfnPrintf(pHlp, "CPU %d: Forced action Flags: %#RX32", pVCpu->fLocalForcedActions); 1528 } 1523 1529 1524 1530 /* show the flag mnemonics */ 1525 1531 int c = 0; 1526 uint32_t f = f ForcedActions;1532 uint32_t f = fGlobalForcedActions; 1527 1533 #define PRINT_FLAG(flag) do { \ 1528 1534 if (f & (flag)) \ … … 1537 1543 } \ 1538 1544 } while (0) 1539 PRINT_FLAG(VM_FF_INTERRUPT_APIC);1540 PRINT_FLAG(VM_FF_INTERRUPT_PIC);1541 1545 PRINT_FLAG(VM_FF_TIMER); 1542 1546 PRINT_FLAG(VM_FF_PDM_QUEUES); … … 1547 1551 PRINT_FLAG(VM_FF_TERMINATE); 1548 1552 PRINT_FLAG(VM_FF_RESET); 1549 PRINT_FLAG(VM_FF_PGM_SYNC_CR3);1550 PRINT_FLAG(VM_FF_PGM_SYNC_CR3_NON_GLOBAL);1551 1553 PRINT_FLAG(VM_FF_PGM_NEED_HANDY_PAGES); 1552 1554 PRINT_FLAG(VM_FF_PGM_NO_MEMORY); 1553 PRINT_FLAG(VM_FF_TRPM_SYNC_IDT);1554 PRINT_FLAG(VM_FF_SELM_SYNC_TSS);1555 PRINT_FLAG(VM_FF_SELM_SYNC_GDT);1556 PRINT_FLAG(VM_FF_SELM_SYNC_LDT);1557 PRINT_FLAG(VM_FF_INHIBIT_INTERRUPTS);1558 PRINT_FLAG(VM_FF_CSAM_SCAN_PAGE);1559 PRINT_FLAG(VM_FF_CSAM_PENDING_ACTION);1560 PRINT_FLAG(VM_FF_TO_R3);1561 1555 PRINT_FLAG(VM_FF_REM_HANDLER_NOTIFY); 1562 1556 PRINT_FLAG(VM_FF_DEBUG_SUSPEND); 1557 for (unsigned i=0;i<pVM->cCPUs;i++) 1558 { 1559 PVMCPU pVCpu = &pVM->aCpus[i]; 1560 1561 f = pVCpu->fLocalForcedActions; 1562 #define PRINT_CPU_FLAG(flag) do { \ 1563 if (f & (flag)) \ 1564 { \ 1565 static const char *s_psz = #flag; \ 1566 if (!(c % 6)) \ 1567 pHlp->pfnPrintf(pHlp, "CPU %d: %s\n %s", i, c ? "," : "", s_psz + 6); \ 1568 else \ 1569 pHlp->pfnPrintf(pHlp, ", %s", s_psz + 6); \ 1570 c++; \ 1571 f &= ~(flag); \ 1572 } \ 1573 } while (0) 1574 1575 PRINT_CPU_FLAG(VMCPU_FF_INTERRUPT_APIC); 1576 PRINT_CPU_FLAG(VMCPU_FF_INTERRUPT_PIC); 1577 PRINT_CPU_FLAG(VMCPU_FF_PGM_SYNC_CR3); 1578 PRINT_CPU_FLAG(VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 1579 PRINT_CPU_FLAG(VMCPU_FF_TRPM_SYNC_IDT); 1580 PRINT_CPU_FLAG(VMCPU_FF_SELM_SYNC_TSS); 1581 PRINT_CPU_FLAG(VMCPU_FF_SELM_SYNC_GDT); 1582 PRINT_CPU_FLAG(VMCPU_FF_SELM_SYNC_LDT); 1583 PRINT_CPU_FLAG(VMCPU_FF_INHIBIT_INTERRUPTS); 1584 PRINT_CPU_FLAG(VMCPU_FF_CSAM_SCAN_PAGE); 1585 PRINT_CPU_FLAG(VMCPU_FF_CSAM_PENDING_ACTION); 1586 PRINT_CPU_FLAG(VMCPU_FF_TO_R3); 1587 } 1588 1563 1589 if (f) 1564 1590 pHlp->pfnPrintf(pHlp, "%s\n Unknown bits: %#RX32\n", c ? "," : "", f); … … 1566 1592 pHlp->pfnPrintf(pHlp, "\n"); 1567 1593 #undef PRINT_FLAG 1594 #undef PRINT_CPU_FLAG 1568 1595 1569 1596 /* the groups */ 1570 1597 c = 0; 1571 1598 #define PRINT_GROUP(grp) do { \ 1572 if (f ForcedActions & (grp)) \1599 if (fGlobalForcedActions & (grp)) \ 1573 1600 { \ 1574 1601 static const char *s_psz = #grp; \ … … 1587 1614 PRINT_GROUP(VM_FF_NORMAL_PRIORITY_POST_MASK); 1588 1615 PRINT_GROUP(VM_FF_NORMAL_PRIORITY_MASK); 1589 PRINT_GROUP(VM_FF_RESUME_GUEST_MASK);1590 1616 PRINT_GROUP(VM_FF_ALL_BUT_RAW_MASK); 1591 1617 if (c) -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r19076 r19141 2147 2147 { 2148 2148 Log(("emInterpretMovCRx: CR4: %#RX64->%#RX64 => R3\n", oldval, val)); 2149 VM _FF_SET(pVM, VM_FF_TO_R3);2149 VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3); 2150 2150 } 2151 2151 # endif 2152 2152 if ((val ^ oldval) & X86_CR4_VME) 2153 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);2153 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 2154 2154 2155 2155 rc2 = PGMChangeMode(pVCpu, CPUMGetGuestCR0(pVCpu), CPUMGetGuestCR4(pVCpu), CPUMGetGuestEFER(pVCpu)); … … 2523 2523 2524 2524 pVCpu->em.s.GCPtrInhibitInterrupts = pRegFrame->eip + pDISState->opsize; 2525 VM _FF_SET(pVM, VM_FF_INHIBIT_INTERRUPTS);2525 VMCPU_FF_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 2526 2526 2527 2527 return VINF_SUCCESS; … … 3307 3307 * Sets the PC for which interrupts should be inhibited. 3308 3308 * 3309 * @param pVM The VM handle.3310 3309 * @param pVCpu The VMCPU handle. 3311 3310 * @param PC The PC. 3312 3311 */ 3313 VMMDECL(void) EMSetInhibitInterruptsPC(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR PC)3312 VMMDECL(void) EMSetInhibitInterruptsPC(PVMCPU pVCpu, RTGCUINTPTR PC) 3314 3313 { 3315 3314 pVCpu->em.s.GCPtrInhibitInterrupts = PC; 3316 VM _FF_SET(pVM, VM_FF_INHIBIT_INTERRUPTS);3315 VMCPU_FF_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 3317 3316 } 3318 3317 … … 3328 3327 * 3329 3328 * @returns The PC for which interrupts should be inhibited. 3330 * @param pVM VM handle.3331 3329 * @param pVCpu The VMCPU handle. 3332 3330 * 3333 3331 */ 3334 VMMDECL(RTGCUINTPTR) EMGetInhibitInterruptsPC(PVM pVM, PVMCPU pVCpu)3332 VMMDECL(RTGCUINTPTR) EMGetInhibitInterruptsPC(PVMCPU pVCpu) 3335 3333 { 3336 3334 return pVCpu->em.s.GCPtrInhibitInterrupts; -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r18992 r19141 1868 1868 1869 1869 #ifdef VBOX_STRICT 1870 if (!VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))1870 if (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 1871 1871 { 1872 1872 uint32_t cb = pRange->cb; -
trunk/src/VBox/VMM/VMMAll/PDMAll.cpp
r13832 r19141 40 40 * 41 41 * @returns VBox status code. 42 * @param pV M VMhandle.42 * @param pVCpu VMCPU handle. 43 43 * @param pu8Interrupt Where to store the interrupt on success. 44 44 */ 45 VMMDECL(int) PDMGetInterrupt(PVM pVM, uint8_t *pu8Interrupt) 46 { 45 VMMDECL(int) PDMGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Interrupt) 46 { 47 PVM pVM = pVCpu->CTX_SUFF(pVM); 48 47 49 pdmLock(pVM); 48 50 … … 50 52 * The local APIC has a higer priority than the PIC. 51 53 */ 52 if (VM _FF_ISSET(pVM, VM_FF_INTERRUPT_APIC))53 { 54 VM _FF_CLEAR(pVM, VM_FF_INTERRUPT_APIC);54 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC)) 55 { 56 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 55 57 Assert(pVM->pdm.s.Apic.CTX_SUFF(pDevIns)); 56 58 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnGetInterrupt)); … … 68 70 * Check the PIC. 69 71 */ 70 if (VM _FF_ISSET(pVM, VM_FF_INTERRUPT_PIC))71 { 72 VM _FF_CLEAR(pVM, VM_FF_INTERRUPT_PIC);72 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC)) 73 { 74 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 73 75 Assert(pVM->pdm.s.Pic.CTX_SUFF(pDevIns)); 74 76 Assert(pVM->pdm.s.Pic.CTX_SUFF(pfnGetInterrupt)); -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
r18532 r19141 203 203 pVM->pdm.s.apQueuedCritSectsLeaves[i] = MMHyperCCToR3(pVM, pCritSect); 204 204 VM_FF_SET(pVM, VM_FF_PDM_CRITSECT); 205 VM _FF_SET(pVM, VM_FF_TO_R3);205 VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3); 206 206 STAM_REL_COUNTER_INC(&pVM->pdm.s.StatQueuedCritSectLeaves); 207 207 STAM_REL_COUNTER_INC(&pCritSect->s.StatContentionRZUnlock); -
trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
r13832 r19141 123 123 else */ 124 124 { 125 VM _FF_SET(pVM, VM_FF_TO_R3);126 Log2(("PDMQueueInsertEx: Setting VM _FF_TO_R3\n"));125 VMCPU_FF_SET(VMMGetCpu0(pVM), VMCPU_FF_TO_R3); 126 Log2(("PDMQueueInsertEx: Setting VMCPU_FF_TO_R3\n")); 127 127 } 128 128 #endif -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r18992 r19141 710 710 { 711 711 LogFlow(("PGMGCInvalidatePage: Conflict!\n")); 712 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);712 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 713 713 STAM_COUNTER_INC(&pVM->pgm.s.StatRCInvlPgConflict); 714 714 return VINF_PGM_SYNC_CR3; … … 1611 1611 */ 1612 1612 /** @todo optimize this, it shouldn't always be necessary. */ 1613 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL);1613 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 1614 1614 if (fGlobal) 1615 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);1615 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 1616 1616 LogFlow(("PGMFlushTLB: cr3=%RX64 OldCr3=%RX64 fGlobal=%d\n", cr3, pVCpu->pgm.s.GCPhysCR3, fGlobal)); 1617 1617 … … 1651 1651 { 1652 1652 AssertMsg(rc == VINF_PGM_SYNC_CR3, ("%Rrc\n", rc)); 1653 Assert(VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_PGM_SYNC_CR3));1653 Assert(VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_PGM_SYNC_CR3)); 1654 1654 pVCpu->pgm.s.GCPhysCR3 = GCPhysOldCR3; 1655 1655 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_MAP_CR3; … … 1771 1771 { 1772 1772 Assert((cr0 & (X86_CR0_PG | X86_CR0_PE)) != (X86_CR0_PG | X86_CR0_PE)); 1773 VM _FF_CLEAR(pVM, VM_FF_PGM_SYNC_CR3);1774 VM _FF_CLEAR(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL);1773 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 1774 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 1775 1775 return VINF_SUCCESS; 1776 1776 } … … 1780 1780 fGlobal = true; 1781 1781 LogFlow(("PGMSyncCR3: cr0=%RX64 cr3=%RX64 cr4=%RX64 fGlobal=%d[%d,%d]\n", cr0, cr3, cr4, fGlobal, 1782 VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3), VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL)));1782 VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3), VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))); 1783 1783 1784 1784 #ifdef PGMPOOL_WITH_MONITORING … … 1847 1847 if (!(pVCpu->pgm.s.fSyncFlags & PGM_SYNC_ALWAYS)) 1848 1848 { 1849 VM _FF_CLEAR(pVM, VM_FF_PGM_SYNC_CR3);1850 VM _FF_CLEAR(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL);1849 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 1850 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 1851 1851 } 1852 1852 -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r19015 r19141 265 265 } 266 266 Log(("SyncPT: %d failed!! rc=%d\n", iPDSrc, rc)); 267 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */267 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */ 268 268 STAM_PROFILE_STOP(&pVCpu->pgm.s.StatRZTrap0eTimeSyncPT, f); 269 269 return VINF_PGM_SYNC_CR3; … … 299 299 STAM_COUNTER_INC(&pVCpu->pgm.s.StatRZTrap0eConflicts); 300 300 Log(("Trap0e: Detected Conflict %RGv-%RGv\n", pMapping->GCPtr, pMapping->GCPtrLast)); 301 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3); /** @todo no need to do global sync,right? */301 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); /** @todo no need to do global sync,right? */ 302 302 STAM_PROFILE_STOP(&pVCpu->pgm.s.StatRZTrap0eTimeMapping, a); 303 303 return VINF_PGM_SYNC_CR3; … … 973 973 AssertMsg(rc == VERR_PAGE_DIRECTORY_PTR_NOT_PRESENT || rc == VERR_PAGE_MAP_LEVEL4_NOT_PRESENT, ("Unexpected rc=%Rrc\n", rc)); 974 974 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,InvalidatePageSkipped)); 975 if (!VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))975 if (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 976 976 PGM_INVL_GUEST_TLBS(); 977 977 return VINF_SUCCESS; … … 985 985 { 986 986 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,InvalidatePageSkipped)); 987 if (!VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))987 if (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 988 988 PGM_INVL_GUEST_TLBS(); 989 989 return VINF_SUCCESS; … … 1042 1042 */ 1043 1043 # ifdef PGM_SKIP_GLOBAL_PAGEDIRS_ON_NONGLOBAL_FLUSH 1044 if ( VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3)1045 || ( VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL)1044 if ( VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3) 1045 || ( VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL) 1046 1046 && fIsBigPage 1047 1047 && PdeSrc.b.u1Global … … 2531 2531 else if (rc == VERR_PGM_POOL_FLUSHED) 2532 2532 { 2533 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);2533 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 2534 2534 # if defined(IN_RC) 2535 2535 PGMDynUnlockHCPage(pVM, (uint8_t *)pPdeDst); … … 3276 3276 PVM pVM = pVCpu->CTX_SUFF(pVM); 3277 3277 3278 if (VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))3278 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 3279 3279 fGlobal = true; /* Change this CR3 reload to be a global one. */ 3280 3280 … … 4298 4298 */ 4299 4299 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 4300 Assert(VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3_NON_GLOBAL) || VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));4300 Assert(VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL) || VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 4301 4301 # endif 4302 4302 rc = pgmMapActivateCR3(pVM, pNewShwPageCR3); -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r19092 r19141 291 291 REMR3NotifyFF(pVM); 292 292 #else 293 VM _FF_SET(pVM, VM_FF_TO_R3); /* paranoia */293 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TO_R3); /* paranoia */ 294 294 #endif 295 295 } … … 307 307 { 308 308 Log(("PGM: VM_FF_TO_R3 - cHandyPages=%u out of %u\n", pVM->pgm.s.cHandyPages, RT_ELEMENTS(pVM->pgm.s.aHandyPages))); 309 VM _FF_SET(pVM, VM_FF_TO_R3);309 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TO_R3); 310 310 } 311 311 #endif -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r19024 r19141 329 329 { 330 330 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 331 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);331 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 332 332 LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShwPdpt=%#x iShw=%#x!\n", iShwPdpt, iShw+i)); 333 333 break; … … 357 357 { 358 358 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 359 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);359 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 360 360 LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShwPdpt=%#x iShw2=%#x!\n", iShwPdpt, iShw2)); 361 361 break; … … 437 437 { 438 438 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 439 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);439 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 440 440 STAM_COUNTER_INC(&(pVCpu->pgm.s.StatRZGuestCR3WriteConflict)); 441 441 LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShw=%#x!\n", iShw)); … … 471 471 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 472 472 STAM_COUNTER_INC(&(pVCpu->pgm.s.StatRZGuestCR3WriteConflict)); 473 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);473 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 474 474 LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShw2=%#x!\n", iShw2)); 475 475 break; … … 494 494 #if 0 /* useful when running PGMAssertCR3(), a bit too troublesome for general use (TLBs). */ 495 495 if ( uShw.pPD->a[iShw].n.u1Present 496 && !VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))496 && !VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 497 497 { 498 498 LogFlow(("pgmPoolMonitorChainChanging: iShw=%#x: %RX32 -> freeing it!\n", iShw, uShw.pPD->a[iShw].u)); … … 515 515 { 516 516 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 517 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);517 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 518 518 STAM_COUNTER_INC(&(pVCpu->pgm.s.StatRZGuestCR3WriteConflict)); 519 519 LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShw=%#x!\n", iShw)); … … 553 553 { 554 554 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 555 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);555 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 556 556 STAM_COUNTER_INC(&(pVCpu->pgm.s.StatRZGuestCR3WriteConflict)); 557 557 LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShw2=%#x!\n", iShw2)); … … 594 594 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 595 595 STAM_COUNTER_INC(&(pVCpu->pgm.s.StatRZGuestCR3WriteConflict)); 596 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);596 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 597 597 LogFlow(("pgmPoolMonitorChainChanging: Detected pdpt conflict at iShw=%#x!\n", iShw)); 598 598 break; … … 626 626 Assert(pgmMapAreMappingsEnabled(&pVM->pgm.s)); 627 627 STAM_COUNTER_INC(&(pVCpu->pgm.s.StatRZGuestCR3WriteConflict)); 628 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);628 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 629 629 LogFlow(("pgmPoolMonitorChainChanging: Detected conflict at iShw2=%#x!\n", iShw2)); 630 630 break; … … 692 692 * - messing with the bits of pd pointers without changing the physical address 693 693 */ 694 if (!VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))694 if (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 695 695 { 696 696 uShw.pv = PGMPOOL_PAGE_2_LOCKED_PTR(pVM, pPage); … … 725 725 * - messing with the bits of pd pointers without changing the physical address 726 726 */ 727 if (!VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3))727 if (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 728 728 { 729 729 uShw.pv = PGMPOOL_PAGE_2_LOCKED_PTR(pVM, pPage); … … 1722 1722 * the heap size should suffice. */ 1723 1723 AssertFatalRC(rc); 1724 Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));1724 Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3)); 1725 1725 } 1726 1726 pPage->fMonitored = true; … … 1819 1819 rc = PGMHandlerPhysicalDeregister(pVM, pPage->GCPhys & ~(RTGCPHYS)(PAGE_SIZE - 1)); 1820 1820 AssertFatalRC(rc); 1821 AssertMsg(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3),1822 ("%#x %#x\n", pVM->pgm.s.fGlobalSyncFlags, pVM->f ForcedActions));1821 AssertMsg(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3), 1822 ("%#x %#x\n", pVM->pgm.s.fGlobalSyncFlags, pVM->fGlobalForcedActions)); 1823 1823 } 1824 1824 pPage->fMonitored = false; … … 2081 2081 # else /* !IN_RING3 */ 2082 2082 LogFlow(("SyncCR3: PGM_GLOBAL_SYNC_CLEAR_PGM_POOL is set -> VINF_PGM_SYNC_CR3\n")); 2083 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */2083 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */ 2084 2084 return VINF_PGM_SYNC_CR3; 2085 2085 # endif /* !IN_RING3 */ … … 2713 2713 if (rc == VINF_PGM_GCPHYS_ALIASED) 2714 2714 { 2715 Assert(pVM->cCPUs == 1); /* @todo check */ 2715 2716 pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL; 2716 VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3); 2717 for (unsigned i=0;i<pVM->cCPUs;i++) 2718 { 2719 PVMCPU pVCpu = &pVM->aCpus[i]; 2720 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 2721 } 2717 2722 rc = VINF_PGM_SYNC_CR3; 2718 2723 } … … 3771 3776 #endif /* PGMPOOL_WITH_USER_TRACKING */ 3772 3777 #ifdef IN_RING3 3773 3774 /**3775 * Flushes all the special root pages as part of a pgmPoolFlushAllInt operation.3776 *3777 * @param pPool The pool.3778 */3779 static void pgmPoolFlushAllSpecialRoots(PPGMPOOL pPool)3780 {3781 /*3782 * These special pages are all mapped into the indexes 1..PGMPOOL_IDX_FIRST.3783 */3784 Assert(NIL_PGMPOOL_IDX == 0);3785 3786 /*3787 * Paranoia (to be removed), flag a global CR3 sync.3788 */3789 VM_FF_SET(pPool->CTX_SUFF(pVM), VM_FF_PGM_SYNC_CR3);3790 }3791 3792 3793 3778 /** 3794 3779 * Flushes the entire cache. … … 3823 3808 /** @todo Need to synchronize this across all VCPUs! */ 3824 3809 Assert(pVM->cCPUs == 1); 3825 PVMCPU pVCpu = &pVM->aCpus[0]; /* to get it compiled... */ 3826 pgmR3ExitShadowModeBeforePoolFlush(pVM, pVCpu); 3810 for (unsigned i=0;i<pVM->cCPUs;i++) 3811 { 3812 PVMCPU pVCpu = &pVM->aCpus[i]; 3813 pgmR3ExitShadowModeBeforePoolFlush(pVM, pVCpu); 3814 } 3827 3815 3828 3816 /* … … 3929 3917 3930 3918 /* 3931 * Flush all the special root pages.3932 3919 * Reinsert active pages into the hash and ensure monitoring chains are correct. 3933 3920 */ 3934 pgmPoolFlushAllSpecialRoots(pPool);3935 3921 for (unsigned i = PGMPOOL_IDX_FIRST_SPECIAL; i < PGMPOOL_IDX_FIRST; i++) 3936 3922 { … … 3966 3952 } 3967 3953 3968 /* 3969 * Re-enter the shadowing mode and assert Sync CR3 FF. 3970 */ 3971 pgmR3ReEnterShadowModeAfterPoolFlush(pVM, pVCpu); 3972 VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3); 3954 for (unsigned i=0;i<pVM->cCPUs;i++) 3955 { 3956 PVMCPU pVCpu = &pVM->aCpus[i]; 3957 /* 3958 * Re-enter the shadowing mode and assert Sync CR3 FF. 3959 */ 3960 pgmR3ReEnterShadowModeAfterPoolFlush(pVM, pVCpu); 3961 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 3962 } 3973 3963 3974 3964 STAM_PROFILE_STOP(&pPool->StatFlushAllInt, a); -
trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
r19032 r19141 96 96 uint64_t u64 = pVM->tm.s.CTX_SUFF(pfnVirtualGetRaw)(&pVM->tm.s.CTX_SUFF(VirtualGetRawData)); 97 97 if (cPrevSteps != pVM->tm.s.CTX_SUFF(VirtualGetRawData).c1nsSteps) 98 VM _FF_SET(pVM, VM_FF_TO_R3); /* S10 hack */98 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TO_R3); 99 99 return u64; 100 100 # endif /* !IN_RING3 */ -
trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp
r19015 r19141 410 410 eflags.u32 = CPUMRawGetEFlags(pVCpu, pRegFrame); 411 411 412 /* VM _FF_INHIBIT_INTERRUPTS should be cleared upfront or don't call this function at all for dispatching hardware interrupts. */413 Assert(enmType != TRPM_HARDWARE_INT || !VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS));412 /* VMCPU_FF_INHIBIT_INTERRUPTS should be cleared upfront or don't call this function at all for dispatching hardware interrupts. */ 413 Assert(enmType != TRPM_HARDWARE_INT || !VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)); 414 414 415 415 /* … … 434 434 435 435 Assert(PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame)); 436 Assert(!VM _FF_ISPENDING(pVM, VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_TSS));436 Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_TSS)); 437 437 438 438 /* Get the current privilege level. */ -
trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp
r19041 r19141 369 369 { 370 370 PDMDEV_ASSERT_DEVINS(pDevIns); 371 LogFlow(("pdmRCPicHlp_SetInterruptFF: caller=%p/%d: VM_FF_INTERRUPT_PIC %d -> 1\n", 372 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMRC, 0, VM_FF_INTERRUPT_PIC))); 373 /* for PIC we always deliver to CPU 0, MP use APIC */ 374 VMCPU_FF_SET(pDevIns->Internal.s.pVMRC, 0, VM_FF_INTERRUPT_PIC); 371 PVM pVM = pDevIns->Internal.s.pVMRC; 372 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 373 374 LogFlow(("pdmRCPicHlp_SetInterruptFF: caller=%p/%d: VMMCPU_FF_INTERRUPT_PIC %d -> 1\n", 375 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 376 377 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 375 378 } 376 379 … … 380 383 { 381 384 PDMDEV_ASSERT_DEVINS(pDevIns); 382 LogFlow(("pdmRCPicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT_PIC %d -> 0\n", 383 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMRC, 0, VM_FF_INTERRUPT_PIC))); 384 /* for PIC we always deliver to CPU 0, MP use APIC */ 385 VMCPU_FF_CLEAR(pDevIns->Internal.s.pVMRC, 0, VM_FF_INTERRUPT_PIC); 385 PVM pVM = pDevIns->Internal.s.CTX_SUFF(pVM); 386 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 387 388 LogFlow(("pdmRCPicHlp_ClearInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 0\n", 389 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 390 391 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 386 392 } 387 393 … … 409 415 { 410 416 PDMDEV_ASSERT_DEVINS(pDevIns); 417 PVM pVM = pDevIns->Internal.s.pVMRC; 418 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 419 420 AssertReturnVoid(idCpu < pVM->cCPUs); 421 411 422 LogFlow(("pdmRCApicHlp_SetInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 1\n", 412 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(p DevIns->Internal.s.pVMRC, idCpu, VM_FF_INTERRUPT_APIC)));413 VMCPU_FF_SET(p DevIns->Internal.s.pVMRC, idCpu, VM_FF_INTERRUPT_APIC);423 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); 424 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC); 414 425 } 415 426 … … 419 430 { 420 431 PDMDEV_ASSERT_DEVINS(pDevIns); 432 PVM pVM = pDevIns->Internal.s.pVMRC; 433 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 434 435 AssertReturnVoid(idCpu < pVM->cCPUs); 436 421 437 LogFlow(("pdmRCApicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 0\n", 422 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(p DevIns->Internal.s.pVMRC, idCpu, VM_FF_INTERRUPT_APIC)));423 VMCPU_FF_CLEAR(p DevIns->Internal.s.pVMRC, idCpu, VM_FF_INTERRUPT_APIC);438 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); 439 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 424 440 } 425 441 -
trunk/src/VBox/VMM/VMMGC/SELMGC.cpp
r18992 r19141 139 139 if (Sel == CPUMGetGuestLDTR(pVCpu)) /** @todo this isn't correct in two(+) ways! 1. It shouldn't be done until the LDTR is reloaded. 2. It caused the next instruction to be emulated. */ 140 140 { 141 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);141 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 142 142 return VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT; 143 143 } … … 229 229 { 230 230 /* Not necessary when we need to go back to the host context to sync the LDT or TSS. */ 231 VM _FF_SET(pVM, VM_FF_SELM_SYNC_GDT);231 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 232 232 } 233 233 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestGDTUnhandled); … … 253 253 ////LogCom(("selmRCGuestLDTWriteHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange)); 254 254 255 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);255 VMCPU_FF_SET(VMMGetCpu0(pVM), VMCPU_FF_SELM_SYNC_LDT); 256 256 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestLDT); 257 257 return VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT; … … 368 368 { 369 369 Log(("TSS offIoBitmap changed: old=%#x new=%#x -> resync in ring-3\n", pVM->selm.s.offGuestIoBitmap, offIoBitmap)); 370 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);371 VM _FF_SET(pVM, VM_FF_TO_R3);370 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 371 VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3); 372 372 } 373 373 else … … 401 401 if (rc != VINF_SUCCESS) 402 402 { 403 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);404 VM _FF_SET(pVM, VM_FF_TO_R3);403 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 404 VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3); 405 405 if (RT_SUCCESS(rc)) 406 406 rc = VINF_SUCCESS; … … 412 412 { 413 413 Assert(RT_FAILURE(rc)); 414 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);414 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 415 415 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestTSSUnhandled); 416 416 if (rc == VERR_EM_INTERPRETER) -
trunk/src/VBox/VMM/VMMGC/TRPMGC.cpp
r19015 r19141 150 150 151 151 /** @todo Check which IDT entry and keep the update cost low in TRPMR3SyncIDT() and CSAMCheckGates(). */ 152 VM _FF_SET(pVM, VM_FF_TRPM_SYNC_IDT);152 VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 153 153 154 154 STAM_COUNTER_INC(&pVM->trpm.s.StatRCWriteGuestIDTFault); -
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
r19032 r19141 166 166 167 167 /* Clear pending inhibit interrupt state if required. (necessary for dispatching interrupts later on) */ 168 if (VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))169 { 170 Log2(("VM_FF_INHIBIT_INTERRUPTS at %08RX32 successor %RGv\n", pRegFrame->eip, EMGetInhibitInterruptsPC(pV M, pVCpu)));171 if (pRegFrame->eip != EMGetInhibitInterruptsPC(pV M, pVCpu))168 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 169 { 170 Log2(("VM_FF_INHIBIT_INTERRUPTS at %08RX32 successor %RGv\n", pRegFrame->eip, EMGetInhibitInterruptsPC(pVCpu))); 171 if (pRegFrame->eip != EMGetInhibitInterruptsPC(pVCpu)) 172 172 { 173 173 /** @note we intentionally don't clear VM_FF_INHIBIT_INTERRUPTS here if the eip is the same as the inhibited instr address. … … 176 176 * break the guest. Sounds very unlikely, but such timing sensitive problem are not as rare as you might think. 177 177 */ 178 VM _FF_CLEAR(pVM, VM_FF_INHIBIT_INTERRUPTS);178 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 179 179 } 180 180 } … … 185 185 */ 186 186 if ( rc == VINF_SUCCESS 187 && VM_FF_ISPENDING(pVM, VM_FF_TO_R3 | VM_FF_TIMER | VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_REQUEST 188 | VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_PGM_NO_MEMORY)) 187 && ( VM_FF_ISPENDING(pVM, VM_FF_TIMER | VM_FF_REQUEST | VM_FF_PGM_NO_MEMORY) 188 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TO_R3 | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_REQUEST | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL) 189 ) 190 ) 189 191 { 190 192 /* The out of memory condition naturally outrang the others. */ … … 192 194 rc = VINF_EM_NO_MEMORY; 193 195 /* Pending Ring-3 action. */ 194 else if (VM _FF_ISPENDING(pVM, VM_FF_TO_R3))195 { 196 VM _FF_CLEAR(pVM, VM_FF_TO_R3);196 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_TO_R3)) 197 { 198 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3); 197 199 rc = VINF_EM_RAW_TO_R3; 198 200 } … … 201 203 rc = VINF_EM_RAW_TIMER_PENDING; 202 204 /* Pending interrupt: dispatch it. */ 203 else if ( VM _FF_ISPENDING(pVM, VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC)204 && !VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS)205 else if ( VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC) 206 && !VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) 205 207 && PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame) 206 208 ) 207 209 { 208 210 uint8_t u8Interrupt; 209 rc = PDMGetInterrupt(pV M, &u8Interrupt);211 rc = PDMGetInterrupt(pVCpu, &u8Interrupt); 210 212 Log(("trpmGCExitTrap: u8Interrupt=%d (%#x) rc=%Rrc\n", u8Interrupt, u8Interrupt, rc)); 211 213 AssertFatalMsgRC(rc, ("PDMGetInterrupt failed with %Rrc\n", rc)); … … 227 229 * Try sync CR3? 228 230 */ 229 else if (VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL))231 else if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)) 230 232 #if 1 231 rc = PGMSyncCR3(pVCpu, CPUMGetGuestCR0(pVCpu), CPUMGetGuestCR3(pVCpu), CPUMGetGuestCR4(pVCpu), VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));233 rc = PGMSyncCR3(pVCpu, CPUMGetGuestCR0(pVCpu), CPUMGetGuestCR3(pVCpu), CPUMGetGuestCR4(pVCpu), VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 232 234 #else 233 235 rc = VINF_PGM_SYNC_CR3; 234 236 #endif 235 237 /* Pending request packets might contain actions that need immediate attention, such as pending hardware interrupts. */ 236 else if (VM_FF_ISPENDING(pVM, VM_FF_REQUEST)) 238 else if ( VM_FF_ISPENDING(pVM, VM_FF_REQUEST) 239 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST)) 237 240 rc = VINF_EM_PENDING_REQUEST; 238 241 } -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r19123 r19141 1058 1058 #endif 1059 1059 1060 Assert(!VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL));1060 Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)); 1061 1061 Assert(HWACCMR0Globals.aCpuInfo[idCpu].fConfigured); 1062 1062 AssertReturn(!ASMAtomicReadBool(&HWACCMR0Globals.fSuspended), VERR_HWACCM_SUSPEND_PENDING); -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r19123 r19141 375 375 { 376 376 Log(("INJ-EI: %x at %RGv\n", pEvent->n.u8Vector, (RTGCPTR)pCtx->rip)); 377 Assert(!VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS));377 Assert(!VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_INHIBIT_INTERRUPTS)); 378 378 Assert(pCtx->eflags.u32 & X86_EFL_IF); 379 379 } … … 428 428 /* When external interrupts are pending, we should exit the VM when IF is set. */ 429 429 if ( !TRPMHasTrap(pVCpu) 430 && VM _FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)))430 && VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC))) 431 431 { 432 432 if ( !(pCtx->eflags.u32 & X86_EFL_IF) 433 || VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))433 || VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 434 434 { 435 435 if (!pVMCB->ctrl.IntCtrl.n.u1VIrqValid) 436 436 { 437 if (!VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))437 if (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 438 438 LogFlow(("Enable irq window exit!\n")); 439 439 else … … 450 450 uint8_t u8Interrupt; 451 451 452 rc = PDMGetInterrupt(pV M, &u8Interrupt);452 rc = PDMGetInterrupt(pVCpu, &u8Interrupt); 453 453 Log(("Dispatch interrupt: u8Interrupt=%x (%d) rc=%Rrc\n", u8Interrupt, u8Interrupt, rc)); 454 454 if (RT_SUCCESS(rc)) … … 460 460 { 461 461 /* Can only happen in rare cases where a pending interrupt is cleared behind our back */ 462 Assert(!VM _FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)));462 Assert(!VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC))); 463 463 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchGuestIrq); 464 464 /* Just continue */ … … 477 477 478 478 if ( pCtx->eflags.u32 & X86_EFL_IF 479 && (!VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))479 && (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 480 480 && TRPMHasTrap(pVCpu) 481 481 ) … … 678 678 { 679 679 pVMCB->guest.u64CR3 = PGMGetHyperCR3(pVCpu); 680 Assert(pVMCB->guest.u64CR3 || VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL));680 Assert(pVMCB->guest.u64CR3 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)); 681 681 } 682 682 } … … 867 867 868 868 /* Check for irq inhibition due to instruction fusing (sti, mov ss). */ 869 if (VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))870 { 871 Log(("VM_FF_INHIBIT_INTERRUPTS at %RGv successor %RGv\n", (RTGCPTR)pCtx->rip, EMGetInhibitInterruptsPC(pV M, pVCpu)));872 if (pCtx->rip != EMGetInhibitInterruptsPC(pV M, pVCpu))869 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 870 { 871 Log(("VM_FF_INHIBIT_INTERRUPTS at %RGv successor %RGv\n", (RTGCPTR)pCtx->rip, EMGetInhibitInterruptsPC(pVCpu))); 872 if (pCtx->rip != EMGetInhibitInterruptsPC(pVCpu)) 873 873 { 874 874 /* Note: we intentionally don't clear VM_FF_INHIBIT_INTERRUPTS here. … … 877 877 * break the guest. Sounds very unlikely, but such timing sensitive problems are not as rare as you might think. 878 878 */ 879 VM _FF_CLEAR(pVM, VM_FF_INHIBIT_INTERRUPTS);879 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 880 880 /* Irq inhibition is no longer active; clear the corresponding SVM state. */ 881 881 pVMCB->ctrl.u64IntShadow = 0; … … 894 894 #endif 895 895 { 896 if (VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)) 897 { 898 VM_FF_CLEAR(pVM, VM_FF_TO_R3); 896 if ( VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK) 897 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK)) 898 { 899 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3); 899 900 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3); 900 901 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x); … … 1245 1246 { 1246 1247 Log(("uInterruptState %x rip=%RGv\n", pVMCB->ctrl.u64IntShadow, (RTGCPTR)pCtx->rip)); 1247 EMSetInhibitInterruptsPC(pV M, pVCpu, pCtx->rip);1248 EMSetInhibitInterruptsPC(pVCpu, pCtx->rip); 1248 1249 } 1249 1250 else 1250 VM _FF_CLEAR(pVM, VM_FF_INHIBIT_INTERRUPTS);1251 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 1251 1252 1252 1253 Log2(("exitCode = %x\n", exitCode)); … … 1719 1720 /* Check if a sync operation is pending. */ 1720 1721 if ( rc == VINF_SUCCESS /* don't bother if we are going to ring 3 anyway */ 1721 && VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL))1722 { 1723 rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));1722 && VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)) 1723 { 1724 rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 1724 1725 AssertRC(rc); 1725 1726 … … 2010 2011 pCtx->rip++; /* skip hlt */ 2011 2012 if ( pCtx->eflags.Bits.u1IF 2012 && VM _FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)))2013 && VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC))) 2013 2014 goto ResumeExecution; 2014 2015 -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r19123 r19141 608 608 { 609 609 LogFlow(("INJ-EI: %x at %RGv\n", iGate, (RTGCPTR)pCtx->rip)); 610 Assert(VMX_EXIT_INTERRUPTION_INFO_TYPE(intInfo) == VMX_EXIT_INTERRUPTION_INFO_TYPE_SW || !VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS));610 Assert(VMX_EXIT_INTERRUPTION_INFO_TYPE(intInfo) == VMX_EXIT_INTERRUPTION_INFO_TYPE_SW || !VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)); 611 611 Assert(VMX_EXIT_INTERRUPTION_INFO_TYPE(intInfo) == VMX_EXIT_INTERRUPTION_INFO_TYPE_SW || pCtx->eflags.u32 & X86_EFL_IF); 612 612 } … … 737 737 /* When external interrupts are pending, we should exit the VM when IF is set. */ 738 738 if ( !TRPMHasTrap(pVCpu) 739 && VM _FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)))739 && VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC))) 740 740 { 741 741 if (!(pCtx->eflags.u32 & X86_EFL_IF)) … … 751 751 } 752 752 else 753 if (!VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))753 if (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 754 754 { 755 755 uint8_t u8Interrupt; 756 756 757 rc = PDMGetInterrupt(pV M, &u8Interrupt);757 rc = PDMGetInterrupt(pVCpu, &u8Interrupt); 758 758 Log(("Dispatch interrupt: u8Interrupt=%x (%d) rc=%Rrc cs:rip=%04X:%RGv\n", u8Interrupt, u8Interrupt, rc, pCtx->cs, (RTGCPTR)pCtx->rip)); 759 759 if (RT_SUCCESS(rc)) … … 765 765 { 766 766 /* Can only happen in rare cases where a pending interrupt is cleared behind our back */ 767 Assert(!VM _FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)));767 Assert(!VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC))); 768 768 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchGuestIrq); 769 769 /* Just continue */ … … 784 784 785 785 if ( pCtx->eflags.u32 & X86_EFL_IF 786 && (!VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))786 && (!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 787 787 && TRPMHasTrap(pVCpu) 788 788 ) … … 1526 1526 { 1527 1527 val = PGMGetHyperCR3(pVCpu); 1528 Assert(val || VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL));1528 Assert(val || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)); 1529 1529 } 1530 1530 … … 1693 1693 Assert(uInterruptState <= 2); /* only sti & mov ss */ 1694 1694 Log(("uInterruptState %x eip=%RGv\n", uInterruptState, pCtx->rip)); 1695 EMSetInhibitInterruptsPC(pV M, pVCpu, pCtx->rip);1695 EMSetInhibitInterruptsPC(pVCpu, pCtx->rip); 1696 1696 } 1697 1697 else 1698 VM _FF_CLEAR(pVM, VM_FF_INHIBIT_INTERRUPTS);1698 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 1699 1699 1700 1700 /* Control registers. */ … … 2035 2035 2036 2036 /* Check for irq inhibition due to instruction fusing (sti, mov ss). */ 2037 if (VM _FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS))2038 { 2039 Log(("VM_FF_INHIBIT_INTERRUPTS at %RGv successor %RGv\n", (RTGCPTR)pCtx->rip, EMGetInhibitInterruptsPC(pV M, pVCpu)));2040 if (pCtx->rip != EMGetInhibitInterruptsPC(pV M, pVCpu))2037 if (VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) 2038 { 2039 Log(("VM_FF_INHIBIT_INTERRUPTS at %RGv successor %RGv\n", (RTGCPTR)pCtx->rip, EMGetInhibitInterruptsPC(pVCpu))); 2040 if (pCtx->rip != EMGetInhibitInterruptsPC(pVCpu)) 2041 2041 { 2042 2042 /* Note: we intentionally don't clear VM_FF_INHIBIT_INTERRUPTS here. … … 2045 2045 * break the guest. Sounds very unlikely, but such timing sensitive problems are not as rare as you might think. 2046 2046 */ 2047 VM _FF_CLEAR(pVM, VM_FF_INHIBIT_INTERRUPTS);2047 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); 2048 2048 /* Irq inhibition is no longer active; clear the corresponding VMX state. */ 2049 2049 rc = VMXWriteVMCS(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE, 0); … … 2059 2059 2060 2060 /* Check for pending actions that force us to go back to ring 3. */ 2061 if (VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)) 2062 { 2063 VM_FF_CLEAR(pVM, VM_FF_TO_R3); 2061 if ( VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK) 2062 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK)) 2063 { 2064 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3); 2064 2065 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3); 2065 2066 rc = RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3; … … 2890 2891 case VMX_EXIT_IRQ_WINDOW: /* 7 Interrupt window. */ 2891 2892 /* Clear VM-exit on IF=1 change. */ 2892 LogFlow(("VMX_EXIT_IRQ_WINDOW %RGv pending=%d IF=%d\n", (RTGCPTR)pCtx->rip, VM _FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)), pCtx->eflags.Bits.u1IF));2893 LogFlow(("VMX_EXIT_IRQ_WINDOW %RGv pending=%d IF=%d\n", (RTGCPTR)pCtx->rip, VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC)), pCtx->eflags.Bits.u1IF)); 2893 2894 pVCpu->hwaccm.s.vmx.proc_ctls &= ~VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT; 2894 2895 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hwaccm.s.vmx.proc_ctls); … … 3028 3029 /* Check if a sync operation is pending. */ 3029 3030 if ( rc == VINF_SUCCESS /* don't bother if we are going to ring 3 anyway */ 3030 && VM _FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL))3031 && VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)) 3031 3032 { 3032 rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VM _FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));3033 rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 3033 3034 AssertRC(rc); 3034 3035 } … … 3346 3347 pCtx->rip++; /* skip hlt */ 3347 3348 if ( pCtx->eflags.Bits.u1IF 3348 && VM _FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)))3349 && VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC|VMCPU_FF_INTERRUPT_PIC))) 3349 3350 goto ResumeExecution; 3350 3351 -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r18927 r19141 384 384 { 385 385 PDMDEV_ASSERT_DEVINS(pDevIns); 386 LogFlow(("pdmR0PicHlp_SetInterruptFF: caller=%p/%d: VM_FF_INTERRUPT_PIC %d -> 1\n", 387 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMR0, 0, VM_FF_INTERRUPT_PIC))); 388 /* for PIC we always deliver to CPU 0, MP use APIC */ 389 VMCPU_FF_SET(pDevIns->Internal.s.pVMR0, 0, VM_FF_INTERRUPT_PIC); 386 PVM pVM = pDevIns->Internal.s.pVMR0; 387 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 388 389 LogFlow(("pdmR0PicHlp_SetInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 1\n", 390 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 391 392 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 390 393 } 391 394 … … 395 398 { 396 399 PDMDEV_ASSERT_DEVINS(pDevIns); 397 LogFlow(("pdmR0PicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT_PIC %d -> 0\n", 398 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pDevIns->Internal.s.pVMR0, 0, VM_FF_INTERRUPT_PIC))); 399 /* for PIC we always deliver to CPU 0, MP use APIC */ 400 VMCPU_FF_CLEAR(pDevIns->Internal.s.pVMR0, 0, VM_FF_INTERRUPT_PIC); 400 PVM pVM = pDevIns->Internal.s.pVMR0; 401 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 402 403 LogFlow(("pdmR0PicHlp_ClearInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 0\n", 404 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 405 406 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 401 407 } 402 408 … … 423 429 { 424 430 PDMDEV_ASSERT_DEVINS(pDevIns); 431 PVM pVM = pDevIns->Internal.s.pVMR0; 432 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 433 434 AssertReturnVoid(idCpu < pVM->cCPUs); 425 435 426 436 LogFlow(("pdmR0ApicHlp_SetInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 1\n", 427 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(p DevIns->Internal.s.pVMR0, idCpu, VM_FF_INTERRUPT_APIC)));428 VMCPU_FF_SET(p DevIns->Internal.s.pVMR0, idCpu, VM_FF_INTERRUPT_APIC);437 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); 438 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC); 429 439 } 430 440 … … 434 444 { 435 445 PDMDEV_ASSERT_DEVINS(pDevIns); 446 PVM pVM = pDevIns->Internal.s.pVMR0; 447 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 448 449 AssertReturnVoid(idCpu < pVM->cCPUs); 436 450 437 451 LogFlow(("pdmR0ApicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 0\n", 438 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(p DevIns->Internal.s.pVMR0, idCpu, VM_FF_INTERRUPT_APIC)));439 VMCPU_FF_CLEAR(p DevIns->Internal.s.pVMR0, idCpu, VM_FF_INTERRUPT_APIC);452 pDevIns, pDevIns->iInstance, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); 453 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 440 454 } 441 455 -
trunk/src/VBox/VMM/VMMTests.cpp
r19015 r19141 391 391 * These forced actions are not necessary for the test and trigger breakpoints too. 392 392 */ 393 VM _FF_CLEAR(pVM, VM_FF_TRPM_SYNC_IDT);394 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS);393 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 394 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 395 395 396 396 /* … … 485 485 * These forced actions are not necessary for the test and trigger breakpoints too. 486 486 */ 487 VM _FF_CLEAR(pVM, VM_FF_TRPM_SYNC_IDT);488 VM _FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS);487 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 488 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 489 489 490 490 /* Enable mapping of the hypervisor into the shadow page table. */ … … 504 504 PGMSyncCR3(pVCpu, pHyperCtx->cr0, CR3Phys, pHyperCtx->cr4, true); 505 505 506 VM _FF_CLEAR(pVM, VM_FF_TO_R3);506 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3); 507 507 VM_FF_CLEAR(pVM, VM_FF_TIMER); 508 508 VM_FF_CLEAR(pVM, VM_FF_REQUEST); … … 555 555 pGuestCtx->cr3 = CR3Phys; 556 556 557 VM _FF_CLEAR(pVM, VM_FF_TO_R3);557 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3); 558 558 VM_FF_CLEAR(pVM, VM_FF_TIMER); 559 559 -
trunk/src/VBox/VMM/VMReq.cpp
r13858 r19141 628 628 for (unsigned i=0;i<pUVM->pVM->cCPUs;i++) 629 629 { 630 PVMCPU pVCpu = &pUVM->pVM->aCpus[i]; 631 630 632 if ( !pUVMCPU 631 633 || pUVMCPU->idCpu != i) … … 646 648 */ 647 649 if (pUVM->pVM) 648 VMCPU_FF_SET(p UVM->pVM, VM_FF_REQUEST, i);650 VMCPU_FF_SET(pVCpu, VM_FF_REQUEST); 649 651 /* @todo: VMR3NotifyFFU*/ 650 652 AssertFailed(); … … 674 676 { 675 677 RTCPUID idTarget = (RTCPUID)pReq->enmDest; 678 PVMCPU pVCpu = &pUVM->pVM->aCpus[idTarget]; 676 679 unsigned fFlags = ((VMREQ volatile *)pReq)->fFlags; /* volatile paranoia */ 677 680 … … 691 694 */ 692 695 if (pUVM->pVM) 693 VMCPU_FF_SET(p UVM->pVM, VM_FF_REQUEST, idTarget);696 VMCPU_FF_SET(pVCpu, VM_FF_REQUEST); 694 697 /* @todo: VMR3NotifyFFU*/ 695 698 AssertFailed(); … … 851 854 ppReqs = (void * volatile *)&pUVM->aCpus[enmDest].vm.s.pReqs; 852 855 if (RT_LIKELY(pUVM->pVM)) 853 VMCPU_FF_CLEAR(pUVM->pVM, enmDest, VM_FF_REQUEST); 856 { 857 PVMCPU pVCpu = &pUVM->pVM->aCpus[enmDest]; 858 859 VMCPU_FF_CLEAR(pVCpu, VM_FF_REQUEST); 860 } 854 861 } 855 862 -
trunk/src/recompiler_new/VBoxREMWrapper.cpp
r19090 r19141 705 705 static const REMPARMDESC g_aArgsPDMGetInterrupt[] = 706 706 { 707 { REMPARMDESC_FLAGS_INT, sizeof(PVM ), NULL },707 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }, 708 708 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL } 709 709 }; … … 1171 1171 { "TMVirtualResume", (void *)(uintptr_t)&TMVirtualResume, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1172 1172 { "TRPMAssertTrap", (void *)(uintptr_t)&TRPMAssertTrap, &g_aArgsTRPMAssertTrap[0], RT_ELEMENTS(g_aArgsTRPMAssertTrap), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1173 { "TRPMGetErrorCode", (void *)(uintptr_t)&TRPMGetErrorCode, &g_aArgsVM [0], RT_ELEMENTS(g_aArgsVM),REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINT), NULL },1174 { "TRPMGetFaultAddress", (void *)(uintptr_t)&TRPMGetFaultAddress, &g_aArgsVM [0], RT_ELEMENTS(g_aArgsVM),REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINTPTR),NULL },1173 { "TRPMGetErrorCode", (void *)(uintptr_t)&TRPMGetErrorCode, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINT), NULL }, 1174 { "TRPMGetFaultAddress", (void *)(uintptr_t)&TRPMGetFaultAddress, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINTPTR),NULL }, 1175 1175 { "TRPMQueryTrap", (void *)(uintptr_t)&TRPMQueryTrap, &g_aArgsTRPMQueryTrap[0], RT_ELEMENTS(g_aArgsTRPMQueryTrap), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1176 { "TRPMResetTrap", (void *)(uintptr_t)&TRPMResetTrap, &g_aArgsVM [0], RT_ELEMENTS(g_aArgsVM),REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1176 { "TRPMResetTrap", (void *)(uintptr_t)&TRPMResetTrap, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1177 1177 { "TRPMSetErrorCode", (void *)(uintptr_t)&TRPMSetErrorCode, &g_aArgsTRPMSetErrorCode[0], RT_ELEMENTS(g_aArgsTRPMSetErrorCode), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1178 1178 { "TRPMSetFaultAddress", (void *)(uintptr_t)&TRPMSetFaultAddress, &g_aArgsTRPMSetFaultAddress[0], RT_ELEMENTS(g_aArgsTRPMSetFaultAddress), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, -
trunk/src/recompiler_new/VBoxRecompiler.c
r19076 r19141 1450 1450 pCtx->cr3 = env->cr[3]; 1451 1451 if ((env->cr[4] ^ pCtx->cr4) & X86_CR4_VME) 1452 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);1452 VMCPU_FF_SET(env->pVCpu, VMCPU_FF_SELM_SYNC_TSS); 1453 1453 pCtx->cr4 = env->cr[4]; 1454 1454 … … 1461 1461 { 1462 1462 AssertMsgFailed(("remR3FlushPage %RGv failed with %d!!\n", GCPtr, rc)); 1463 VM _FF_SET(pVM, VM_FF_PGM_SYNC_CR3);1463 VMCPU_FF_SET(env->pVCpu, VMCPU_FF_PGM_SYNC_CR3); 1464 1464 } 1465 1465 //RAWEx_ProfileStart(env, STATS_QEMU_TOTAL); … … 1566 1566 pCtx->cr3 = env->cr[3]; 1567 1567 if ((env->cr[4] ^ pCtx->cr4) & X86_CR4_VME) 1568 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);1568 VMCPU_FF_SET(env->pVCpu, VMCPU_FF_SELM_SYNC_TSS); 1569 1569 pCtx->cr4 = env->cr[4]; 1570 1570 … … 1606 1606 pCtx->cr3 = env->cr[3]; 1607 1607 if ((env->cr[4] ^ pCtx->cr4) & X86_CR4_VME) 1608 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);1608 VMCPU_FF_SET(env->pVCpu, VMCPU_FF_SELM_SYNC_TSS); 1609 1609 pCtx->cr4 = env->cr[4]; 1610 1610 … … 2188 2188 pVM->rem.s.Env.interrupt_request &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT | CPU_INTERRUPT_EXITTB | CPU_INTERRUPT_TIMER); 2189 2189 if ( pVM->rem.s.u32PendingInterrupt != REM_NO_PENDING_IRQ 2190 || VM _FF_ISPENDING(pVM, VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC))2190 || VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)) 2191 2191 pVM->rem.s.Env.interrupt_request |= CPU_INTERRUPT_HARD; 2192 2192 … … 2317 2317 pCtx->cr3 = pVM->rem.s.Env.cr[3]; 2318 2318 if ((pVM->rem.s.Env.cr[4] ^ pCtx->cr4) & X86_CR4_VME) 2319 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);2319 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 2320 2320 pCtx->cr4 = pVM->rem.s.Env.cr[4]; 2321 2321 … … 2328 2328 pCtx->gdtr.pGdt = pVM->rem.s.Env.gdt.base; 2329 2329 STAM_COUNTER_INC(&gStatREMGDTChange); 2330 VM _FF_SET(pVM, VM_FF_SELM_SYNC_GDT);2330 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 2331 2331 } 2332 2332 … … 2336 2336 pCtx->idtr.pIdt = pVM->rem.s.Env.idt.base; 2337 2337 STAM_COUNTER_INC(&gStatREMIDTChange); 2338 VM _FF_SET(pVM, VM_FF_TRPM_SYNC_IDT);2338 VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 2339 2339 } 2340 2340 … … 2349 2349 pCtx->ldtrHid.Attr.u = (pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF; 2350 2350 STAM_COUNTER_INC(&gStatREMLDTRChange); 2351 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);2351 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 2352 2352 } 2353 2353 … … 2371 2371 pCtx->trHid.Attr.u |= DESC_TSS_BUSY_MASK >> 8; 2372 2372 STAM_COUNTER_INC(&gStatREMTRChange); 2373 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);2373 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 2374 2374 } 2375 2375 … … 2533 2533 pCtx->cr3 = pVM->rem.s.Env.cr[3]; 2534 2534 if ((pVM->rem.s.Env.cr[4] ^ pCtx->cr4) & X86_CR4_VME) 2535 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);2535 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 2536 2536 pCtx->cr4 = pVM->rem.s.Env.cr[4]; 2537 2537 … … 2544 2544 pCtx->gdtr.pGdt = (RTGCPTR)pVM->rem.s.Env.gdt.base; 2545 2545 STAM_COUNTER_INC(&gStatREMGDTChange); 2546 VM _FF_SET(pVM, VM_FF_SELM_SYNC_GDT);2546 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 2547 2547 } 2548 2548 … … 2552 2552 pCtx->idtr.pIdt = (RTGCPTR)pVM->rem.s.Env.idt.base; 2553 2553 STAM_COUNTER_INC(&gStatREMIDTChange); 2554 VM _FF_SET(pVM, VM_FF_TRPM_SYNC_IDT);2554 VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 2555 2555 } 2556 2556 … … 2565 2565 pCtx->ldtrHid.Attr.u = (pVM->rem.s.Env.ldt.flags >> 8) & 0xFFFF; 2566 2566 STAM_COUNTER_INC(&gStatREMLDTRChange); 2567 VM _FF_SET(pVM, VM_FF_SELM_SYNC_LDT);2567 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 2568 2568 } 2569 2569 … … 2587 2587 pCtx->trHid.Attr.u |= DESC_TSS_BUSY_MASK >> 8; 2588 2588 STAM_COUNTER_INC(&gStatREMTRChange); 2589 VM _FF_SET(pVM, VM_FF_SELM_SYNC_TSS);2589 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 2590 2590 } 2591 2591 … … 4030 4030 } 4031 4031 else 4032 rc = PDMGetInterrupt(env->pV M, &u8Interrupt);4032 rc = PDMGetInterrupt(env->pVCpu, &u8Interrupt); 4033 4033 4034 4034 LogFlow(("cpu_get_pic_interrupt: u8Interrupt=%d rc=%Rrc\n", u8Interrupt, rc)); 4035 4035 if (RT_SUCCESS(rc)) 4036 4036 { 4037 if (VM _FF_ISPENDING(env->pVM, VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC))4037 if (VMCPU_FF_ISPENDING(env->pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)) 4038 4038 env->interrupt_request |= CPU_INTERRUPT_HARD; 4039 4039 return u8Interrupt;
Note:
See TracChangeset
for help on using the changeset viewer.