VirtualBox

Changeset 22975 in vbox


Ignore:
Timestamp:
Sep 13, 2009 1:15:27 AM (15 years ago)
Author:
vboxsync
Message:

VMM: State coding in progress - bed time commit.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/types.h

    r22961 r22975  
    175175     * the live save operation. */
    176176    VMSTATE_SUSPENDED_LS,
    177     /** The VM is suspended and its state is being saved by EMT(0). */
     177    /** The VM is suspended and its state is being saved by EMT(0). (See SSM) */
    178178    VMSTATE_SAVING,
     179    /** The VM is being debugged. (See DBGF.) */
     180    VMSTATE_DEBUGGING,
     181    /** Live save: The VM is being debugged while the live phase is going on. */
     182    VMSTATE_DEBUGGING_LS,
    179183    /** The VM is being powered off. */
    180184    VMSTATE_POWERING_OFF,
  • trunk/src/VBox/VMM/VM.cpp

    r22961 r22975  
    27512751        case VMSTATE_SUSPENDING_LS:     return "SUSPENDING_LS";
    27522752        case VMSTATE_SAVING:            return "SAVING";
     2753        case VMSTATE_DEBUGGING:         return "DEBUGGING";
     2754        case VMSTATE_DEBUGGING_LS:      return "DEBUGGING_LS";
    27532755        case VMSTATE_POWERING_OFF:      return "POWERING_OFF";
    27542756        case VMSTATE_POWERING_OFF_LS:   return "POWERING_OFF_LS";
     
    27702772
    27712773/**
     2774 * Validates the state tansition.
     2775 */
     2776static bool vmR3ValidateStateTransition(VMSTATE enmStateOld, VMSTATE enmStateNew)
     2777{
     2778#ifdef /*VBOX_STRICT*/ DEBUG_bird
     2779    switch (enmStateOld)
     2780    {
     2781        case VMSTATE_CREATING:
     2782            AssertMsgReturn(enmStateNew == VMSTATE_CREATED, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2783            break;
     2784
     2785        case VMSTATE_CREATED:
     2786            AssertMsgReturn(   enmStateNew == VMSTATE_LOADING
     2787                            || enmStateNew == VMSTATE_POWERING_ON
     2788                            || enmStateNew == VMSTATE_POWERING_OFF
     2789                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2790            break;
     2791
     2792        case VMSTATE_LOADING:
     2793            AssertMsgReturn(   enmStateNew == VMSTATE_SUSPENDED
     2794                            || enmStateNew == VMSTATE_LOAD_FAILURE
     2795                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2796            break;
     2797
     2798        case VMSTATE_POWERING_ON:
     2799            AssertMsgReturn(   enmStateNew == VMSTATE_RUNNING
     2800                            || enmStateNew == VMSTATE_FATAL_ERROR /*?*/
     2801                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2802            break;
     2803
     2804        case VMSTATE_RUNNING:
     2805            AssertMsgReturn(   enmStateNew == VMSTATE_POWERING_OFF
     2806                            || enmStateNew == VMSTATE_SUSPENDING
     2807                            || enmStateNew == VMSTATE_RESETTING
     2808                            || enmStateNew == VMSTATE_RUNNING_LS
     2809                            || enmStateNew == VMSTATE_DEBUGGING
     2810                            || enmStateNew == VMSTATE_FATAL_ERROR
     2811                            || enmStateNew == VMSTATE_GURU_MEDITATION
     2812                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2813            break;
     2814
     2815        case VMSTATE_RUNNING_LS:
     2816            AssertMsgReturn(   enmStateNew == VMSTATE_POWERING_OFF_LS
     2817                            || enmStateNew == VMSTATE_SUSPENDING_LS
     2818                            || enmStateNew == VMSTATE_RESETTING_LS
     2819                            || enmStateNew == VMSTATE_RUNNING
     2820                            || enmStateNew == VMSTATE_DEBUGGING_LS
     2821                            || enmStateNew == VMSTATE_FATAL_ERROR_LS
     2822                            || enmStateNew == VMSTATE_GURU_MEDITATION_LS
     2823                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2824            break;
     2825
     2826        case VMSTATE_RESETTING:
     2827            AssertMsgReturn(enmStateNew == VMSTATE_RUNNING, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2828            break;
     2829
     2830        case VMSTATE_RESETTING_LS:
     2831            AssertMsgReturn(enmStateNew == VMSTATE_RUNNING, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2832            break;
     2833
     2834        case VMSTATE_SUSPENDING:
     2835            AssertMsgReturn(enmStateNew == VMSTATE_SUSPENDED, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2836            break;
     2837
     2838        case VMSTATE_SUSPENDING_LS:
     2839            AssertMsgReturn(enmStateNew == VMSTATE_SUSPENDED_LS, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2840            break;
     2841
     2842        case VMSTATE_SUSPENDED:
     2843            AssertMsgReturn(   enmStateNew == VMSTATE_POWERING_OFF
     2844                            || enmStateNew == VMSTATE_SAVING
     2845                            || enmStateNew == VMSTATE_RESETTING
     2846                            || enmStateNew == VMSTATE_RUNNING
     2847                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2848            break;
     2849
     2850        case VMSTATE_SUSPENDED_LS:
     2851            AssertMsgReturn(   enmStateNew == VMSTATE_SUSPENDED_LS
     2852                            || enmStateNew == VMSTATE_SUSPENDED
     2853                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2854            break;
     2855
     2856        case VMSTATE_SAVING:
     2857            AssertMsgReturn(enmStateNew == VMSTATE_SUSPENDED, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2858            break;
     2859
     2860        case VMSTATE_DEBUGGING:
     2861            AssertMsgReturn(   enmStateNew == VMSTATE_RUNNING_LS
     2862                            || enmStateNew == VMSTATE_POWERING_OFF_LS
     2863                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2864            break;
     2865
     2866        case VMSTATE_POWERING_OFF:
     2867            AssertMsgReturn(enmStateNew == VMSTATE_OFF, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2868            break;
     2869
     2870        case VMSTATE_POWERING_OFF_LS:
     2871            AssertMsgReturn(enmStateNew == VMSTATE_POWERING_OFF, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2872            break;
     2873
     2874        case VMSTATE_OFF:
     2875            AssertMsgReturn(enmStateNew == VMSTATE_DESTROYING, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2876            break;
     2877
     2878        case VMSTATE_FATAL_ERROR:
     2879            AssertMsgReturn(enmStateNew == VMSTATE_POWERING_OFF, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2880            break;
     2881
     2882        case VMSTATE_FATAL_ERROR_LS:
     2883            AssertMsgReturn(enmStateNew == VMSTATE_FATAL_ERROR, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2884            break;
     2885
     2886        case VMSTATE_GURU_MEDITATION:
     2887            AssertMsgReturn(   enmStateNew == VMSTATE_DEBUGGING
     2888                            || enmStateNew == VMSTATE_POWERING_OFF
     2889                            , ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2890            break;
     2891
     2892        case VMSTATE_GURU_MEDITATION_LS:
     2893            AssertMsgReturn(enmStateNew == VMSTATE_GURU_MEDITATION, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2894            break;
     2895
     2896        case VMSTATE_LOAD_FAILURE:
     2897            AssertMsgReturn(enmStateNew == VMSTATE_POWERING_OFF, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2898            break;
     2899
     2900        case VMSTATE_DESTROYING:
     2901            AssertMsgReturn(enmStateNew == VMSTATE_TERMINATED, ("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2902            break;
     2903
     2904        case VMSTATE_TERMINATED:
     2905        default:
     2906            AssertMsgFailedReturn(("%s -> %s\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)), false);
     2907            break;
     2908    }
     2909#endif /* VBOX_STRICT */
     2910    return true;
     2911}
     2912
     2913
     2914/**
    27722915 * Sets the current VM state.
    27732916 *
     
    27862929     */
    27872930    VMSTATE enmStateOld = pVM->enmVMState;
    2788     switch (enmStateOld)
    2789     {
    2790         case VMSTATE_OFF:
    2791             Assert(enmStateNew != VMSTATE_GURU_MEDITATION);
    2792             break;
    2793 
    2794         default:
    2795             /** @todo full validation. */
    2796             break;
    2797     }
    2798 
     2931    vmR3ValidateStateTransition(enmStateOld, enmStateNew);
    27992932    pVM->enmVMState = enmStateNew;
    28002933    LogRel(("Changing the VM state from '%s' to '%s'.\n", VMR3GetStateName(enmStateOld),  VMR3GetStateName(enmStateNew)));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette