~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to include/VBox/vm.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
     * Only valid when in RC or HWACCMR0 with scheduling disabled. */
110
110
    RTCPUID volatile        idHostCpu;
111
111
 
112
 
    /** Align the next bit on a 64-byte boundary.
 
112
    /** Align the next bit on a 64-byte boundary and make sure it starts at the same
 
113
     *  offset in both 64-bit and 32-bit builds.
113
114
     *
114
115
     * @remarks The aligments of the members that are larger than 48 bytes should be
115
116
     *          64-byte for cache line reasons. structs containing small amounts of
116
117
     *          data could be lumped together at the end with a < 64 byte padding
117
118
     *          following it (to grow into and align the struct size).
118
119
     *   */
119
 
    uint32_t                au32Alignment[HC_ARCH_BITS == 32 ? 7 : 3];
 
120
    uint8_t                 abAlignment1[HC_ARCH_BITS == 32 ? 28 : 12];
120
121
 
121
122
    /** CPUM part. */
122
123
    union
124
125
#ifdef ___CPUMInternal_h
125
126
        struct CPUMCPU      s;
126
127
#endif
127
 
        char                padding[4096];      /* multiple of 64 */
 
128
        uint8_t             padding[3456];      /* multiple of 64 */
128
129
    } cpum;
129
130
 
130
 
    /** PGM part. */
131
 
    union
132
 
    {
133
 
#ifdef ___PGMInternal_h
134
 
        struct PGMCPU       s;
135
 
#endif
136
 
        char                padding[32*1024];   /* multiple of 64 */
137
 
    } pgm;
138
 
 
139
131
    /** HWACCM part. */
140
132
    union
141
133
    {
142
134
#ifdef ___HWACCMInternal_h
143
135
        struct HWACCMCPU    s;
144
136
#endif
145
 
        char                padding[6144];      /* multiple of 64 */
 
137
        uint8_t             padding[5312];      /* multiple of 64 */
146
138
    } hwaccm;
147
139
 
148
140
    /** EM part. */
151
143
#ifdef ___EMInternal_h
152
144
        struct EMCPU        s;
153
145
#endif
154
 
        char                padding[2048];      /* multiple of 64 */
 
146
        uint8_t             padding[1408];      /* multiple of 64 */
155
147
    } em;
156
148
 
157
149
    /** TRPM part. */
160
152
#ifdef ___TRPMInternal_h
161
153
        struct TRPMCPU      s;
162
154
#endif
163
 
        char                padding[128];       /* multiple of 64 */
 
155
        uint8_t             padding[128];       /* multiple of 64 */
164
156
    } trpm;
165
157
 
166
158
    /** TM part. */
169
161
#ifdef ___TMInternal_h
170
162
        struct TMCPU        s;
171
163
#endif
172
 
        char                padding[64];        /* multiple of 64 */
 
164
        uint8_t             padding[64];        /* multiple of 64 */
173
165
    } tm;
174
166
 
175
167
    /** VMM part. */
178
170
#ifdef ___VMMInternal_h
179
171
        struct VMMCPU       s;
180
172
#endif
181
 
        char                padding[384];       /* multiple of 64 */
 
173
        uint8_t             padding[384];       /* multiple of 64 */
182
174
    } vmm;
183
175
 
184
176
    /** PDM part. */
187
179
#ifdef ___PDMInternal_h
188
180
        struct PDMCPU       s;
189
181
#endif
190
 
        char                padding[128];       /* multiple of 64 */
 
182
        uint8_t             padding[128];       /* multiple of 64 */
191
183
    } pdm;
192
184
 
193
185
    /** IOM part. */
196
188
#ifdef ___IOMInternal_h
197
189
        struct IOMCPU       s;
198
190
#endif
199
 
        char                padding[512];       /* multiple of 64 */
 
191
        uint8_t             padding[512];       /* multiple of 64 */
200
192
    } iom;
201
193
 
202
194
    /** DBGF part.
209
201
        uint8_t             padding[64];        /* multiple of 64 */
210
202
    } dbgf;
211
203
 
 
204
    /** Align the following members on page boundrary. */
 
205
    uint8_t                 abAlignment2[768];
 
206
 
 
207
    /** PGM part. */
 
208
    union
 
209
    {
 
210
#ifdef ___PGMInternal_h
 
211
        struct PGMCPU       s;
 
212
#endif
 
213
        uint8_t             padding[32*1024];   /* multiple of 4096 */
 
214
    } pgm;
 
