Changeset 19435 in vbox for trunk/include/VBox
- Timestamp:
- May 6, 2009 2:01:15 PM (16 years ago)
- Location:
- trunk/include/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vm.h
r19434 r19435 45 45 46 46 /** 47 * The state of a virtual CPU. 48 * 49 * The VM running states are a sub-states of the VMSTATE_RUNNING state. While 50 * VMCPUSTATE_NOT_RUNNING is a place holder for the other VM states. 47 * The state of a Virtual CPU. 48 * 49 * The basic state indicated here is whether the CPU has been started or not. In 50 * addition, there are sub-states when started for assisting scheduling (GVMM 51 * mostly). 52 * 53 * The transision out of the STOPPED state is done by a vmR3PowerOn. 54 * The transision back to the STOPPED state is done by vmR3PowerOff. 55 * 56 * (Alternatively we could let vmR3PowerOn start CPU 0 only and let the SPIP 57 * handling switch on the other CPUs. Then vmR3Reset would stop all but CPU 0.) 51 58 */ 52 59 typedef enum VMCPUSTATE … … 55 62 VMCPUSTATE_INVALID = 0, 56 63 57 /** Running guest code (VM running). */ 58 VMCPUSTATE_RUN_EXEC, 59 /** Running guest code in the recompiler (VM running). */ 60 VMCPUSTATE_RUN_EXEC_REM, 61 /** Halted (VM running). */ 62 VMCPUSTATE_RUN_HALTED, 63 /** All the other bits we do while running a VM (VM running). */ 64 VMCPUSTATE_RUN_MISC, 65 /** VM not running, we're servicing requests or whatever. */ 66 VMCPUSTATE_NOT_RUNNING, 64 /** Virtual CPU has not yet been started. */ 65 VMCPUSTATE_STOPPED, 66 67 /** CPU started. */ 68 VMCPUSTATE_STARTED, 69 /** Executing guest code and can be poked. */ 70 VMCPUSTATE_STARTED_EXEC, 71 /** Executing guest code in the recompiler. */ 72 VMCPUSTATE_STARTED_EXEC_REM, 73 /** Halted. */ 74 VMCPUSTATE_STARTED_HALTED, 75 67 76 /** The end of valid virtual CPU states. */ 68 77 VMCPUSTATE_END, … … 182 191 } VMCPU; 183 192 184 /** Pointer to a VMCPU. */ 185 #ifndef ___VBox_types_h 186 typedef struct VMCPU *PVMCPU; 187 #endif 193 194 /** @name Operations on VMCPU::enmState 195 * @{ */ 196 /** Gets the VMCPU state. */ 197 #define VMCPU_GET_STATE(pVCpu) ( (pVCpu)->enmState ) 198 /** Sets the VMCPU state. */ 199 #define VMCPU_SET_STATE(pVCpu, enmNewState) \ 200 ASMAtomicWriteU32((uint32_t volatile *)&(pVCpu)->enmState, (enmNewState)) 201 /** Checks the VMCPU state. */ 202 #define VMCPU_ASSERT_STATE(pVCpu, enmExpectedState) \ 203 do { \ 204 VMCPUSTATE enmState = VMCPU_GET_STATE(pVCpu); \ 205 AssertMsg(enmState == (enmExpectedState), \ 206 ("enmState=%d enmExpectedState=%d idCpu=%u\n", \ 207 enmState, enmExpectedState, (pVCpu)->idCpu)); \ 208 } while (0) 209 /** Tests if the state means that the CPU is started. */ 210 #define VMCPUSTATE_IS_STARTED(enmState) ( (enmState) > VMCPUSTATE_STOPPED ) 211 /** Tests if the state means that the CPU is stopped. */ 212 #define VMCPUSTATE_IS_STOPPED(enmState) ( (enmState) == VMCPUSTATE_STOPPED ) 213 /** @} */ 214 188 215 189 216 /** The name of the Guest Context VMM Core module. */ … … 450 477 # define VMCPU_IS_EMT(pVCpu) true 451 478 #else 452 # define VMCPU_IS_EMT(pVCpu) ( pVCpu && (pVCpu == VMMGetCpu(pVCpu->CTX_SUFF(pVM))))479 # define VMCPU_IS_EMT(pVCpu) ((pVCpu) && ((pVCpu) == VMMGetCpu((pVCpu)->CTX_SUFF(pVM)))) 453 480 #endif 454 481 … … 523 550 #define VM_ASSERT_STATE(pVM, _enmState) \ 524 551 AssertMsg((pVM)->enmVMState == (_enmState), \ 525 ("state %s, expected %s\n", VMGetStateName( pVM->enmVMState), VMGetStateName(_enmState)))552 ("state %s, expected %s\n", VMGetStateName((pVM)->enmVMState), VMGetStateName(_enmState))) 526 553 527 554 /** @def VM_ASSERT_STATE_RETURN … … 530 557 #define VM_ASSERT_STATE_RETURN(pVM, _enmState, rc) \ 531 558 AssertMsgReturn((pVM)->enmVMState == (_enmState), \ 532 ("state %s, expected %s\n", VMGetStateName( pVM->enmVMState), VMGetStateName(_enmState)), \559 ("state %s, expected %s\n", VMGetStateName((pVM)->enmVMState), VMGetStateName(_enmState)), \ 533 560 (rc)) 534 561 … … 900 927 } VM; 901 928 902 /** Pointer to a VM. */903 #ifndef ___VBox_types_h904 typedef struct VM *PVM;905 #endif906 907 929 908 930 #ifdef IN_RC -
trunk/include/VBox/vmapi.h
r19402 r19435 376 376 VMMR3DECL(void) VMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 377 377 VMMR3DECL(PVM) VMR3EnumVMs(PVM pVMPrev); 378 VMMR3DECL(int) VMR3WaitForResume(PVM pVM);379 378 380 379 /**
Note:
See TracChangeset
for help on using the changeset viewer.