Changeset 87388 in vbox
- Timestamp:
- Jan 22, 2021 11:26:29 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/hm_vmx.h
r87385 r87388 39 39 * @{ 40 40 */ 41 42 /** @name Host-state restoration flags.43 * @note If you change these values don't forget to update the assembly44 * defines as well!45 * @{46 */47 #define VMX_RESTORE_HOST_SEL_DS RT_BIT(0)48 #define VMX_RESTORE_HOST_SEL_ES RT_BIT(1)49 #define VMX_RESTORE_HOST_SEL_FS RT_BIT(2)50 #define VMX_RESTORE_HOST_SEL_GS RT_BIT(3)51 #define VMX_RESTORE_HOST_SEL_TR RT_BIT(4)52 #define VMX_RESTORE_HOST_GDTR RT_BIT(5)53 #define VMX_RESTORE_HOST_IDTR RT_BIT(6)54 #define VMX_RESTORE_HOST_GDT_READ_ONLY RT_BIT(7)55 #define VMX_RESTORE_HOST_GDT_NEED_WRITABLE RT_BIT(8)56 /**57 * This _must_ be the top most bit, so that we can easily that that it and58 * something else is set w/o having to do two checks like this:59 * @code60 * if ( (pVCpu->hm.s.vmx.fRestoreHostFlags & VMX_RESTORE_HOST_REQUIRED)61 * && (pVCpu->hm.s.vmx.fRestoreHostFlags & ~VMX_RESTORE_HOST_REQUIRED))62 * @endcode63 * Instead we can then do:64 * @code65 * if (pVCpu->hm.s.vmx.fRestoreHostFlags > VMX_RESTORE_HOST_REQUIRED)66 * @endcode67 */68 #define VMX_RESTORE_HOST_REQUIRED RT_BIT(9)69 /** @} */70 71 /**72 * Host-state restoration structure.73 * This holds host-state fields that require manual restoration.74 * Assembly version found in hm_vmx.mac (should be automatically verified).75 */76 typedef struct VMXRESTOREHOST77 {78 RTSEL uHostSelDS; /* 0x00 */79 RTSEL uHostSelES; /* 0x02 */80 RTSEL uHostSelFS; /* 0x04 */81 RTSEL uHostSelGS; /* 0x06 */82 RTSEL uHostSelTR; /* 0x08 */83 uint8_t abPadding0[4];84 X86XDTR64 HostGdtr; /**< 0x0e - should be aligned by it's 64-bit member. */85 uint8_t abPadding1[6];86 X86XDTR64 HostGdtrRw; /**< 0x1e - should be aligned by it's 64-bit member. */87 uint8_t abPadding2[6];88 X86XDTR64 HostIdtr; /**< 0x2e - should be aligned by it's 64-bit member. */89 uint64_t uHostFSBase; /* 0x38 */90 uint64_t uHostGSBase; /* 0x40 */91 } VMXRESTOREHOST;92 /** Pointer to VMXRESTOREHOST. */93 typedef VMXRESTOREHOST *PVMXRESTOREHOST;94 AssertCompileSize(X86XDTR64, 10);95 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr.uAddr, 16);96 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtrRw.uAddr, 32);97 AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr.uAddr, 48);98 AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase, 56);99 AssertCompileSize(VMXRESTOREHOST, 72);100 AssertCompileSizeAlignment(VMXRESTOREHOST, 8);101 41 102 42 /** @name Host-state MSR lazy-restoration flags. -
trunk/include/VBox/vmm/hm_vmx.mac
r87385 r87388 152 152 %define VMX_VMCS_HOST_RIP 06C16h 153 153 154 %define VMX_RESTORE_HOST_SEL_DS 0001h ;RT_BIT(0)155 %define VMX_RESTORE_HOST_SEL_ES 0002h ;RT_BIT(1)156 %define VMX_RESTORE_HOST_SEL_FS 0004h ;RT_BIT(2)157 %define VMX_RESTORE_HOST_SEL_GS 0008h ;RT_BIT(3)158 %define VMX_RESTORE_HOST_SEL_TR 0010h ;RT_BIT(4)159 %define VMX_RESTORE_HOST_GDTR 0020h ;RT_BIT(5)160 %define VMX_RESTORE_HOST_IDTR 0040h ;RT_BIT(6)161 %define VMX_RESTORE_HOST_GDT_READ_ONLY 0080h ;RT_BIT(7)162 %define VMX_RESTORE_HOST_GDT_NEED_WRITABLE 0100h ;RT_BIT(8)163 %define VMX_RESTORE_HOST_REQUIRED 0200h ;RT_BIT(9) - must be the highest bit!164 165 ;; C version hm_vmx.h.166 struc VMXRESTOREHOST167 .uHostSelDS resw 1168 .uHostSelES resw 1169 .uHostSelFS resw 1170 .uHostSelGS resw 1171 .uHostSelTR resw 1172 .abPadding0 resb 4173 .HostGdtr resb 10174 .abPadding1 resb 6175 .HostGdtrRw resb 10176 .abPadding2 resb 6177 .HostIdtr resb 10178 .uHostFSBase resq 1179 .uHostGSBase resq 1180 endstruc181 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr, 16-2)182 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtrRw, 32-2)183 AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr, 48-2)184 AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase, 56)185 AssertCompileSize(VMXRESTOREHOST, 72)186 -
trunk/include/VBox/vmm/hmvmxinline.h
r84119 r87388 346 346 347 347 /** 348 * Restores some host-state fields that need not be done on every VM-exit.349 *350 * @returns VBox status code.351 * @param fRestoreHostFlags Flags of which host registers needs to be352 * restored.353 * @param pRestoreHost Pointer to the host-restore structure.354 */355 DECLASM(int) VMXRestoreHostState(uint32_t fRestoreHostFlags, PVMXRESTOREHOST pRestoreHost);356 357 358 /**359 348 * Dispatches an NMI to the host. 360 349 */ -
trunk/src/VBox/VMM/include/HMInternal.h
r87387 r87388 687 687 688 688 689 /** @addtogroup grp_hm_int_svm SVM Internal 690 * @{ */ 691 /** SVM VMRun function, see SVMR0VMRun(). */ 692 typedef DECLCALLBACKTYPE(int, FNHMSVMVMRUN,(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhysVMCB)); 693 /** Pointer to a SVM VMRun function. */ 694 typedef R0PTRTYPE(FNHMSVMVMRUN *) PFNHMSVMVMRUN; 695 /** @} */ 696 697 698 /** @addtogroup grp_hm_int_vmx VMX Internal 699 * @{ */ 689 700 /** 690 701 * VMX StartVM function. … … 700 711 /** Pointer to a VMX StartVM function. */ 701 712 typedef R0PTRTYPE(FNHMVMXSTARTVM *) PFNHMVMXSTARTVM; 702 703 /** SVM VMRun function, see SVMR0VMRun(). */704 typedef DECLCALLBACKTYPE(int, FNHMSVMVMRUN,(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhysVMCB));705 /** Pointer to a SVM VMRun function. */706 typedef R0PTRTYPE(FNHMSVMVMRUN *) PFNHMSVMVMRUN;707 713 708 714 /** … … 845 851 /** @} */ 846 852 } VMXVMCSINFO; 847 /** Pointer to a VMXVMCSINFO struct. */853 /** Pointer to a VMXVMCSINFO struct. */ 848 854 typedef VMXVMCSINFO *PVMXVMCSINFO; 849 855 /** Pointer to a const VMXVMCSINFO struct. */ … … 862 868 AssertCompileMemberAlignment(VMXVMCSINFO, HCPhysVmcs, 8); 863 869 AssertCompileMemberAlignment(VMXVMCSINFO, hMemObj, 8); 870 871 872 /** @name Host-state restoration flags. 873 * @note If you change these values don't forget to update the assembly 874 * defines as well! 875 * @{ 876 */ 877 #define VMX_RESTORE_HOST_SEL_DS RT_BIT(0) 878 #define VMX_RESTORE_HOST_SEL_ES RT_BIT(1) 879 #define VMX_RESTORE_HOST_SEL_FS RT_BIT(2) 880 #define VMX_RESTORE_HOST_SEL_GS RT_BIT(3) 881 #define VMX_RESTORE_HOST_SEL_TR RT_BIT(4) 882 #define VMX_RESTORE_HOST_GDTR RT_BIT(5) 883 #define VMX_RESTORE_HOST_IDTR RT_BIT(6) 884 #define VMX_RESTORE_HOST_GDT_READ_ONLY RT_BIT(7) 885 #define VMX_RESTORE_HOST_GDT_NEED_WRITABLE RT_BIT(8) 886 /** 887 * This _must_ be the top most bit, so that we can easily that that it and 888 * something else is set w/o having to do two checks like this: 889 * @code 890 * if ( (pVCpu->hm.s.vmx.fRestoreHostFlags & VMX_RESTORE_HOST_REQUIRED) 891 * && (pVCpu->hm.s.vmx.fRestoreHostFlags & ~VMX_RESTORE_HOST_REQUIRED)) 892 * @endcode 893 * Instead we can then do: 894 * @code 895 * if (pVCpu->hm.s.vmx.fRestoreHostFlags > VMX_RESTORE_HOST_REQUIRED) 896 * @endcode 897 */ 898 #define VMX_RESTORE_HOST_REQUIRED RT_BIT(9) 899 /** @} */ 900 901 /** 902 * Host-state restoration structure. 903 * 904 * This holds host-state fields that require manual restoration. 905 * Assembly version found in HMInternal.mac (should be automatically verified). 906 */ 907 typedef struct VMXRESTOREHOST 908 { 909 RTSEL uHostSelDS; /* 0x00 */ 910 RTSEL uHostSelES; /* 0x02 */ 911 RTSEL uHostSelFS; /* 0x04 */ 912 RTSEL uHostSelGS; /* 0x06 */ 913 RTSEL uHostSelTR; /* 0x08 */ 914 uint8_t abPadding0[4]; 915 X86XDTR64 HostGdtr; /**< 0x0e - should be aligned by its 64-bit member. */ 916 uint8_t abPadding1[6]; 917 X86XDTR64 HostGdtrRw; /**< 0x1e - should be aligned by its 64-bit member. */ 918 uint8_t abPadding2[6]; 919 X86XDTR64 HostIdtr; /**< 0x2e - should be aligned by its 64-bit member. */ 920 uint64_t uHostFSBase; /* 0x38 */ 921 uint64_t uHostGSBase; /* 0x40 */ 922 } VMXRESTOREHOST; 923 /** Pointer to VMXRESTOREHOST. */ 924 typedef VMXRESTOREHOST *PVMXRESTOREHOST; 925 AssertCompileSize(X86XDTR64, 10); 926 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr.uAddr, 16); 927 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtrRw.uAddr, 32); 928 AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr.uAddr, 48); 929 AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase, 56); 930 AssertCompileSize(VMXRESTOREHOST, 72); 931 AssertCompileSizeAlignment(VMXRESTOREHOST, 8); 932 933 /** @} */ 864 934 865 935 /** … … 1230 1300 # endif 1231 1301 1232 # ifdef VBOX_WITH_KERNEL_USING_XMM1233 DECLASM(int) hmR0VMXStartVMWrapXMM(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVMCC pVM, PVMCPUCC pVCpu,1234 PFNHMVMXSTARTVM pfnStartVM);1235 # endif1236 1302 DECLASM(void) hmR0MdsClear(void); 1237 1303 #endif /* IN_RING0 */ 1238 1304 1305 1306 /** @addtogroup grp_hm_int_svm SVM Internal 1307 * @{ */ 1239 1308 VMM_INT_DECL(int) hmEmulateSvmMovTpr(PVMCC pVM, PVMCPUCC pVCpu); 1240 1241 VMM_INT_DECL(PVMXVMCSINFO) hmGetVmxActiveVmcsInfo(PVMCPU pVCpu);1242 1309 1243 1310 /** … … 1267 1334 /** @} */ 1268 1335 1269 1270 1336 /** @} */ 1271 1337 1338 1339 /** @addtogroup grp_hm_int_vmx VMX Internal 1340 * @{ */ 1341 VMM_INT_DECL(PVMXVMCSINFO) hmGetVmxActiveVmcsInfo(PVMCPU pVCpu); 1342 1343 /** 1344 * Restores some host-state fields that need not be done on every VM-exit. 1345 * 1346 * @returns VBox status code. 1347 * @param fRestoreHostFlags Flags of which host registers needs to be 1348 * restored. 1349 * @param pRestoreHost Pointer to the host-restore structure. 1350 */ 1351 DECLASM(int) VMXRestoreHostState(uint32_t fRestoreHostFlags, PVMXRESTOREHOST pRestoreHost); 1352 1353 # ifdef VBOX_WITH_KERNEL_USING_XMM 1354 DECLASM(int) hmR0VMXStartVMWrapXMM(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVMCC pVM, PVMCPUCC pVCpu, 1355 PFNHMVMXSTARTVM pfnStartVM); 1356 # endif 1357 /** @} */ 1358 1359 /** @} */ 1360 1272 1361 RT_C_DECLS_END 1273 1362 -
trunk/src/VBox/VMM/include/HMInternal.mac
r87333 r87388 84 84 endstruc 85 85 86 %define VMX_RESTORE_HOST_SEL_DS 0001h ;RT_BIT(0) 87 %define VMX_RESTORE_HOST_SEL_ES 0002h ;RT_BIT(1) 88 %define VMX_RESTORE_HOST_SEL_FS 0004h ;RT_BIT(2) 89 %define VMX_RESTORE_HOST_SEL_GS 0008h ;RT_BIT(3) 90 %define VMX_RESTORE_HOST_SEL_TR 0010h ;RT_BIT(4) 91 %define VMX_RESTORE_HOST_GDTR 0020h ;RT_BIT(5) 92 %define VMX_RESTORE_HOST_IDTR 0040h ;RT_BIT(6) 93 %define VMX_RESTORE_HOST_GDT_READ_ONLY 0080h ;RT_BIT(7) 94 %define VMX_RESTORE_HOST_GDT_NEED_WRITABLE 0100h ;RT_BIT(8) 95 %define VMX_RESTORE_HOST_REQUIRED 0200h ;RT_BIT(9) - must be the highest bit! 96 struc VMXRESTOREHOST 97 .uHostSelDS resw 1 98 .uHostSelES resw 1 99 .uHostSelFS resw 1 100 .uHostSelGS resw 1 101 .uHostSelTR resw 1 102 .abPadding0 resb 4 103 .HostGdtr resb 10 104 .abPadding1 resb 6 105 .HostGdtrRw resb 10 106 .abPadding2 resb 6 107 .HostIdtr resb 10 108 .uHostFSBase resq 1 109 .uHostGSBase resq 1 110 endstruc 111 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr, 16-2) 112 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtrRw, 32-2) 113 AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr, 48-2) 114 AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase, 56) 115 AssertCompileSize(VMXRESTOREHOST, 72) 116 86 117 struc HMCPUVMX 87 118 .VmcsInfo resb VMXVMCSINFO_size
Note:
See TracChangeset
for help on using the changeset viewer.