215
 
212
216
} VMCPU;
213
217
 
214
218
 
383
387
#define VMCPU_FF_RESUME_GUEST_MASK              (VMCPU_FF_TO_R3)
384
388
 
385
389
/** VM Flags that cause the HWACCM loops to go back to ring-3. */
386
 
#define VM_FF_HWACCM_TO_R3_MASK                 (VM_FF_TM_VIRTUAL_SYNC | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY | VM_FF_PDM_QUEUES)
 
390
#define VM_FF_HWACCM_TO_R3_MASK                 (VM_FF_TM_VIRTUAL_SYNC | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY | VM_FF_PDM_QUEUES | VM_FF_EMT_RENDEZVOUS)
387
391
/** VMCPU Flags that cause the HWACCM loops to go back to ring-3. */
388
392
#define VMCPU_FF_HWACCM_TO_R3_MASK              (VMCPU_FF_TO_R3 | VMCPU_FF_TIMER)
389
393
 
596
600
              (rc))
597
601
#endif
598
602
 
 
603
/** @def VM_ASSERT_EMT0
 
604
 * Asserts that the current thread IS emulation thread \#0 (EMT0).
 
605
 */
 
606
#define VM_ASSERT_EMT0(pVM)                 VMCPU_ASSERT_EMT(&(pVM)->aCpus[0])
 
607
 
 
608
/** @def VM_ASSERT_EMT0_RETURN
 
609
 * Asserts that the current thread IS emulation thread \#0 (EMT0) and returns if
 
610
 * it isn't.
 
611
 */
 
612
#define VM_ASSERT_EMT0_RETURN(pVM, rc)      VMCPU_ASSERT_EMT_RETURN(&(pVM)->aCpus[0], (rc))
 
613
 
599
614
 
600
615
/**
601
616
 * Asserts that the current thread is NOT the emulation thread.
662
677
{
663
678
    /** The state of the VM.
664
679
     * This field is read only to everyone except the VM and EM. */
665
 
    VMSTATE                     enmVMState;
 
680
    VMSTATE volatile            enmVMState;
666
681
    /** Forced action flags.
667
682
     * See the VM_FF_* \#defines. Updated atomically.
668
683
     */
683
698
    /** The GVM VM handle. Only the GVM should modify this field. */
684
699
    uint32_t                    hSelf;
685
700
    /** Number of virtual CPUs. */
686
 
    uint32_t                    cCPUs;
 
701
    uint32_t                    cCpus;
687
702
 
688
703
    /** Size of the VM structure including the VMCPU array. */
689
704
    uint32_t                    cbSelf;
704
719
     * @param   Ctx         The guest core context.
705
720
     * @remark  Assume interrupts disabled.
706
721
     */
707
 
    RTRCPTR             pfnVMMGCGuestToHostAsmGuestCtx/*(int32_t eax, CPUMCTXCORE Ctx)*/;
 
722
    RTRCPTR                     pfnVMMGCGuestToHostAsmGuestCtx/*(int32_t eax, CPUMCTXCORE Ctx)*/;
708
723
 
709
724
    /**
710
725
     * Assembly switch entry point for returning to host context.
719
734
     * @param   ecx         Pointer to the  hypervisor core context, register.
720
735
     * @remark  Assume interrupts disabled.
721
736
     */
722
 
    RTRCPTR             pfnVMMGCGuestToHostAsmHyperCtx/*(int32_t eax, PCPUMCTXCORE ecx)*/;
 
737
    RTRCPTR                     pfnVMMGCGuestToHostAsmHyperCtx/*(int32_t eax, PCPUMCTXCORE ecx)*/;
723
738
 
724
739
    /**
725
740
     * Assembly switch entry point for returning to host context.
731
746
     * @param   eax         The return code, register.
732
747
     * @remark  Assume interrupts disabled.
733
748
     */
734
 
    RTRCPTR             pfnVMMGCGuestToHostAsm/*(int32_t eax)*/;
 
749
    RTRCPTR                     pfnVMMGCGuestToHostAsm/*(int32_t eax)*/;
735
750
    /** @} */
736
751
 
737
752
 
738
753
    /** @name Various VM data owned by VM.
739
754
     * @{ */
740
 
    RTTHREAD            uPadding1;
 
755
    RTTHREAD                    uPadding1;
741
756
    /** The native handle of ThreadEMT. Getting the native handle
742
757
     * is generally faster than getting the IPRT one (except on OS/2 :-). */
743
 
    RTNATIVETHREAD      uPadding2;
 
758
    RTNATIVETHREAD              uPadding2;
744
759
    /** @} */
745
760
 
746
761
 
747
762
    /** @name Various items that are frequently accessed.
748
763
     * @{ */
749
764
    /** Raw ring-3 indicator.  */
750
 
    bool                fRawR3Enabled;
 
765
    bool                        fRawR3Enabled;
751
766
    /** Raw ring-0 indicator. */
752
 
    bool                fRawR0Enabled;
 
767
    bool                        fRawR0Enabled;
753
768
    /** PATM enabled flag.
754
769
     * This is placed here for performance reasons. */
755
 
    bool                fPATMEnabled;
 
770
    bool                        fPATMEnabled;
756
771
    /** CSAM enabled flag.
757
772
     * This is placed here for performance reasons. */
758
 
    bool                fCSAMEnabled;
 
773
    bool                        fCSAMEnabled;
759
774
    /** Hardware VM support is available and enabled.
760
775
     * This is placed here for performance reasons. */
761
 
    bool                fHWACCMEnabled;
 
776
    bool                        fHWACCMEnabled;
762
777
    /** Hardware VM support is required and non-optional.
763
778
     * This is initialized together with the rest of the VM structure. */
764
 
    bool                fHwVirtExtForced;
 
779
    bool                        fHwVirtExtForced;
765
780
    /** PARAV enabled flag. */
766
 
    bool                fPARAVEnabled;
 
781
    bool                        fPARAVEnabled;
767
782
    /** @} */
768
783
 
769
784
 
770
785
    /* padding to make gnuc put the StatQemuToGC where msc does. */
771
786
#if HC_ARCH_BITS == 32
772
 
    uint32_t            padding0;
 
787
    uint32_t                    padding0;
773
788
#endif
774
789
 
775
790
    /** Profiling the total time from Qemu to GC. */
776
 
    STAMPROFILEADV      StatTotalQemuToGC;
 
791
    STAMPROFILEADV              StatTotalQemuToGC;
777
792
    /** Profiling the total time from GC to Qemu. */
778
 
    STAMPROFILEADV      StatTotalGCToQemu;
 
793
    STAMPROFILEADV              StatTotalGCToQemu;
779
794
    /** Profiling the total time spent in GC. */
780
 
    STAMPROFILEADV      StatTotalInGC;
 
795
    STAMPROFILEADV              StatTotalInGC;
781
796
    /** Profiling the total time spent not in Qemu. */
782
 
    STAMPROFILEADV      StatTotalInQemu;
 
797
    STAMPROFILEADV              StatTotalInQemu;
783
798
    /** Profiling the VMMSwitcher code for going to GC. */
784
 
    STAMPROFILEADV      StatSwitcherToGC;
 
799
    STAMPROFILEADV              StatSwitcherToGC;
785
800
    /** Profiling the VMMSwitcher code for going to HC. */
786
 
    STAMPROFILEADV      StatSwitcherToHC;
787
 
    STAMPROFILEADV      StatSwitcherSaveRegs;
788
 
    STAMPROFILEADV      StatSwitcherSysEnter;
789
 
    STAMPROFILEADV      StatSwitcherDebug;
790
 
    STAMPROFILEADV      StatSwitcherCR0;
791
 
    STAMPROFILEADV      StatSwitcherCR4;
792
 
    STAMPROFILEADV      StatSwitcherJmpCR3;
793
 
    STAMPROFILEADV      StatSwitcherRstrRegs;
794
 
    STAMPROFILEADV      StatSwitcherLgdt;
795
 
    STAMPROFILEADV      StatSwitcherLidt;
796
 
    STAMPROFILEADV      StatSwitcherLldt;
797
 
    STAMPROFILEADV      StatSwitcherTSS;
 
801
    STAMPROFILEADV              StatSwitcherToHC;
 
802
    STAMPROFILEADV              StatSwitcherSaveRegs;
 
803
    STAMPROFILEADV              StatSwitcherSysEnter;
 
804
    STAMPROFILEADV              StatSwitcherDebug;
 
805
    STAMPROFILEADV              StatSwitcherCR0;
 
806
    STAMPROFILEADV              StatSwitcherCR4;
 
807
    STAMPROFILEADV              StatSwitcherJmpCR3;
 
808
    STAMPROFILEADV              StatSwitcherRstrRegs;
 
809
    STAMPROFILEADV              StatSwitcherLgdt;
 
810
    STAMPROFILEADV              StatSwitcherLidt;
 
811
    STAMPROFILEADV              StatSwitcherLldt;
 
812
    STAMPROFILEADV              StatSwitcherTSS;
798
813
 
799
 
/** @todo Realign everything on 64 byte boundaries to better match the
800
 
 *        cache-line size. */
801
 
    /* padding - the unions must be aligned on 32 bytes boundraries. */
802
 
    uint32_t            padding[HC_ARCH_BITS == 32 ? 4+8 : 6];
 
814
    /** Padding - the unions must be aligned on a 64 bytes boundrary and the unions
 
815
     *  must start at the same offset on both 64-bit and 32-bit hosts. */
 
816
    uint8_t                     abAlignment1[HC_ARCH_BITS == 32 ? 48 : 24];
803
817
 
804
818
    /** CPUM part. */
805
819
    union
807
821
#ifdef ___CPUMInternal_h
808
822
        struct CPUM s;
809
823
#endif
810
 
        char        padding[2048];        /* multiple of 32 */
 
824
        uint8_t     padding[1472];      /* multiple of 64 */
811
825
    } cpum;
812
826
 
813
827
    /** VMM part. */
816
830
#ifdef ___VMMInternal_h
817
831
        struct VMM  s;
818
832
#endif
819
 
        char        padding[1600];       /* multiple of 32 */
 
833
        uint8_t     padding[1536];      /* multiple of 64 */
820
834
    } vmm;
821
835
 
822
836
    /** PGM part. */
825
839
#ifdef ___PGMInternal_h
826
840
        struct PGM  s;
827
841
#endif
828
 
        char        padding[16*1024];   /* multiple of 32 */
 
842
        uint8_t     padding[4096*2+6080];      /* multiple of 64 */
829
843
    } pgm;
830
844
 
831
845
    /** HWACCM part. */
834
848
#ifdef ___HWACCMInternal_h
835
849
        struct HWACCM s;
836
850
#endif
837
 
        char        padding[8192];       /* multiple of 32 */
 
851
        uint8_t     padding[5376];      /* multiple of 64 */
838
852
    } hwaccm;
839
853
 
840
854
    /** TRPM part. */
843
857
#ifdef ___TRPMInternal_h
844
858
        struct TRPM s;
845
859
#endif
846
 
        char        padding[5344];      /* multiple of 32 */
 
860
        uint8_t     padding[5184];      /* multiple of 64 */
847
861
    } trpm;
848
862
 
849
863
    /** SELM part. */
852
866
#ifdef ___SELMInternal_h
853
867
        struct SELM s;
854
868
#endif
855
 
        char        padding[544];      /* multiple of 32 */
 
869
        uint8_t     padding[576];       /* multiple of 64 */
856
870
    } selm;
857
871
 
858
872
    /** MM part. */
861
875
#ifdef ___MMInternal_h
862
876
        struct MM   s;
863
877
#endif
864
 
        char        padding[192];       /* multiple of 32 */
 
878
        uint8_t     padding[192];       /* multiple of 64 */
865
879
    } mm;
866
880
 
867
 
    /** CFGM part. */
868
 
    union
869
 
    {
870
 
#ifdef ___CFGMInternal_h
871
 
        struct CFGM s;
872
 
#endif
873
 
        char        padding[32];        /* multiple of 32 */
874
 
    } cfgm;
875
 
 
876
881
    /** PDM part. */
877
882
    union
878
883
    {
879
884
#ifdef ___PDMInternal_h
880
885
        struct PDM s;
881
886
#endif
882
 
        char        padding[1824];      /* multiple of 32 */
 
887
        uint8_t     padding[1600];      /* multiple of 64 */
883
888
    } pdm;
884
889
 
885
890
    /** IOM part. */
888
893
#ifdef ___IOMInternal_h
889
894
        struct IOM s;
890
895
#endif
891
 
        char        padding[4544];      /* multiple of 32 */
 
896
        uint8_t     padding[832];       /* multiple of 64 */
892
897
    } iom;
893
898
 
894
899
    /** PATM part. */
897
902
#ifdef ___PATMInternal_h
898
903
        struct PATM s;
899
904
#endif
900
 
        char        padding[768];       /* multiple of 32 */
 
905
        uint8_t     padding[768];       /* multiple of 64 */
901
906
    } patm;
902
907
 
903
908
    /** CSAM part. */
906
911
#ifdef ___CSAMInternal_h
907
912
        struct CSAM s;
908
913
#endif
909
 
        char        padding[3328];    /* multiple of 32 */
 
914
        uint8_t     padding[1088];      /* multiple of 64 */
910
915
    } csam;
911
916
 
912
 
    /** PARAV part. */
913
 
    union
914
 
    {
915
 
#ifdef ___PARAVInternal_h
916
 
        struct PARAV s;
917
 
#endif
918
 
        char        padding[128];
919
 
    } parav;
920
 
 
921
917
    /** EM part. */
922
918
    union
923
919
    {
924
920
#ifdef ___EMInternal_h
925
921
        struct EM   s;
926
922
#endif
927
 
        char        padding[256];         /* multiple of 32 */
 
923
        uint8_t     padding[256];       /* multiple of 64 */
928
924
    } em;
929
925
 
930
926
    /** TM part. */
933
929
#ifdef ___TMInternal_h
934
930
        struct TM   s;
935
931
#endif
936
 
        char        padding[2112];      /* multiple of 32 */
 
932
        uint8_t     padding[2112];      /* multiple of 64 */
937
933
    } tm;
938
934
 
939
935
    /** DBGF part. */
942
938
#ifdef ___DBGFInternal_h
943
939
        struct DBGF s;
944
940
#endif
945
 
        char        padding[2368];      /* multiple of 32 */
 
941
        uint8_t     padding[2368];      /* multiple of 64 */
946
942
    } dbgf;
947
943
 
948
944
    /** SSM part. */
951
947
#ifdef ___SSMInternal_h
952
948
        struct SSM  s;
953
949
#endif
954
 
        char        padding[32];        /* multiple of 32 */
 
950
        uint8_t     padding[128];        /* multiple of 64 */
955
951
    } ssm;
956
952
 
957
 
    /** VM part. */
958
 
    union
959
 
    {
960
 
#ifdef ___VMInternal_h
961
 
        struct VMINT    s;
962
 
#endif
963
 
        char        padding[768];       /* multiple of 32 */
964
 
    } vm;
965
 
 
966
953
    /** REM part. */
967
954
    union
968
955
    {
973
960
/** @def VM_REM_SIZE
974
961
 * Must be multiple of 32 and coherent with REM_ENV_SIZE from REMInternal.h. */
975
962
# define VM_REM_SIZE        0x11100
976
 
        char        padding[VM_REM_SIZE];   /* multiple of 32 */
 
963
        uint8_t     padding[VM_REM_SIZE];   /* multiple of 32 */
977
964
    } rem;
978
965
 
979
 
    /** Padding for aligning the cpu array on a 64 byte boundrary. */
980
 
    uint32_t    u32Reserved2[8];
 
966
    /* ---- begin small stuff ---- */
 
967
 
 
968
    /** VM part. */
 
969
    union
 
970
    {
 
971
#ifdef ___VMInternal_h
 
972
        struct VMINT s;
 
973
#endif
 
974
        uint8_t     padding[24];        /* multiple of 8 */
 
975
    } vm;
 
976
 
 
977
    /** CFGM part. */
 
978
    union
 
979
    {
 
980
#ifdef ___CFGMInternal_h
 
981
        struct CFGM s;
 
982
#endif
 
983
        uint8_t     padding[8];         /* multiple of 8 */
 
984
    } cfgm;
 
985
 
 
986
    /** PARAV part. */
 
987
    union
 
988
    {
 
989
#ifdef ___PARAVInternal_h
 
990
        struct PARAV s;
 
991
#endif
 
992
        uint8_t     padding[24];        /* multiple of 8 */
 
993
    } parav;
 
994
 
 
995
    /** Padding for aligning the cpu array on a page boundrary. */
 
996
    uint8_t         abAlignment2[2056];
 
997
 
 
998
    /* ---- end small stuff ---- */
981
999
 
982
1000
    /** VMCPU array for the configured number of virtual CPUs.
983
 
     * Must be aligned on a 64-byte boundrary.  */
984
 
    VMCPU       aCpus[1];
 
1001
     * Must be aligned on a page boundrary for TLB hit reasons as well as
 
1002
     * alignment of VMCPU members. */
 
1003
    VMCPU           aCpus[1];
985
1004
} VM;
986
1005
 
987
1006