- Timestamp:
- Jun 24, 2012 3:44:03 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/types.h
r41901 r41906 384 384 typedef const struct CPUMCTXCORE *PCCPUMCTXCORE; 385 385 386 /** Pointer to selector hidden registers. */ 387 typedef struct CPUMSELREGHID *PCPUMSELREGHID; 388 /** Pointer to const selector hidden registers. */ 389 typedef const struct CPUMSELREGHID *PCCPUMSELREGHID; 386 /** Pointer to a selector register. */ 387 typedef struct CPUMSELREG *PCPUMSELREG; 388 /** Pointer to a const selector register. */ 389 typedef const struct CPUMSELREG *PCCPUMSELREG; 390 391 /** Pointer to selector hidden registers. 392 * @deprecated Replaced by PCPUMSELREG */ 393 typedef struct CPUMSELREG *PCPUMSELREGHID; 394 /** Pointer to const selector hidden registers. 395 * @deprecated Replaced by PCCPUMSELREG */ 396 typedef const struct CPUMSELREG *PCCPUMSELREGHID; 390 397 391 398 /** @} */ -
trunk/include/VBox/vmm/cpum.h
r41904 r41906 248 248 return false; 249 249 250 return pCtx->cs Hid.Attr.n.u1Long;250 return pCtx->cs.Attr.n.u1Long; 251 251 } 252 252 … … 263 263 return false; 264 264 265 return pCtx->cs Hid.Attr.n.u1Long;265 return pCtx->cs.Attr.n.u1Long; 266 266 } 267 267 -
trunk/include/VBox/vmm/cpum.mac
r41905 r41906 48 48 .r14 resq 1 49 49 .r15 resq 1 50 .es resw 1 51 .esPadding resw 3 52 .esHid.u64Base resq 1 53 .esHid.u32Limit resd 1 54 .esHid.Attr resd 1 55 .cs resw 1 56 .csPadding resw 3 57 .csHid.u64Base resq 1 58 .csHid.u32Limit resd 1 59 .csHid.Attr resd 1 60 .ss resw 1 61 .ssPadding resw 3 62 .ssHid.u64Base resq 1 63 .ssHid.u32Limit resd 1 64 .ssHid.Attr resd 1 65 .ds resw 1 66 .dsPadding resw 3 67 .dsHid.u64Base resq 1 68 .dsHid.u32Limit resd 1 69 .dsHid.Attr resd 1 70 .fs resw 1 71 .fsPadding resw 3 72 .fsHid.u64Base resq 1 73 .fsHid.u32Limit resd 1 74 .fsHid.Attr resd 1 75 .gs resw 1 76 .gsPadding resw 3 77 .gsHid.u64Base resq 1 78 .gsHid.u32Limit resd 1 79 .gsHid.Attr resd 1 50 .es.Sel resw 1 51 .es.PaddingSel resw 1 52 .es.ValidSel resw 1 53 .es.fFlags resw 1 54 .es.u64Base resq 1 55 .es.u32Limit resd 1 56 .es.Attr resd 1 57 .cs.Sel resw 1 58 .cs.PaddingSel resw 1 59 .cs.ValidSel resw 1 60 .cs.fFlags resw 1 61 .cs.u64Base resq 1 62 .cs.u32Limit resd 1 63 .cs.Attr resd 1 64 .ss.Sel resw 1 65 .ss.PaddingSel resw 1 66 .ss.ValidSel resw 1 67 .ss.fFlags resw 1 68 .ss.u64Base resq 1 69 .ss.u32Limit resd 1 70 .ss.Attr resd 1 71 .ds.Sel resw 1 72 .ds.PaddingSel resw 1 73 .ds.ValidSel resw 1 74 .ds.fFlags resw 1 75 .ds.u64Base resq 1 76 .ds.u32Limit resd 1 77 .ds.Attr resd 1 78 .fs.Sel resw 1 79 .fs.PaddingSel resw 1 80 .fs.ValidSel resw 1 81 .fs.fFlags resw 1 82 .fs.u64Base resq 1 83 .fs.u32Limit resd 1 84 .fs.Attr resd 1 85 .gs.Sel resw 1 86 .gs.PaddingSel resw 1 87 .gs.ValidSel resw 1 88 .gs.fFlags resw 1 89 .gs.u64Base resq 1 90 .gs.u32Limit resd 1 91 .gs.Attr resd 1 80 92 .eip resq 1 81 93 .eflags resq 1 … … 101 113 .r14 resq 1 102 114 .r15 resq 1 103 .es resw 1 104 .esPadding resw 3 105 .esHid.u64Base resq 1 106 .esHid.u32Limit resd 1 107 .esHid.Attr resd 1 108 .cs resw 1 109 .csPadding resw 3 110 .csHid.u64Base resq 1 111 .csHid.u32Limit resd 1 112 .csHid.Attr resd 1 113 .ss resw 1 114 .ssPadding resw 3 115 .ssHid.u64Base resq 1 116 .ssHid.u32Limit resd 1 117 .ssHid.Attr resd 1 118 .ds resw 1 119 .dsPadding resw 3 120 .dsHid.u64Base resq 1 121 .dsHid.u32Limit resd 1 122 .dsHid.Attr resd 1 123 .fs resw 1 124 .fsPadding resw 3 125 .fsHid.u64Base resq 1 126 .fsHid.u32Limit resd 1 127 .fsHid.Attr resd 1 128 .gs resw 1 129 .gsPadding resw 3 130 .gsHid.u64Base resq 1 131 .gsHid.u32Limit resd 1 132 .gsHid.Attr resd 1 115 .es.Sel resw 1 116 .es.PaddingSel resw 1 117 .es.ValidSel resw 1 118 .es.fFlags resw 1 119 .es.u64Base resq 1 120 .es.u32Limit resd 1 121 .es.Attr resd 1 122 .cs.Sel resw 1 123 .cs.PaddingSel resw 1 124 .cs.ValidSel resw 1 125 .cs.fFlags resw 1 126 .cs.u64Base resq 1 127 .cs.u32Limit resd 1 128 .cs.Attr resd 1 129 .ss.Sel resw 1 130 .ss.PaddingSel resw 1 131 .ss.ValidSel resw 1 132 .ss.fFlags resw 1 133 .ss.u64Base resq 1 134 .ss.u32Limit resd 1 135 .ss.Attr resd 1 136 .ds.Sel resw 1 137 .ds.PaddingSel resw 1 138 .ds.ValidSel resw 1 139 .ds.fFlags resw 1 140 .ds.u64Base resq 1 141 .ds.u32Limit resd 1 142 .ds.Attr resd 1 143 .fs.Sel resw 1 144 .fs.PaddingSel resw 1 145 .fs.ValidSel resw 1 146 .fs.fFlags resw 1 147 .fs.u64Base resq 1 148 .fs.u32Limit resd 1 149 .fs.Attr resd 1 150 .gs.Sel resw 1 151 .gs.PaddingSel resw 1 152 .gs.ValidSel resw 1 153 .gs.fFlags resw 1 154 .gs.u64Base resq 1 155 .gs.u32Limit resd 1 156 .gs.Attr resd 1 133 157 .eip resq 1 134 158 .eflags resq 1 … … 146 170 .idtr.cbIdt resw 1 147 171 .idtr.pIdt resq 1 148 .ldtr resw 1 149 .ldtrPadding resw 3 150 .ldtrHid.u64Base resq 1 151 .ldtrHid.u32Limit resd 1 152 .ldtrHid.Attr resd 1 153 .tr resw 1 154 .trPadding resw 3 155 .trHid.u64Base resq 1 156 .trHid.u32Limit resd 1 157 .trHid.Attr resd 1 172 .ldtr.Sel resw 1 173 .ldtr.PaddingSel resw 1 174 .ldtr.ValidSel resw 1 175 .ldtr.fFlags resw 1 176 .ldtr.u64Base resq 1 177 .ldtr.u32Limit resd 1 178 .ldtr.Attr resd 1 179 .tr.Sel resw 1 180 .tr.PaddingSel resw 1 181 .tr.ValidSel resw 1 182 .tr.fFlags resw 1 183 .tr.u64Base resq 1 184 .tr.u32Limit resd 1 185 .tr.Attr resd 1 158 186 .SysEnter.cs resb 8 159 187 .SysEnter.eip resb 8 -
trunk/include/VBox/vmm/cpumctx.h
r41905 r41906 29 29 #ifndef VBOX_FOR_DTRACE_LIB 30 30 # include <iprt/x86.h> 31 # include <VBox/types.h> 31 32 #else 32 33 # pragma D depends_on library x86.d … … 44 45 * Selector hidden registers. 45 46 */ 46 typedef struct CPUMSELREGHID 47 { 47 typedef struct CPUMSELREG 48 { 49 /** The selector register. */ 50 RTSEL Sel; 51 /** Padding, don't use. */ 52 RTSEL PaddingSel; 53 /** The selector which info resides in u64Base, u32Limit and Attr, provided 54 * that CPUMSELREG_FLAGS_VALID is set. */ 55 RTSEL ValidSel; 56 /** Flags, see CPUMSELREG_FLAGS_XXX. */ 57 uint16_t fFlags; 58 48 59 /** Base register. 49 60 * 50 * 61 * Long mode remarks: 51 62 * - Unused in long mode for CS, DS, ES, SS 52 63 * - 32 bits for FS & GS; FS(GS)_BASE msr used for the base address … … 60 71 * Only the flags, dpl and type are used. */ 61 72 X86DESCATTR Attr; 62 } CPUMSELREGHID; 63 73 } CPUMSELREG; 74 75 /** @name CPUMSELREG_FLAGS_XXX - CPUMSELREG::fFlags values. 76 * @{ */ 77 #define CPUMSELREG_FLAGS_VALID UINT16_C(0x0001) 78 #define CPUMSELREG_FLAGS_STALE UINT16_C(0x0002) 79 /** @} */ 80 81 /** Old type used for the hidden register part. 82 * @deprecated */ 83 typedef CPUMSELREG CPUMSELREGHID; 64 84 65 85 /** … … 172 192 * @note These follow the encoding order (X86_SREG_XXX) and can be accessed as 173 193 * an array starting a es. 174 * @todo Combine the selector and hidden bits, effectively expanding the hidden175 * register structure by 64-bit.176 *177 194 * @{ */ 178 RTSEL es; 179 RTSEL esPadding[3]; 180 CPUMSELREGHID esHid; 181 182 RTSEL cs; 183 RTSEL csPadding[3]; 184 CPUMSELREGHID csHid; 185 186 RTSEL ss; 187 RTSEL ssPadding[3]; 188 CPUMSELREGHID ssHid; 189 190 RTSEL ds; 191 RTSEL dsPadding[3]; 192 CPUMSELREGHID dsHid; 193 194 RTSEL fs; 195 RTSEL fsPadding[3]; 196 CPUMSELREGHID fsHid; 197 198 RTSEL gs; 199 RTSEL gsPadding[3]; 200 CPUMSELREGHID gsHid; 195 CPUMSELREG es; 196 CPUMSELREG cs; 197 CPUMSELREG ss; 198 CPUMSELREG ds; 199 CPUMSELREG fs; 200 CPUMSELREG gs; 201 201 /** @} */ 202 202 … … 305 305 * @note These follow the encoding order (X86_SREG_XXX) and can be accessed as 306 306 * an array starting a es. 307 * @todo Combine the selector and hidden bits, effectively expanding the hidden308 * register structure by 64-bit.309 *310 307 * @{ */ 311 RTSEL es; 312 RTSEL esPadding[3]; 313 CPUMSELREGHID esHid; 314 315 RTSEL cs; 316 RTSEL csPadding[3]; 317 CPUMSELREGHID csHid; 318 319 RTSEL ss; 320 RTSEL ssPadding[3]; 321 CPUMSELREGHID ssHid; 322 323 RTSEL ds; 324 RTSEL dsPadding[3]; 325 CPUMSELREGHID dsHid; 326 327 RTSEL fs; 328 RTSEL fsPadding[3]; 329 CPUMSELREGHID fsHid; 330 331 RTSEL gs; 332 RTSEL gsPadding[3]; 333 CPUMSELREGHID gsHid; 308 CPUMSELREG es; 309 CPUMSELREG cs; 310 CPUMSELREG ss; 311 CPUMSELREG ds; 312 CPUMSELREG fs; 313 CPUMSELREG gs; 334 314 /** @} */ 335 315 … … 382 362 /** The task register. 383 363 * Only the guest context uses all the members. */ 384 RTSEL ldtr; 385 RTSEL ldtrPadding[3]; 386 CPUMSELREGHID ldtrHid; 364 CPUMSELREG ldtr; 387 365 /** The task register. 388 366 * Only the guest context uses all the members. */ 389 RTSEL tr; 390 RTSEL trPadding[3]; 391 CPUMSELREGHID trHid; 367 CPUMSELREG tr; 392 368 393 369 /** The sysenter msr registers. -
trunk/src/VBox/Disassembler/DisasmReg.cpp
r41790 r41906 185 185 static const unsigned g_aRegHidSegIndex[] = 186 186 { 187 RT_OFFSETOF(CPUMCTXCORE, es Hid), /* DISSELREG_ES */188 RT_OFFSETOF(CPUMCTXCORE, cs Hid), /* DISSELREG_CS */189 RT_OFFSETOF(CPUMCTXCORE, ss Hid), /* DISSELREG_SS */190 RT_OFFSETOF(CPUMCTXCORE, ds Hid), /* DISSELREG_DS */191 RT_OFFSETOF(CPUMCTXCORE, fs Hid), /* DISSELREG_FS */192 RT_OFFSETOF(CPUMCTXCORE, gs Hid) /* DISSELREG_GS */187 RT_OFFSETOF(CPUMCTXCORE, es), /* DISSELREG_ES */ 188 RT_OFFSETOF(CPUMCTXCORE, cs), /* DISSELREG_CS */ 189 RT_OFFSETOF(CPUMCTXCORE, ss), /* DISSELREG_SS */ 190 RT_OFFSETOF(CPUMCTXCORE, ds), /* DISSELREG_DS */ 191 RT_OFFSETOF(CPUMCTXCORE, fs), /* DISSELREG_FS */ 192 RT_OFFSETOF(CPUMCTXCORE, gs) /* DISSELREG_GS */ 193 193 }; 194 194 -
trunk/src/VBox/VMM/Makefile.kmk
r41831 r41906 683 683 IEMAllCImplStrInstr.cpp.o IEMAllCImplStrInstr.cpp.obj: IEMAll.o 684 684 685 # Alias the switcher templates. 686 PAEand32Bit.o PAEand32Bit.obj: PAETo32Bit.o PAEToPAE.o 32BitTo32Bit.o PAETo32Bit.o 687 LegacyandAMD64.o LegacyandAMD64.obj: 32BitToAMD64.o PAEToAMD64.o 688 AMD64andLegacy.o AMD64andLegacy.obj: AMD64To32Bit.o AMD64ToPAE.o -
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r41905 r41906 142 142 VMMDECL(void) CPUMSetHyperCS(PVMCPU pVCpu, RTSEL SelCS) 143 143 { 144 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->cs = SelCS;144 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->cs.Sel = SelCS; 145 145 } 146 146 … … 148 148 VMMDECL(void) CPUMSetHyperDS(PVMCPU pVCpu, RTSEL SelDS) 149 149 { 150 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ds = SelDS;150 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ds.Sel = SelDS; 151 151 } 152 152 … … 154 154 VMMDECL(void) CPUMSetHyperES(PVMCPU pVCpu, RTSEL SelES) 155 155 { 156 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->es = SelES;156 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->es.Sel = SelES; 157 157 } 158 158 … … 160 160 VMMDECL(void) CPUMSetHyperFS(PVMCPU pVCpu, RTSEL SelFS) 161 161 { 162 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->fs = SelFS;162 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->fs.Sel = SelFS; 163 163 } 164 164 … … 166 166 VMMDECL(void) CPUMSetHyperGS(PVMCPU pVCpu, RTSEL SelGS) 167 167 { 168 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->gs = SelGS;168 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->gs.Sel = SelGS; 169 169 } 170 170 … … 172 172 VMMDECL(void) CPUMSetHyperSS(PVMCPU pVCpu, RTSEL SelSS) 173 173 { 174 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ss = SelSS;174 pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ss.Sel = SelSS; 175 175 } 176 176 … … 197 197 VMMDECL(void) CPUMSetHyperTR(PVMCPU pVCpu, RTSEL SelTR) 198 198 { 199 pVCpu->cpum.s.Hyper.tr = SelTR;199 pVCpu->cpum.s.Hyper.tr.Sel = SelTR; 200 200 } 201 201 … … 203 203 VMMDECL(void) CPUMSetHyperLDTR(PVMCPU pVCpu, RTSEL SelLDTR) 204 204 { 205 pVCpu->cpum.s.Hyper.ldtr = SelLDTR;205 pVCpu->cpum.s.Hyper.ldtr.Sel = SelLDTR; 206 206 } 207 207 … … 251 251 VMMDECL(RTSEL) CPUMGetHyperCS(PVMCPU pVCpu) 252 252 { 253 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->cs ;253 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->cs.Sel; 254 254 } 255 255 … … 257 257 VMMDECL(RTSEL) CPUMGetHyperDS(PVMCPU pVCpu) 258 258 { 259 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ds ;259 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ds.Sel; 260 260 } 261 261 … … 263 263 VMMDECL(RTSEL) CPUMGetHyperES(PVMCPU pVCpu) 264 264 { 265 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->es ;265 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->es.Sel; 266 266 } 267 267 … … 269 269 VMMDECL(RTSEL) CPUMGetHyperFS(PVMCPU pVCpu) 270 270 { 271 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->fs ;271 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->fs.Sel; 272 272 } 273 273 … … 275 275 VMMDECL(RTSEL) CPUMGetHyperGS(PVMCPU pVCpu) 276 276 { 277 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->gs ;277 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->gs.Sel; 278 278 } 279 279 … … 281 281 VMMDECL(RTSEL) CPUMGetHyperSS(PVMCPU pVCpu) 282 282 { 283 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ss ;283 return pVCpu->cpum.s.CTX_SUFF(pHyperCore)->ss.Sel; 284 284 } 285 285 … … 369 369 VMMDECL(RTSEL) CPUMGetHyperLDTR(PVMCPU pVCpu) 370 370 { 371 return pVCpu->cpum.s.Hyper.ldtr ;371 return pVCpu->cpum.s.Hyper.ldtr.Sel; 372 372 } 373 373 … … 491 491 VMMDECL(int) CPUMSetGuestTR(PVMCPU pVCpu, uint16_t tr) 492 492 { 493 pVCpu->cpum.s.Guest.tr = tr;493 pVCpu->cpum.s.Guest.tr.Sel = tr; 494 494 pVCpu->cpum.s.fChanged |= CPUM_CHANGED_TR; 495 495 return VINF_SUCCESS; … … 498 498 VMMDECL(int) CPUMSetGuestLDTR(PVMCPU pVCpu, uint16_t ldtr) 499 499 { 500 pVCpu->cpum.s.Guest.ldtr = ldtr;500 pVCpu->cpum.s.Guest.ldtr.Sel = ldtr; 501 501 pVCpu->cpum.s.fChanged |= CPUM_CHANGED_LDTR; 502 502 return VINF_SUCCESS; … … 682 682 VMMDECL(int) CPUMSetGuestSS(PVMCPU pVCpu, uint16_t ss) 683 683 { 684 pVCpu->cpum.s.Guest.ss = ss;684 pVCpu->cpum.s.Guest.ss.Sel = ss; 685 685 return VINF_SUCCESS; 686 686 } … … 689 689 VMMDECL(int) CPUMSetGuestCS(PVMCPU pVCpu, uint16_t cs) 690 690 { 691 pVCpu->cpum.s.Guest.cs = cs;691 pVCpu->cpum.s.Guest.cs.Sel = cs; 692 692 return VINF_SUCCESS; 693 693 } … … 696 696 VMMDECL(int) CPUMSetGuestDS(PVMCPU pVCpu, uint16_t ds) 697 697 { 698 pVCpu->cpum.s.Guest.ds = ds;698 pVCpu->cpum.s.Guest.ds.Sel = ds; 699 699 return VINF_SUCCESS; 700 700 } … … 703 703 VMMDECL(int) CPUMSetGuestES(PVMCPU pVCpu, uint16_t es) 704 704 { 705 pVCpu->cpum.s.Guest.es = es;705 pVCpu->cpum.s.Guest.es.Sel = es; 706 706 return VINF_SUCCESS; 707 707 } … … 710 710 VMMDECL(int) CPUMSetGuestFS(PVMCPU pVCpu, uint16_t fs) 711 711 { 712 pVCpu->cpum.s.Guest.fs = fs;712 pVCpu->cpum.s.Guest.fs.Sel = fs; 713 713 return VINF_SUCCESS; 714 714 } … … 717 717 VMMDECL(int) CPUMSetGuestGS(PVMCPU pVCpu, uint16_t gs) 718 718 { 719 pVCpu->cpum.s.Guest.gs = gs;719 pVCpu->cpum.s.Guest.gs.Sel = gs; 720 720 return VINF_SUCCESS; 721 721 } … … 864 864 865 865 case MSR_K8_FS_BASE: 866 *puValue = pVCpu->cpum.s.Guest.fs Hid.u64Base;866 *puValue = pVCpu->cpum.s.Guest.fs.u64Base; 867 867 break; 868 868 869 869 case MSR_K8_GS_BASE: 870 *puValue = pVCpu->cpum.s.Guest.gs Hid.u64Base;870 *puValue = pVCpu->cpum.s.Guest.gs.u64Base; 871 871 break; 872 872 … … 1142 1142 1143 1143 case MSR_K8_FS_BASE: 1144 pVCpu->cpum.s.Guest.fs Hid.u64Base= uValue;1144 pVCpu->cpum.s.Guest.fs.u64Base = uValue; 1145 1145 break; 1146 1146 1147 1147 case MSR_K8_GS_BASE: 1148 pVCpu->cpum.s.Guest.gs Hid.u64Base= uValue;1148 pVCpu->cpum.s.Guest.gs.u64Base = uValue; 1149 1149 break; 1150 1150 … … 1189 1189 { 1190 1190 if (pHidden) 1191 *pHidden = pVCpu->cpum.s.Guest.tr Hid;1192 return pVCpu->cpum.s.Guest.tr ;1191 *pHidden = pVCpu->cpum.s.Guest.tr; 1192 return pVCpu->cpum.s.Guest.tr.Sel; 1193 1193 } 1194 1194 … … 1196 1196 VMMDECL(RTSEL) CPUMGetGuestCS(PVMCPU pVCpu) 1197 1197 { 1198 return pVCpu->cpum.s.Guest.cs ;1198 return pVCpu->cpum.s.Guest.cs.Sel; 1199 1199 } 1200 1200 … … 1202 1202 VMMDECL(RTSEL) CPUMGetGuestDS(PVMCPU pVCpu) 1203 1203 { 1204 return pVCpu->cpum.s.Guest.ds ;1204 return pVCpu->cpum.s.Guest.ds.Sel; 1205 1205 } 1206 1206 … … 1208 1208 VMMDECL(RTSEL) CPUMGetGuestES(PVMCPU pVCpu) 1209 1209 { 1210 return pVCpu->cpum.s.Guest.es ;1210 return pVCpu->cpum.s.Guest.es.Sel; 1211 1211 } 1212 1212 … … 1214 1214 VMMDECL(RTSEL) CPUMGetGuestFS(PVMCPU pVCpu) 1215 1215 { 1216 return pVCpu->cpum.s.Guest.fs ;1216 return pVCpu->cpum.s.Guest.fs.Sel; 1217 1217 } 1218 1218 … … 1220 1220 VMMDECL(RTSEL) CPUMGetGuestGS(PVMCPU pVCpu) 1221 1221 { 1222 return pVCpu->cpum.s.Guest.gs ;1222 return pVCpu->cpum.s.Guest.gs.Sel; 1223 1223 } 1224 1224 … … 1226 1226 VMMDECL(RTSEL) CPUMGetGuestSS(PVMCPU pVCpu) 1227 1227 { 1228 return pVCpu->cpum.s.Guest.ss ;1228 return pVCpu->cpum.s.Guest.ss.Sel; 1229 1229 } 1230 1230 … … 1232 1232 VMMDECL(RTSEL) CPUMGetGuestLDTR(PVMCPU pVCpu) 1233 1233 { 1234 return pVCpu->cpum.s.Guest.ldtr ;1234 return pVCpu->cpum.s.Guest.ldtr.Sel; 1235 1235 } 1236 1236 … … 2454 2454 { 2455 2455 if (!pCtxCore->eflags.Bits.u1VM) 2456 cpl = pCtxCore->ss Hid.Attr.n.u2Dpl;2456 cpl = pCtxCore->ss.Attr.n.u2Dpl; 2457 2457 else 2458 2458 cpl = 3; /* REM doesn't set DPL=3 in V8086 mode. See @bugref{5130}. */ … … 2470 2470 * See section 4.11.1 in the AMD manual. 2471 2471 */ 2472 cpl = (pCtxCore->ss & X86_SEL_RPL);2472 cpl = (pCtxCore->ss.Sel & X86_SEL_RPL); 2473 2473 #ifndef IN_RING0 2474 2474 if (cpl == 1) -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r41830 r41906 384 384 #else 385 385 /** @todo Get the CPU mode as well while we're at it! */ 386 int rc = SELMValidateAndConvertCSAddr(pVCpu, pCtxCore->eflags, pCtxCore->ss , pCtxCore->cs,387 &pCtxCore->cs Hid, pCtxCore->rip, &GCPtrInstr);386 int rc = SELMValidateAndConvertCSAddr(pVCpu, pCtxCore->eflags, pCtxCore->ss.Sel, pCtxCore->cs.Sel, 387 &pCtxCore->cs, pCtxCore->rip, &GCPtrInstr); 388 388 #endif 389 389 if (RT_FAILURE(rc)) 390 390 { 391 391 Log(("EMInterpretDisasOne: Failed to convert %RTsel:%RGv (cpl=%d) - rc=%Rrc !!\n", 392 pCtxCore->cs , (RTGCPTR)pCtxCore->rip, pCtxCore->ss& X86_SEL_RPL, rc));392 pCtxCore->cs.Sel, (RTGCPTR)pCtxCore->rip, pCtxCore->ss.Sel & X86_SEL_RPL, rc)); 393 393 return rc; 394 394 } … … 415 415 PDISCPUSTATE pDis, unsigned *pcbInstr) 416 416 { 417 DISCPUMODE enmCpuMode = SELMGetCpuModeFromSelector(pVCpu, pCtxCore->eflags, pCtxCore->cs , (PCPUMSELREGHID)&pCtxCore->csHid);417 DISCPUMODE enmCpuMode = SELMGetCpuModeFromSelector(pVCpu, pCtxCore->eflags, pCtxCore->cs.Sel, (PCPUMSELREGHID)&pCtxCore->cs); 418 418 /** @todo Deal with too long instruction (=> \#GP), opcode read errors (=> 419 419 * \#PF, \#GP, \#??), undefined opcodes (=> \#UD), and such. */ … … 461 461 uint32_t cbOp; 462 462 PDISCPUSTATE pDis = &pVCpu->em.s.DisState; 463 pDis->uCpuMode = SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->cs , &pRegFrame->csHid);463 pDis->uCpuMode = SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->cs.Sel, &pRegFrame->cs); 464 464 rc = emDisCoreOne(pVCpu->CTX_SUFF(pVM), pVCpu, pDis, (RTGCUINTPTR)pbCode, &cbOp); 465 465 if (RT_SUCCESS(rc)) … … 515 515 uint32_t cbOp; 516 516 PDISCPUSTATE pDis = &pVCpu->em.s.DisState; 517 pDis->uCpuMode = SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->cs , &pRegFrame->csHid);517 pDis->uCpuMode = SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->cs.Sel, &pRegFrame->cs); 518 518 rc = emDisCoreOne(pVCpu->CTX_SUFF(pVM), pVCpu, pDis, (RTGCUINTPTR)pbCode, &cbOp); 519 519 if (RT_SUCCESS(rc)) … … 625 625 AssertRCReturn(rc, VERR_EM_INTERPRETER); 626 626 627 pRegFrame->eip = eip & 0xffff;628 pRegFrame->cs 627 pRegFrame->eip = eip & 0xffff; 628 pRegFrame->cs.Sel = cs; 629 629 630 630 /* Mask away all reserved bits */ … … 635 635 Assert((pRegFrame->eflags.u32 & (X86_EFL_IF|X86_EFL_IOPL)) == X86_EFL_IF); 636 636 637 pRegFrame->esp = esp;638 pRegFrame->ss = ss;639 pRegFrame->ds = ds;640 pRegFrame->es = es;641 pRegFrame->fs = fs;642 pRegFrame->gs = gs;637 pRegFrame->esp = esp; 638 pRegFrame->ss.Sel = ss; 639 pRegFrame->ds.Sel = ds; 640 pRegFrame->es.Sel = es; 641 pRegFrame->fs.Sel = fs; 642 pRegFrame->gs.Sel = gs; 643 643 644 644 return VINF_SUCCESS; … … 926 926 { 927 927 /* Illegal to have an active 64 bits CS selector (AMD Arch. Programmer's Manual Volume 2: Table 14-5) */ 928 if (pRegFrame->cs Hid.Attr.n.u1Long)928 if (pRegFrame->cs.Attr.n.u1Long) 929 929 { 930 930 AssertMsgFailed(("Illegal enabling of paging with CS.u1Long = 1!!\n")); … … 1535 1535 1536 1536 /* Read stack value first */ 1537 if (SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->ss , &pRegFrame->ssHid) == DISCPUMODE_16BIT)1537 if (SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->ss.Sel, &pRegFrame->ss) == DISCPUMODE_16BIT) 1538 1538 return VERR_EM_INTERPRETER; /* No legacy 16 bits stuff here, please. */ 1539 1539 … … 2202 2202 if (!(pDis->fPrefix & DISPREFIX_REP)) 2203 2203 { 2204 LogFlow(("emInterpretStosWD dest=%04X:%RGv (%RGv) cbSize=%d\n", pRegFrame->es , GCOffset, GCDest, cbSize));2204 LogFlow(("emInterpretStosWD dest=%04X:%RGv (%RGv) cbSize=%d\n", pRegFrame->es.Sel, GCOffset, GCDest, cbSize)); 2205 2205 2206 2206 rc = emRamWrite(pVM, pVCpu, pRegFrame, GCDest, &pRegFrame->rax, cbSize); … … 2247 2247 } 2248 2248 2249 LogFlow(("emInterpretStosWD dest=%04X:%RGv (%RGv) cbSize=%d cTransfers=%x DF=%d\n", pRegFrame->es , GCOffset, GCDest, cbSize, cTransfers, pRegFrame->eflags.Bits.u1DF));2249 LogFlow(("emInterpretStosWD dest=%04X:%RGv (%RGv) cbSize=%d cTransfers=%x DF=%d\n", pRegFrame->es.Sel, GCOffset, GCDest, cbSize, cTransfers, pRegFrame->eflags.Bits.u1DF)); 2250 2250 /* Access verification first; we currently can't recover properly from traps inside this instruction */ 2251 2251 rc = PGMVerifyAccess(pVCpu, GCDest - ((offIncrement > 0) ? 0 : ((cTransfers-1) * cbSize)), -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r41838 r41906 632 632 IEMMODE enmMode = CPUMIsGuestIn64BitCodeEx(pCtx) 633 633 ? IEMMODE_64BIT 634 : pCtx->cs Hid.Attr.n.u1DefBig /** @todo check if this is correct... */634 : pCtx->cs.Attr.n.u1DefBig /** @todo check if this is correct... */ 635 635 ? IEMMODE_32BIT 636 636 : IEMMODE_16BIT; … … 684 684 { 685 685 uint32_t GCPtrPC32 = pCtx->eip; 686 AssertMsg(!(GCPtrPC32 & ~(uint32_t)UINT16_MAX) || pIemCpu->enmCpuMode == IEMMODE_32BIT, ("%04x:%RX64\n", pCtx->cs , pCtx->rip));687 if (GCPtrPC32 > pCtx->cs Hid.u32Limit)686 AssertMsg(!(GCPtrPC32 & ~(uint32_t)UINT16_MAX) || pIemCpu->enmCpuMode == IEMMODE_32BIT, ("%04x:%RX64\n", pCtx->cs.Sel, pCtx->rip)); 687 if (GCPtrPC32 > pCtx->cs.u32Limit) 688 688 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 689 cbToTryRead = pCtx->cs Hid.u32Limit - GCPtrPC32 + 1;690 GCPtrPC = pCtx->cs Hid.u64Base + GCPtrPC32;689 cbToTryRead = pCtx->cs.u32Limit - GCPtrPC32 + 1; 690 GCPtrPC = pCtx->cs.u64Base + GCPtrPC32; 691 691 } 692 692 … … 789 789 Assert(!(GCPtrNext32 & ~(uint32_t)UINT16_MAX) || pIemCpu->enmCpuMode == IEMMODE_32BIT); 790 790 GCPtrNext32 += pIemCpu->cbOpcode; 791 if (GCPtrNext32 > pCtx->cs Hid.u32Limit)791 if (GCPtrNext32 > pCtx->cs.u32Limit) 792 792 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 793 cbToTryRead = pCtx->cs Hid.u32Limit - GCPtrNext32 + 1;793 cbToTryRead = pCtx->cs.u32Limit - GCPtrNext32 + 1; 794 794 if (cbToTryRead < cbMin - cbLeft) 795 795 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 796 GCPtrNext = pCtx->cs Hid.u64Base + GCPtrNext32;796 GCPtrNext = pCtx->cs.u64Base + GCPtrNext32; 797 797 } 798 798 … … 1590 1590 *pSelSS = 0; /* make gcc happy */ 1591 1591 1592 switch (pCtx->tr Hid.Attr.n.u4Type)1592 switch (pCtx->tr.Attr.n.u4Type) 1593 1593 { 1594 1594 /* … … 1599 1599 { 1600 1600 uint32_t off = uCpl * 4 + 2; 1601 if (off + 4 > pCtx->tr Hid.u32Limit)1601 if (off + 4 > pCtx->tr.u32Limit) 1602 1602 { 1603 Log(("LoadStackFromTss32Or16: out of bounds! uCpl=%d, u32Limit=%#x TSS16\n", uCpl, pCtx->tr Hid.u32Limit));1603 Log(("LoadStackFromTss32Or16: out of bounds! uCpl=%d, u32Limit=%#x TSS16\n", uCpl, pCtx->tr.u32Limit)); 1604 1604 return iemRaiseTaskSwitchFaultCurrentTSS(pIemCpu); 1605 1605 } 1606 1606 1607 1607 uint32_t u32Tmp = 0; /* gcc maybe... */ 1608 rcStrict = iemMemFetchSysU32(pIemCpu, &u32Tmp, UINT8_MAX, pCtx->tr Hid.u64Base + off);1608 rcStrict = iemMemFetchSysU32(pIemCpu, &u32Tmp, UINT8_MAX, pCtx->tr.u64Base + off); 1609 1609 if (rcStrict == VINF_SUCCESS) 1610 1610 { … … 1623 1623 { 1624 1624 uint32_t off = uCpl * 8 + 4; 1625 if (off + 7 > pCtx->tr Hid.u32Limit)1625 if (off + 7 > pCtx->tr.u32Limit) 1626 1626 { 1627 Log(("LoadStackFromTss32Or16: out of bounds! uCpl=%d, u32Limit=%#x TSS16\n", uCpl, pCtx->tr Hid.u32Limit));1627 Log(("LoadStackFromTss32Or16: out of bounds! uCpl=%d, u32Limit=%#x TSS16\n", uCpl, pCtx->tr.u32Limit)); 1628 1628 return iemRaiseTaskSwitchFaultCurrentTSS(pIemCpu); 1629 1629 } 1630 1630 1631 1631 uint64_t u64Tmp; 1632 rcStrict = iemMemFetchSysU64(pIemCpu, &u64Tmp, UINT8_MAX, pCtx->tr Hid.u64Base + off);1632 rcStrict = iemMemFetchSysU64(pIemCpu, &u64Tmp, UINT8_MAX, pCtx->tr.u64Base + off); 1633 1633 if (rcStrict == VINF_SUCCESS) 1634 1634 { … … 1714 1714 1715 1715 pu16Frame[2] = (uint16_t)pCtx->eflags.u; 1716 pu16Frame[1] = (uint16_t)pCtx->cs ;1716 pu16Frame[1] = (uint16_t)pCtx->cs.Sel; 1717 1717 pu16Frame[0] = pCtx->ip + cbInstr; 1718 1718 rcStrict = iemMemStackPushCommitSpecial(pIemCpu, pu16Frame, uNewRsp); … … 1724 1724 * adjustments. 1725 1725 */ 1726 pCtx->cs = Idte.sel; 1727 pCtx->csHid.u64Base = (uint32_t)Idte.sel << 4; 1726 pCtx->cs.Sel = Idte.sel; 1727 pCtx->cs.ValidSel = Idte.sel; 1728 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1729 pCtx->cs.u64Base = (uint32_t)Idte.sel << 4; 1728 1730 /** @todo do we load attribs and limit as well? Should we check against limit like far jump? */ 1729 1731 pCtx->rip = Idte.off; … … 1956 1958 uStackFrame.pu32[0] = (fFlags & (IEM_XCPT_FLAGS_T_SOFT_INT | IEM_XCPT_FLAGS_BP_INSTR)) == IEM_XCPT_FLAGS_T_SOFT_INT 1957 1959 ? pCtx->eip + cbInstr : pCtx->eip; 1958 uStackFrame.pu32[1] = (pCtx->cs & ~X86_SEL_RPL) | pIemCpu->uCpl;1960 uStackFrame.pu32[1] = (pCtx->cs.Sel & ~X86_SEL_RPL) | pIemCpu->uCpl; 1959 1961 uStackFrame.pu32[2] = pCtx->eflags.u; 1960 1962 uStackFrame.pu32[3] = pCtx->esp; 1961 uStackFrame.pu32[4] = pCtx->ss ;1963 uStackFrame.pu32[4] = pCtx->ss.Sel; 1962 1964 rcStrict = iemMemCommitAndUnmap(pIemCpu, pvStackFrame, IEM_ACCESS_STACK_W | IEM_ACCESS_WHAT_SYS); 1963 1965 if (rcStrict != VINF_SUCCESS) … … 1985 1987 1986 1988 /* 1987 * Start com mintthe register changes (joins with the DPL=CPL branch).1989 * Start comitting the register changes (joins with the DPL=CPL branch). 1988 1990 */ 1989 pCtx->ss = NewSS; 1990 pCtx->ssHid.u32Limit = cbLimitSS; 1991 pCtx->ssHid.u64Base = X86DESC_BASE(DescSS.Legacy); 1992 pCtx->ssHid.Attr.u = X86DESC_GET_HID_ATTR(DescSS.Legacy); 1991 pCtx->ss.Sel = NewSS; 1992 pCtx->ss.ValidSel = NewSS; 1993 pCtx->ss.fFlags = CPUMSELREG_FLAGS_VALID; 1994 pCtx->ss.u32Limit = cbLimitSS; 1995 pCtx->ss.u64Base = X86DESC_BASE(DescSS.Legacy); 1996 pCtx->ss.Attr.u = X86DESC_GET_HID_ATTR(DescSS.Legacy); 1993 1997 pCtx->rsp = uNewEsp - cbStackFrame; /** @todo Is the high word cleared for 16-bit stacks and/or interrupt handlers? */ 1994 1998 pIemCpu->uCpl = uNewCpl; … … 2011 2015 uStackFrame.pu32[0] = (fFlags & (IEM_XCPT_FLAGS_T_SOFT_INT | IEM_XCPT_FLAGS_BP_INSTR)) == IEM_XCPT_FLAGS_T_SOFT_INT 2012 2016 ? pCtx->eip + cbInstr : pCtx->eip; 2013 uStackFrame.pu32[1] = (pCtx->cs & ~X86_SEL_RPL) | pIemCpu->uCpl;2017 uStackFrame.pu32[1] = (pCtx->cs.Sel & ~X86_SEL_RPL) | pIemCpu->uCpl; 2014 2018 uStackFrame.pu32[2] = pCtx->eflags.u; 2015 2019 rcStrict = iemMemCommitAndUnmap(pIemCpu, pvStackFrame, IEM_ACCESS_STACK_W); /* don't use the commit here */ … … 2033 2037 2034 2038 /* ... register committing continues. */ 2035 pCtx->cs = (NewCS & ~X86_SEL_RPL) | uNewCpl; 2036 pCtx->csHid.u32Limit = cbLimitCS; 2037 pCtx->csHid.u64Base = X86DESC_BASE(DescCS.Legacy); 2038 pCtx->csHid.Attr.u = X86DESC_GET_HID_ATTR(DescCS.Legacy); 2039 pCtx->cs.Sel = (NewCS & ~X86_SEL_RPL) | uNewCpl; 2040 pCtx->cs.ValidSel = (NewCS & ~X86_SEL_RPL) | uNewCpl; 2041 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 2042 pCtx->cs.u32Limit = cbLimitCS; 2043 pCtx->cs.u64Base = X86DESC_BASE(DescCS.Legacy); 2044 pCtx->cs.Attr.u = X86DESC_GET_HID_ATTR(DescCS.Legacy); 2039 2045 2040 2046 pCtx->rip = uNewEip; … … 2138 2144 if (pIemCpu->cXcptRecursions == 0) 2139 2145 Log(("iemRaiseXcptOrInt: %#x at %04x:%RGv cbInstr=%#x fFlags=%#x uErr=%#x uCr2=%llx\n", 2140 u8Vector, pCtx->cs , pCtx->rip, cbInstr, fFlags, uErr, uCr2));2146 u8Vector, pCtx->cs.Sel, pCtx->rip, cbInstr, fFlags, uErr, uCr2)); 2141 2147 else 2142 2148 { 2143 2149 Log(("iemRaiseXcptOrInt: %#x at %04x:%RGv cbInstr=%#x fFlags=%#x uErr=%#x uCr2=%llx; prev=%#x depth=%d flags=%#x\n", 2144 u8Vector, pCtx->cs , pCtx->rip, cbInstr, fFlags, uErr, uCr2, pIemCpu->uCurXcpt, pIemCpu->cXcptRecursions + 1, fPrevXcpt));2150 u8Vector, pCtx->cs.Sel, pCtx->rip, cbInstr, fFlags, uErr, uCr2, pIemCpu->uCurXcpt, pIemCpu->cXcptRecursions + 1, fPrevXcpt)); 2145 2151 2146 2152 /** @todo double and tripple faults. */ … … 2221 2227 pIemCpu->fCurXcpt = fPrevXcpt; 2222 2228 LogFlow(("iemRaiseXcptOrInt: returns %Rrc (vec=%#x); cs:rip=%04x:%RGv ss:rsp=%04x:%RGv\n", 2223 VBOXSTRICTRC_VAL(rcStrict), u8Vector, pCtx->cs , pCtx->rip, pCtx->ss, pCtx->esp));2229 VBOXSTRICTRC_VAL(rcStrict), u8Vector, pCtx->cs.Sel, pCtx->rip, pCtx->ss.Sel, pCtx->esp)); 2224 2230 return rcStrict; 2225 2231 } … … 2268 2274 { 2269 2275 return iemRaiseXcptOrInt(pIemCpu, 0, X86_XCPT_TS, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR, 2270 pIemCpu->CTX_SUFF(pCtx)->tr , 0);2276 pIemCpu->CTX_SUFF(pCtx)->tr.Sel, 0); 2271 2277 } 2272 2278 … … 2642 2648 switch (iSegReg) 2643 2649 { 2644 case X86_SREG_ES: return &pCtx->esHid;2645 case X86_SREG_CS: return &pCtx->csHid;2646 case X86_SREG_SS: return &pCtx->ssHid;2647 case X86_SREG_DS: return &pCtx->dsHid;2648 case X86_SREG_FS: return &pCtx->fsHid;2649 case X86_SREG_GS: return &pCtx->gsHid;2650 }2651 AssertFailedReturn(NULL);2652 }2653 2654 2655 /**2656 * Gets a reference (pointer) to the specified segment register (the selector2657 * value).2658 *2659 * @returns Pointer to the selector variable.2660 * @param pIemCpu The per CPU data.2661 * @param iSegReg The segment register.2662 */2663 static uint16_t *iemSRegRef(PIEMCPU pIemCpu, uint8_t iSegReg)2664 {2665 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);2666 switch (iSegReg)2667 {2668 2650 case X86_SREG_ES: return &pCtx->es; 2669 2651 case X86_SREG_CS: return &pCtx->cs; … … 2678 2660 2679 2661 /** 2662 * Gets a reference (pointer) to the specified segment register (the selector 2663 * value). 2664 * 2665 * @returns Pointer to the selector variable. 2666 * @param pIemCpu The per CPU data. 2667 * @param iSegReg The segment register. 2668 */ 2669 static uint16_t *iemSRegRef(PIEMCPU pIemCpu, uint8_t iSegReg) 2670 { 2671 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 2672 switch (iSegReg) 2673 { 2674 case X86_SREG_ES: return &pCtx->es.Sel; 2675 case X86_SREG_CS: return &pCtx->cs.Sel; 2676 case X86_SREG_SS: return &pCtx->ss.Sel; 2677 case X86_SREG_DS: return &pCtx->ds.Sel; 2678 case X86_SREG_FS: return &pCtx->fs.Sel; 2679 case X86_SREG_GS: return &pCtx->gs.Sel; 2680 } 2681 AssertFailedReturn(NULL); 2682 } 2683 2684 2685 /** 2680 2686 * Fetches the selector value of a segment register. 2681 2687 * … … 2689 2695 switch (iSegReg) 2690 2696 { 2691 case X86_SREG_ES: return pCtx->es ;2692 case X86_SREG_CS: return pCtx->cs ;2693 case X86_SREG_SS: return pCtx->ss ;2694 case X86_SREG_DS: return pCtx->ds ;2695 case X86_SREG_FS: return pCtx->fs ;2696 case X86_SREG_GS: return pCtx->gs ;2697 case X86_SREG_ES: return pCtx->es.Sel; 2698 case X86_SREG_CS: return pCtx->cs.Sel; 2699 case X86_SREG_SS: return pCtx->ss.Sel; 2700 case X86_SREG_DS: return pCtx->ds.Sel; 2701 case X86_SREG_FS: return pCtx->fs.Sel; 2702 case X86_SREG_GS: return pCtx->gs.Sel; 2697 2703 } 2698 2704 AssertFailedReturn(0xffff); … … 2842 2848 { 2843 2849 uint16_t uNewIp = pCtx->ip + offNextInstr + pIemCpu->offOpcode; 2844 if ( uNewIp > pCtx->cs Hid.u32Limit2850 if ( uNewIp > pCtx->cs.u32Limit 2845 2851 && pIemCpu->enmCpuMode != IEMMODE_64BIT) /* no need to check for non-canonical. */ 2846 2852 return iemRaiseGeneralProtectionFault0(pIemCpu); … … 2855 2861 2856 2862 uint32_t uNewEip = pCtx->eip + offNextInstr + pIemCpu->offOpcode; 2857 if (uNewEip > pCtx->cs Hid.u32Limit)2863 if (uNewEip > pCtx->cs.u32Limit) 2858 2864 return iemRaiseGeneralProtectionFault0(pIemCpu); 2859 2865 pCtx->rip = uNewEip; … … 2895 2901 2896 2902 uint16_t uNewIp = pCtx->ip + offNextInstr + pIemCpu->offOpcode; 2897 if ( uNewIp > pCtx->cs Hid.u32Limit2903 if ( uNewIp > pCtx->cs.u32Limit 2898 2904 && pIemCpu->enmCpuMode != IEMMODE_64BIT) /* no need to check for non-canonical. */ 2899 2905 return iemRaiseGeneralProtectionFault0(pIemCpu); … … 2925 2931 2926 2932 uint32_t uNewEip = pCtx->eip + offNextInstr + pIemCpu->offOpcode; 2927 if (uNewEip > pCtx->cs Hid.u32Limit)2933 if (uNewEip > pCtx->cs.u32Limit) 2928 2934 return iemRaiseGeneralProtectionFault0(pIemCpu); 2929 2935 pCtx->rip = uNewEip; … … 2959 2965 { 2960 2966 Assert(uNewRip <= UINT16_MAX); 2961 if ( uNewRip > pCtx->cs Hid.u32Limit2967 if ( uNewRip > pCtx->cs.u32Limit 2962 2968 && pIemCpu->enmCpuMode != IEMMODE_64BIT) /* no need to check for non-canonical. */ 2963 2969 return iemRaiseGeneralProtectionFault0(pIemCpu); … … 2973 2979 Assert(pIemCpu->enmCpuMode != IEMMODE_64BIT); 2974 2980 2975 if (uNewRip > pCtx->cs Hid.u32Limit)2981 if (uNewRip > pCtx->cs.u32Limit) 2976 2982 return iemRaiseGeneralProtectionFault0(pIemCpu); 2977 2983 pCtx->rip = uNewRip; … … 3004 3010 DECLINLINE(RTGCPTR) iemRegGetEffRsp(PCCPUMCTX pCtx) 3005 3011 { 3006 if (pCtx->ss Hid.Attr.n.u1Long)3012 if (pCtx->ss.Attr.n.u1Long) 3007 3013 return pCtx->rsp; 3008 if (pCtx->ss Hid.Attr.n.u1DefBig)3014 if (pCtx->ss.Attr.n.u1DefBig) 3009 3015 return pCtx->esp; 3010 3016 return pCtx->sp; … … 3062 3068 DECLINLINE(void) iemRegAddToRsp(PCPUMCTX pCtx, uint8_t cbToAdd) 3063 3069 { 3064 if (pCtx->ss Hid.Attr.n.u1Long)3070 if (pCtx->ss.Attr.n.u1Long) 3065 3071 pCtx->rsp += cbToAdd; 3066 else if (pCtx->ss Hid.Attr.n.u1DefBig)3072 else if (pCtx->ss.Attr.n.u1DefBig) 3067 3073 pCtx->esp += cbToAdd; 3068 3074 else … … 3080 3086 DECLINLINE(void) iemRegSubFromRsp(PCPUMCTX pCtx, uint8_t cbToSub) 3081 3087 { 3082 if (pCtx->ss Hid.Attr.n.u1Long)3088 if (pCtx->ss.Attr.n.u1Long) 3083 3089 pCtx->rsp -= cbToSub; 3084 else if (pCtx->ss Hid.Attr.n.u1DefBig)3090 else if (pCtx->ss.Attr.n.u1DefBig) 3085 3091 pCtx->esp -= cbToSub; 3086 3092 else … … 3098 3104 DECLINLINE(void) iemRegAddToRspEx(PRTUINT64U pTmpRsp, uint8_t cbToAdd, PCCPUMCTX pCtx) 3099 3105 { 3100 if (pCtx->ss Hid.Attr.n.u1Long)3106 if (pCtx->ss.Attr.n.u1Long) 3101 3107 pTmpRsp->u += cbToAdd; 3102 else if (pCtx->ss Hid.Attr.n.u1DefBig)3108 else if (pCtx->ss.Attr.n.u1DefBig) 3103 3109 pTmpRsp->DWords.dw0 += cbToAdd; 3104 3110 else … … 3116 3122 DECLINLINE(void) iemRegSubFromRspEx(PRTUINT64U pTmpRsp, uint8_t cbToSub, PCCPUMCTX pCtx) 3117 3123 { 3118 if (pCtx->ss Hid.Attr.n.u1Long)3124 if (pCtx->ss.Attr.n.u1Long) 3119 3125 pTmpRsp->u -= cbToSub; 3120 else if (pCtx->ss Hid.Attr.n.u1DefBig)3126 else if (pCtx->ss.Attr.n.u1DefBig) 3121 3127 pTmpRsp->DWords.dw0 -= cbToSub; 3122 3128 else … … 3140 3146 uTmpRsp.u = pCtx->rsp; 3141 3147 3142 if (pCtx->ss Hid.Attr.n.u1Long)3148 if (pCtx->ss.Attr.n.u1Long) 3143 3149 GCPtrTop = uTmpRsp.u -= cbItem; 3144 else if (pCtx->ss Hid.Attr.n.u1DefBig)3150 else if (pCtx->ss.Attr.n.u1DefBig) 3145 3151 GCPtrTop = uTmpRsp.DWords.dw0 -= cbItem; 3146 3152 else … … 3166 3172 uTmpRsp.u = pCtx->rsp; 3167 3173 3168 if (pCtx->ss Hid.Attr.n.u1Long)3174 if (pCtx->ss.Attr.n.u1Long) 3169 3175 { 3170 3176 GCPtrTop = uTmpRsp.u; 3171 3177 uTmpRsp.u += cbItem; 3172 3178 } 3173 else if (pCtx->ss Hid.Attr.n.u1DefBig)3179 else if (pCtx->ss.Attr.n.u1DefBig) 3174 3180 { 3175 3181 GCPtrTop = uTmpRsp.DWords.dw0; … … 3199 3205 RTGCPTR GCPtrTop; 3200 3206 3201 if (pCtx->ss Hid.Attr.n.u1Long)3207 if (pCtx->ss.Attr.n.u1Long) 3202 3208 GCPtrTop = pTmpRsp->u -= cbItem; 3203 else if (pCtx->ss Hid.Attr.n.u1DefBig)3209 else if (pCtx->ss.Attr.n.u1DefBig) 3204 3210 GCPtrTop = pTmpRsp->DWords.dw0 -= cbItem; 3205 3211 else … … 3221 3227 { 3222 3228 RTGCPTR GCPtrTop; 3223 if (pCtx->ss Hid.Attr.n.u1Long)3229 if (pCtx->ss.Attr.n.u1Long) 3224 3230 { 3225 3231 GCPtrTop = pTmpRsp->u; 3226 3232 pTmpRsp->u += cbItem; 3227 3233 } 3228 else if (pCtx->ss Hid.Attr.n.u1DefBig)3234 else if (pCtx->ss.Attr.n.u1DefBig) 3229 3235 { 3230 3236 GCPtrTop = pTmpRsp->DWords.dw0; … … 3335 3341 * happens in real mode here based on the fnsave and fnstenv images. */ 3336 3342 pCtx->fpu.CS = 0; 3337 pCtx->fpu.FPUIP = pCtx->eip | ((uint32_t)pCtx->cs << 4);3343 pCtx->fpu.FPUIP = pCtx->eip | ((uint32_t)pCtx->cs.Sel << 4); 3338 3344 } 3339 3345 else 3340 3346 { 3341 pCtx->fpu.CS = pCtx->cs ;3347 pCtx->fpu.CS = pCtx->cs.Sel; 3342 3348 pCtx->fpu.FPUIP = pCtx->rip; 3343 3349 } … … 3358 3364 switch (iEffSeg) 3359 3365 { 3360 case X86_SREG_DS: sel = pCtx->ds ; break;3361 case X86_SREG_SS: sel = pCtx->ss ; break;3362 case X86_SREG_CS: sel = pCtx->cs ; break;3363 case X86_SREG_ES: sel = pCtx->es ; break;3364 case X86_SREG_FS: sel = pCtx->fs ; break;3365 case X86_SREG_GS: sel = pCtx->gs ; break;3366 case X86_SREG_DS: sel = pCtx->ds.Sel; break; 3367 case X86_SREG_SS: sel = pCtx->ss.Sel; break; 3368 case X86_SREG_CS: sel = pCtx->cs.Sel; break; 3369 case X86_SREG_ES: sel = pCtx->es.Sel; break; 3370 case X86_SREG_FS: sel = pCtx->fs.Sel; break; 3371 case X86_SREG_GS: sel = pCtx->gs.Sel; break; 3366 3372 default: 3367 3373 AssertMsgFailed(("%d\n", iEffSeg)); 3368 sel = pCtx->ds ;3374 sel = pCtx->ds.Sel; 3369 3375 } 3370 3376 /** @todo FPU.DS and FPUDP needs to be kept seperately. */ … … 5777 5783 if (uSel & X86_SEL_LDT) 5778 5784 { 5779 if ( !pCtx->ldtr Hid.Attr.n.u1Present5780 || (uSel | 0x7U) > pCtx->ldtr Hid.u32Limit )5785 if ( !pCtx->ldtr.Attr.n.u1Present 5786 || (uSel | 0x7U) > pCtx->ldtr.u32Limit ) 5781 5787 { 5782 5788 Log(("iemMemFetchSelDesc: LDT selector %#x is out of bounds (%3x) or ldtr is NP (%#x)\n", 5783 uSel, pCtx->ldtr Hid.u32Limit, pCtx->ldtr));5789 uSel, pCtx->ldtr.u32Limit, pCtx->ldtr.Sel)); 5784 5790 /** @todo is this the right exception? */ 5785 5791 return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel); 5786 5792 } 5787 5793 5788 Assert(pCtx->ldtr Hid.Attr.n.u1Present);5789 GCPtrBase = pCtx->ldtr Hid.u64Base;5794 Assert(pCtx->ldtr.Attr.n.u1Present); 5795 GCPtrBase = pCtx->ldtr.u64Base; 5790 5796 } 5791 5797 else … … 5810 5816 || pDesc->Legacy.Gen.u1DescType) 5811 5817 pDesc->Long.au64[1] = 0; 5812 else if ((uint32_t)(uSel & X86_SEL_MASK) + 15 < (uSel & X86_SEL_LDT ? pCtx->ldtr Hid.u32Limit : pCtx->gdtr.cbGdt))5818 else if ((uint32_t)(uSel & X86_SEL_MASK) + 15 < (uSel & X86_SEL_LDT ? pCtx->ldtr.u32Limit : pCtx->gdtr.cbGdt)) 5813 5819 rcStrict = iemMemFetchSysU64(pIemCpu, &pDesc->Legacy.u, UINT8_MAX, GCPtrBase + (uSel & X86_SEL_MASK)); 5814 5820 else … … 5859 5865 */ 5860 5866 RTGCPTR GCPtr = uSel & X86_SEL_LDT 5861 ? pCtx->ldtr Hid.u64Base5867 ? pCtx->ldtr.u64Base 5862 5868 : pCtx->gdtr.pGdt; 5863 5869 GCPtr += uSel & X86_SEL_MASK; … … 6605 6611 #ifdef DEBUG 6606 6612 # define IEMOP_MNEMONIC(a_szMnemonic) \ 6607 Log4(("decode - %04x:%RGv %s%s [#%u]\n", pIemCpu->CTX_SUFF(pCtx)->cs , pIemCpu->CTX_SUFF(pCtx)->rip, \6613 Log4(("decode - %04x:%RGv %s%s [#%u]\n", pIemCpu->CTX_SUFF(pCtx)->cs.Sel, pIemCpu->CTX_SUFF(pCtx)->rip, \ 6608 6614 pIemCpu->fPrefixes & IEM_OP_PRF_LOCK ? "lock " : "", a_szMnemonic, pIemCpu->cInstructions)) 6609 6615 # define IEMOP_MNEMONIC2(a_szMnemonic, a_szOps) \ 6610 Log4(("decode - %04x:%RGv %s%s %s [#%u]\n", pIemCpu->CTX_SUFF(pCtx)->cs , pIemCpu->CTX_SUFF(pCtx)->rip, \6616 Log4(("decode - %04x:%RGv %s%s %s [#%u]\n", pIemCpu->CTX_SUFF(pCtx)->cs.Sel, pIemCpu->CTX_SUFF(pCtx)->rip, \ 6611 6617 pIemCpu->fPrefixes & IEM_OP_PRF_LOCK ? "lock " : "", a_szMnemonic, a_szOps, pIemCpu->cInstructions)) 6612 6618 #else … … 7872 7878 pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi, 7873 7879 pCtx->eip, pCtx->esp, pCtx->ebp, pCtx->eflags.Bits.u2IOPL, 7874 (RTSEL)pCtx->cs, (RTSEL)pCtx->ss, (RTSEL)pCtx->ds, (RTSEL)pCtx->es,7875 (RTSEL)pCtx->fs, (RTSEL)pCtx->gs, pCtx->eflags.u,7880 pCtx->cs.Sel, pCtx->ss.Sel, pCtx->ds.Sel, pCtx->es.Sel, 7881 pCtx->fs.Sel, pCtx->gs.Sel, pCtx->eflags.u, 7876 7882 pCtx->fpu.FSW, pCtx->fpu.FCW, pCtx->fpu.FTW, pCtx->fpu.MXCSR, pCtx->fpu.MXCSR_MASK, 7877 7883 szInstr)); … … 7883 7889 # endif 7884 7890 LogFlow(("IEMExecOne: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x\n", 7885 pCtx->cs , pCtx->rip, pCtx->ss, pCtx->rsp, pCtx->eflags.u));7891 pCtx->cs.Sel, pCtx->rip, pCtx->ss.Sel, pCtx->rsp, pCtx->eflags.u)); 7886 7892 #endif 7887 7893 … … 7901 7907 if (rcStrict != VINF_SUCCESS) 7902 7908 LogFlow(("IEMExecOne: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x - rcStrict=%Rrc\n", 7903 pCtx->cs , pCtx->rip, pCtx->ss, pCtx->rsp, pCtx->eflags.u, VBOXSTRICTRC_VAL(rcStrict)));7909 pCtx->cs.Sel, pCtx->rip, pCtx->ss.Sel, pCtx->rsp, pCtx->eflags.u, VBOXSTRICTRC_VAL(rcStrict))); 7904 7910 return rcStrict; 7905 7911 } -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r41783 r41906 103 103 * visible parts, in protected mode. 104 104 * 105 * @param puSel The selector register. 106 * @param pHid The hidden register part. 107 */ 108 static void iemHlpLoadNullDataSelectorProt(PRTSEL puSel, PCPUMSELREGHID pHid) 105 * @param pSReg Pointer to the segment register. 106 */ 107 static void iemHlpLoadNullDataSelectorProt(PCPUMSELREG pSReg) 109 108 { 110 109 /** @todo Testcase: write a testcase checking what happends when loading a NULL 111 110 * data selector in protected mode. */ 112 pHid->u64Base = 0; 113 pHid->u32Limit = 0; 114 pHid->Attr.u = 0; 115 *puSel = 0; 111 pSReg->Sel = 0; 112 pSReg->ValidSel = 0; 113 pSReg->fFlags = CPUMSELREG_FLAGS_VALID; 114 pSReg->u64Base = 0; 115 pSReg->u32Limit = 0; 116 pSReg->Attr.u = 0; 116 117 } 117 118 … … 121 122 * 122 123 * @param uCpl The new CPL. 123 * @param puSel The selector register. 124 * @param pHid The corresponding hidden register. 125 */ 126 static void iemHlpAdjustSelectorForNewCpl(uint8_t uCpl, PRTSEL puSel, PCPUMSELREGHID pHid) 127 { 128 if ( uCpl > pHid->Attr.n.u2Dpl 129 && pHid->Attr.n.u1DescType /* code or data, not system */ 130 && (pHid->Attr.n.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF)) 131 != (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF)) /* not conforming code */ 132 iemHlpLoadNullDataSelectorProt(puSel, pHid); 124 * @param pSReg Pointer to the segment register. 125 */ 126 static void iemHlpAdjustSelectorForNewCpl(uint8_t uCpl, PCPUMSELREG pSReg) 127 { 128 if ( uCpl > pSReg->Attr.n.u2Dpl 129 && pSReg->Attr.n.u1DescType /* code or data, not system */ 130 && (pSReg->Attr.n.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF)) 131 != (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF)) /* not conforming code */ 132 iemHlpLoadNullDataSelectorProt(pSReg); 133 133 } 134 134 … … 158 158 /** @todo do popa boundary / wrap-around checks. */ 159 159 if (RT_UNLIKELY( IEM_IS_REAL_OR_V86_MODE(pIemCpu) 160 && (pCtx->cs Hid.u32Limit < GCPtrLast)) ) /* ASSUMES 64-bit RTGCPTR */160 && (pCtx->cs.u32Limit < GCPtrLast)) ) /* ASSUMES 64-bit RTGCPTR */ 161 161 { 162 162 /* word-by-word */ … … 230 230 /** @todo do popa boundary / wrap-around checks. */ 231 231 if (RT_UNLIKELY( IEM_IS_REAL_OR_V86_MODE(pIemCpu) 232 && (pCtx->cs Hid.u32Limit < GCPtrLast)) ) /* ASSUMES 64-bit RTGCPTR */232 && (pCtx->cs.u32Limit < GCPtrLast)) ) /* ASSUMES 64-bit RTGCPTR */ 233 233 { 234 234 /* word-by-word */ … … 632 632 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 633 633 uint16_t uOldPC = pCtx->ip + cbInstr; 634 if (uNewPC > pCtx->cs Hid.u32Limit)634 if (uNewPC > pCtx->cs.u32Limit) 635 635 return iemRaiseGeneralProtectionFault0(pIemCpu); 636 636 … … 655 655 uint16_t uOldPC = pCtx->ip + cbInstr; 656 656 uint16_t uNewPC = uOldPC + offDisp; 657 if (uNewPC > pCtx->cs Hid.u32Limit)657 if (uNewPC > pCtx->cs.u32Limit) 658 658 return iemRaiseGeneralProtectionFault0(pIemCpu); 659 659 … … 678 678 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 679 679 uint32_t uOldPC = pCtx->eip + cbInstr; 680 if (uNewPC > pCtx->cs Hid.u32Limit)680 if (uNewPC > pCtx->cs.u32Limit) 681 681 return iemRaiseGeneralProtectionFault0(pIemCpu); 682 682 … … 701 701 uint32_t uOldPC = pCtx->eip + cbInstr; 702 702 uint32_t uNewPC = uOldPC + offDisp; 703 if (uNewPC > pCtx->cs Hid.u32Limit)703 if (uNewPC > pCtx->cs.u32Limit) 704 704 return iemRaiseGeneralProtectionFault0(pIemCpu); 705 705 … … 891 891 && IEM_IS_REAL_OR_V86_MODE(pIemCpu)) 892 892 { 893 if (offSeg > pCtx->cs Hid.u32Limit)893 if (offSeg > pCtx->cs.u32Limit) 894 894 return iemRaiseGeneralProtectionFault0(pIemCpu); 895 895 … … 898 898 else 899 899 pCtx->rip = offSeg & UINT16_MAX; 900 pCtx->cs = uSel; 901 pCtx->csHid.u64Base = (uint32_t)uSel << 4; 900 pCtx->cs.Sel = uSel; 901 pCtx->cs.ValidSel = uSel; 902 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 903 pCtx->cs.u64Base = (uint32_t)uSel << 4; 902 904 /** @todo REM reset the accessed bit (see on jmp far16 after disabling 903 905 * PE. Check with VT-x and AMD-V. */ 904 906 #ifdef IEM_VERIFICATION_MODE 905 pCtx->cs Hid.Attr.u&= ~X86_SEL_TYPE_ACCESSED;907 pCtx->cs.Attr.u &= ~X86_SEL_TYPE_ACCESSED; 906 908 #endif 907 909 return VINF_SUCCESS; … … 1015 1017 /* commit */ 1016 1018 pCtx->rip = offSeg; 1017 pCtx->cs = uSel & (X86_SEL_MASK | X86_SEL_LDT); 1018 pCtx->cs |= pIemCpu->uCpl; /** @todo is this right for conforming segs? or in general? */ 1019 pCtx->csHid.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 1020 pCtx->csHid.u32Limit = cbLimit; 1021 pCtx->csHid.u64Base = u64Base; 1019 pCtx->cs.Sel = uSel & (X86_SEL_MASK | X86_SEL_LDT); 1020 pCtx->cs.Sel |= pIemCpu->uCpl; /** @todo is this right for conforming segs? or in general? */ 1021 pCtx->cs.ValidSel = pCtx->cs.Sel; 1022 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1023 pCtx->cs.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 1024 pCtx->cs.u32Limit = cbLimit; 1025 pCtx->cs.u64Base = u64Base; 1022 1026 /** @todo check if the hidden bits are loaded correctly for 64-bit 1023 1027 * mode. */ … … 1066 1070 { 1067 1071 uPtrRet.pu16[0] = pCtx->ip + cbInstr; 1068 uPtrRet.pu16[1] = pCtx->cs ;1072 uPtrRet.pu16[1] = pCtx->cs.Sel; 1069 1073 } 1070 1074 else 1071 1075 { 1072 1076 uPtrRet.pu32[0] = pCtx->eip + cbInstr; 1073 uPtrRet.pu16[3] = pCtx->cs ;1077 uPtrRet.pu16[3] = pCtx->cs.Sel; 1074 1078 } 1075 1079 rcStrict = iemMemStackPushCommitSpecial(pIemCpu, uPtrRet.pv, uNewRsp); … … 1079 1083 /* Branch. */ 1080 1084 pCtx->rip = offSeg; 1081 pCtx->cs = uSel; 1082 pCtx->csHid.u64Base = (uint32_t)uSel << 4; 1085 pCtx->cs.Sel = uSel; 1086 pCtx->cs.ValidSel = uSel; 1087 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1088 pCtx->cs.u64Base = (uint32_t)uSel << 4; 1083 1089 /** @todo Does REM reset the accessed bit here too? (See on jmp far16 1084 1090 * after disabling PE.) Check with VT-x and AMD-V. */ 1085 1091 #ifdef IEM_VERIFICATION_MODE 1086 pCtx->cs Hid.Attr.u&= ~X86_SEL_TYPE_ACCESSED;1092 pCtx->cs.Attr.u &= ~X86_SEL_TYPE_ACCESSED; 1087 1093 #endif 1088 1094 return VINF_SUCCESS; … … 1217 1223 { 1218 1224 uPtrRet.pu16[0] = pCtx->ip + cbInstr; 1219 uPtrRet.pu16[1] = pCtx->cs ;1225 uPtrRet.pu16[1] = pCtx->cs.Sel; 1220 1226 } 1221 1227 else if (enmEffOpSize == IEMMODE_32BIT) 1222 1228 { 1223 1229 uPtrRet.pu32[0] = pCtx->eip + cbInstr; 1224 uPtrRet.pu32[1] = pCtx->cs ; /** @todo Testcase: What is written to the high word when callf is pushing CS? */1230 uPtrRet.pu32[1] = pCtx->cs.Sel; /** @todo Testcase: What is written to the high word when callf is pushing CS? */ 1225 1231 } 1226 1232 else 1227 1233 { 1228 1234 uPtrRet.pu64[0] = pCtx->rip + cbInstr; 1229 uPtrRet.pu64[1] = pCtx->cs ; /** @todo Testcase: What is written to the high words when callf is pushing CS? */1235 uPtrRet.pu64[1] = pCtx->cs.Sel; /** @todo Testcase: What is written to the high words when callf is pushing CS? */ 1230 1236 } 1231 1237 rcStrict = iemMemStackPushCommitSpecial(pIemCpu, uPtrRet.pv, uNewRsp); … … 1235 1241 /* commit */ 1236 1242 pCtx->rip = offSeg; 1237 pCtx->cs = uSel & (X86_SEL_MASK | X86_SEL_LDT); 1238 pCtx->cs |= pIemCpu->uCpl; 1239 pCtx->csHid.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 1240 pCtx->csHid.u32Limit = cbLimit; 1241 pCtx->csHid.u64Base = u64Base; 1243 pCtx->cs.Sel = uSel & (X86_SEL_MASK | X86_SEL_LDT); 1244 pCtx->cs.Sel |= pIemCpu->uCpl; 1245 pCtx->cs.ValidSel = pCtx->cs.Sel; 1246 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1247 pCtx->cs.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 1248 pCtx->cs.u32Limit = cbLimit; 1249 pCtx->cs.u64Base = u64Base; 1242 1250 /** @todo check if the hidden bits are loaded correctly for 64-bit 1243 1251 * mode. */ … … 1299 1307 /** @todo Intel pseudo code only does the limit check for 16-bit 1300 1308 * operands, AMD does not make any distinction. What is right? */ 1301 if (uNewRip > pCtx->cs Hid.u32Limit)1309 if (uNewRip > pCtx->cs.u32Limit) 1302 1310 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 1303 1311 … … 1307 1315 return rcStrict; 1308 1316 pCtx->rip = uNewRip; 1309 pCtx->cs = uNewCs; 1310 pCtx->csHid.u64Base = (uint32_t)uNewCs << 4; 1317 pCtx->cs.Sel = uNewCs; 1318 pCtx->cs.ValidSel = uNewCs; 1319 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1320 pCtx->cs.u64Base = (uint32_t)uNewCs << 4; 1311 1321 /** @todo do we load attribs and limit as well? */ 1312 1322 if (cbPop) … … 1540 1550 else 1541 1551 pCtx->rip = uNewRip; 1542 pCtx->cs = uNewCs; 1543 pCtx->csHid.Attr.u = X86DESC_GET_HID_ATTR(DescCs.Legacy); 1544 pCtx->csHid.u32Limit = cbLimitCs; 1545 pCtx->csHid.u64Base = u64Base; 1552 pCtx->cs.Sel = uNewCs; 1553 pCtx->cs.ValidSel = uNewCs; 1554 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1555 pCtx->cs.Attr.u = X86DESC_GET_HID_ATTR(DescCs.Legacy); 1556 pCtx->cs.u32Limit = cbLimitCs; 1557 pCtx->cs.u64Base = u64Base; 1546 1558 pCtx->rsp = uNewRsp; 1547 pCtx->ss = uNewCs; 1548 pCtx->ssHid.Attr.u = X86DESC_GET_HID_ATTR(DescSs.Legacy); 1549 pCtx->ssHid.u32Limit = cbLimitSs; 1559 pCtx->ss.Sel = uNewOuterSs; 1560 pCtx->ss.ValidSel = uNewOuterSs; 1561 pCtx->ss.fFlags = CPUMSELREG_FLAGS_VALID; 1562 pCtx->ss.Attr.u = X86DESC_GET_HID_ATTR(DescSs.Legacy); 1563 pCtx->ss.u32Limit = cbLimitSs; 1550 1564 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 1551 pCtx->ss Hid.u64Base= 0;1565 pCtx->ss.u64Base = 0; 1552 1566 else 1553 pCtx->ss Hid.u64Base= X86DESC_BASE(DescSs.Legacy);1567 pCtx->ss.u64Base = X86DESC_BASE(DescSs.Legacy); 1554 1568 1555 1569 pIemCpu->uCpl = (uNewCs & X86_SEL_RPL); 1556 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->ds , &pCtx->dsHid);1557 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->es , &pCtx->esHid);1558 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->fs , &pCtx->fsHid);1559 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->gs , &pCtx->gsHid);1570 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->ds); 1571 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->es); 1572 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->fs); 1573 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->gs); 1560 1574 1561 1575 /** @todo check if the hidden bits are loaded correctly for 64-bit … … 1618 1632 return rcStrict; 1619 1633 if (enmEffOpSize == IEMMODE_16BIT) 1620 pCtx->rip 1634 pCtx->rip = uNewRip & UINT16_MAX; /** @todo Testcase: When exactly does this occur? With call it happens prior to the limit check according to Intel... */ 1621 1635 else 1622 pCtx->rip = uNewRip; 1623 pCtx->cs = uNewCs; 1624 pCtx->csHid.Attr.u = X86DESC_GET_HID_ATTR(DescCs.Legacy); 1625 pCtx->csHid.u32Limit = cbLimitCs; 1626 pCtx->csHid.u64Base = u64Base; 1636 pCtx->rip = uNewRip; 1637 pCtx->cs.Sel = uNewCs; 1638 pCtx->cs.ValidSel = uNewCs; 1639 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1640 pCtx->cs.Attr.u = X86DESC_GET_HID_ATTR(DescCs.Legacy); 1641 pCtx->cs.u32Limit = cbLimitCs; 1642 pCtx->cs.u64Base = u64Base; 1627 1643 /** @todo check if the hidden bits are loaded correctly for 64-bit 1628 1644 * mode. */ … … 1677 1693 if (enmEffOpSize != IEMMODE_64BIT) 1678 1694 { 1679 if (NewRip.DWords.dw0 > pCtx->cs Hid.u32Limit)1680 { 1681 Log(("retn newrip=%llx - out of bounds (%x) -> #GP\n", NewRip.u, pCtx->cs Hid.u32Limit));1695 if (NewRip.DWords.dw0 > pCtx->cs.u32Limit) 1696 { 1697 Log(("retn newrip=%llx - out of bounds (%x) -> #GP\n", NewRip.u, pCtx->cs.u32Limit)); 1682 1698 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 1683 1699 } … … 1716 1732 /* Calculate the intermediate RSP from RBP and the stack attributes. */ 1717 1733 RTUINT64U NewRsp; 1718 if (pCtx->ss Hid.Attr.n.u1Long)1734 if (pCtx->ss.Attr.n.u1Long) 1719 1735 { 1720 1736 /** @todo Check that LEAVE actually preserve the high EBP bits. */ … … 1722 1738 NewRsp.Words.w0 = pCtx->bp; 1723 1739 } 1724 else if (pCtx->ss Hid.Attr.n.u1DefBig)1740 else if (pCtx->ss.Attr.n.u1DefBig) 1725 1741 NewRsp.u = pCtx->ebp; 1726 1742 else … … 1839 1855 /** @todo Only the AMD pseudo code check the limit here, what's 1840 1856 * right? */ 1841 if (uNewEip > pCtx->cs Hid.u32Limit)1857 if (uNewEip > pCtx->cs.u32Limit) 1842 1858 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 1843 1859 … … 1875 1891 return rcStrict; 1876 1892 pCtx->rip = uNewEip; 1877 pCtx->cs = uNewCs; 1878 pCtx->csHid.u64Base = (uint32_t)uNewCs << 4; 1893 pCtx->cs.Sel = uNewCs; 1894 pCtx->cs.ValidSel = uNewCs; 1895 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1896 pCtx->cs.u64Base = (uint32_t)uNewCs << 4; 1879 1897 /** @todo do we load attribs and limit as well? */ 1880 1898 Assert(uNewFlags & X86_EFL_1); … … 2113 2131 } 2114 2132 2115 pCtx->rip = uNewEip; 2116 pCtx->cs = uNewCs; 2117 pCtx->csHid.Attr.u = X86DESC_GET_HID_ATTR(DescCS.Legacy); 2118 pCtx->csHid.u32Limit = cbLimitCS; 2119 pCtx->csHid.u64Base = X86DESC_BASE(DescCS.Legacy); 2120 pCtx->rsp = uNewESP; 2121 pCtx->ss = uNewSS; 2122 pCtx->ssHid.Attr.u = X86DESC_GET_HID_ATTR(DescSS.Legacy); 2123 pCtx->ssHid.u32Limit = cbLimitSs; 2124 pCtx->ssHid.u64Base = X86DESC_BASE(DescSS.Legacy); 2133 pCtx->rip = uNewEip; 2134 pCtx->cs.Sel = uNewCs; 2135 pCtx->cs.ValidSel = uNewCs; 2136 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 2137 pCtx->cs.Attr.u = X86DESC_GET_HID_ATTR(DescCS.Legacy); 2138 pCtx->cs.u32Limit = cbLimitCS; 2139 pCtx->cs.u64Base = X86DESC_BASE(DescCS.Legacy); 2140 pCtx->rsp = uNewESP; 2141 pCtx->ss.Sel = uNewSS; 2142 pCtx->ss.ValidSel = uNewSS; 2143 pCtx->ss.fFlags = CPUMSELREG_FLAGS_VALID; 2144 pCtx->ss.Attr.u = X86DESC_GET_HID_ATTR(DescSS.Legacy); 2145 pCtx->ss.u32Limit = cbLimitSs; 2146 pCtx->ss.u64Base = X86DESC_BASE(DescSS.Legacy); 2125 2147 2126 2148 uint32_t fEFlagsMask = X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF … … 2132 2154 else if (pIemCpu->uCpl <= pCtx->eflags.Bits.u2IOPL) 2133 2155 fEFlagsMask |= X86_EFL_IF; 2134 pCtx->eflags.u 2135 pCtx->eflags.u 2136 2137 pIemCpu->uCpl 2138 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->ds , &pCtx->dsHid);2139 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->es , &pCtx->esHid);2140 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->fs , &pCtx->fsHid);2141 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->gs , &pCtx->gsHid);2156 pCtx->eflags.u &= ~fEFlagsMask; 2157 pCtx->eflags.u |= fEFlagsMask & uNewFlags; 2158 2159 pIemCpu->uCpl = uNewCs & X86_SEL_RPL; 2160 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->ds); 2161 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->es); 2162 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->fs); 2163 iemHlpAdjustSelectorForNewCpl(uNewCs & X86_SEL_RPL, &pCtx->gs); 2142 2164 2143 2165 /* Done! */ … … 2167 2189 } 2168 2190 2169 pCtx->rip = uNewEip; 2170 pCtx->cs = uNewCs; 2171 pCtx->csHid.Attr.u = X86DESC_GET_HID_ATTR(DescCS.Legacy); 2172 pCtx->csHid.u32Limit = cbLimitCS; 2173 pCtx->csHid.u64Base = X86DESC_BASE(DescCS.Legacy); 2174 pCtx->rsp = uNewRsp; 2191 pCtx->rip = uNewEip; 2192 pCtx->cs.Sel = uNewCs; 2193 pCtx->cs.ValidSel = uNewCs; 2194 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 2195 pCtx->cs.Attr.u = X86DESC_GET_HID_ATTR(DescCS.Legacy); 2196 pCtx->cs.u32Limit = cbLimitCS; 2197 pCtx->cs.u64Base = X86DESC_BASE(DescCS.Legacy); 2198 pCtx->rsp = uNewRsp; 2175 2199 2176 2200 uint32_t fEFlagsMask = X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF … … 2667 2691 CPUMSetGuestLDTR(IEMCPU_TO_VMCPU(pIemCpu), 0); 2668 2692 else 2669 pCtx->ldtr = 0; 2670 pCtx->ldtrHid.Attr.u = 0; 2671 pCtx->ldtrHid.u64Base = 0; 2672 pCtx->ldtrHid.u32Limit = 0; 2693 pCtx->ldtr.Sel = 0; 2694 pCtx->ldtr.ValidSel = 0; 2695 pCtx->ldtr.fFlags = CPUMSELREG_FLAGS_VALID; 2696 pCtx->ldtr.Attr.u = 0; 2697 pCtx->ldtr.u64Base = 0; 2698 pCtx->ldtr.u32Limit = 0; 2673 2699 2674 2700 iemRegAddToRip(pIemCpu, cbInstr); … … 2728 2754 CPUMSetGuestLDTR(IEMCPU_TO_VMCPU(pIemCpu), uNewLdt & X86_SEL_MASK); 2729 2755 else 2730 pCtx->ldtr = uNewLdt & X86_SEL_MASK; 2731 pCtx->ldtrHid.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 2732 pCtx->ldtrHid.u32Limit = X86DESC_LIMIT(Desc.Legacy); 2733 pCtx->ldtrHid.u64Base = u64Base; 2756 pCtx->ldtr.Sel = uNewLdt & X86_SEL_MASK; 2757 pCtx->ldtr.ValidSel = uNewLdt & X86_SEL_MASK; 2758 pCtx->ldtr.fFlags = CPUMSELREG_FLAGS_VALID; 2759 pCtx->ldtr.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 2760 pCtx->ldtr.u32Limit = X86DESC_LIMIT(Desc.Legacy); 2761 pCtx->ldtr.u64Base = u64Base; 2734 2762 2735 2763 iemRegAddToRip(pIemCpu, cbInstr); … … 2847 2875 CPUMSetGuestTR(IEMCPU_TO_VMCPU(pIemCpu), uNewTr & X86_SEL_MASK); 2848 2876 else 2849 pCtx->tr = uNewTr & X86_SEL_MASK; 2850 pCtx->trHid.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 2851 pCtx->trHid.u32Limit = X86DESC_LIMIT(Desc.Legacy); 2852 pCtx->trHid.u64Base = u64Base; 2877 pCtx->tr.Sel = uNewTr & X86_SEL_MASK; 2878 pCtx->tr.ValidSel = uNewTr & X86_SEL_MASK; 2879 pCtx->tr.fFlags = CPUMSELREG_FLAGS_VALID; 2880 pCtx->tr.Attr.u = X86DESC_GET_HID_ATTR(Desc.Legacy); 2881 pCtx->tr.u32Limit = X86DESC_LIMIT(Desc.Legacy); 2882 pCtx->tr.u64Base = u64Base; 2853 2883 2854 2884 iemRegAddToRip(pIemCpu, cbInstr); … … 2960 2990 return iemRaiseGeneralProtectionFault0(pIemCpu); 2961 2991 } 2962 if (pCtx->cs Hid.Attr.n.u1Long)2992 if (pCtx->cs.Attr.n.u1Long) 2963 2993 { 2964 2994 Log(("Trying to enabled long mode paging with a long CS descriptor loaded.\n")); -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h
r39970 r41906 76 76 return rcStrict; 77 77 78 rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es Hid, X86_SREG_ES);78 rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es, X86_SREG_ES); 79 79 if (rcStrict != VINF_SUCCESS) 80 80 return rcStrict; … … 94 94 */ 95 95 #if ADDR_SIZE != 64 96 ADDR2_TYPE uVirtSrc1Addr = (uint32_t)pSrc1Hid->u64Base 97 ADDR2_TYPE uVirtSrc2Addr = (uint32_t)pCtx->es Hid.u64Base+ uSrc2AddrReg;96 ADDR2_TYPE uVirtSrc1Addr = (uint32_t)pSrc1Hid->u64Base + uSrc1AddrReg; 97 ADDR2_TYPE uVirtSrc2Addr = (uint32_t)pCtx->es.u64Base + uSrc2AddrReg; 98 98 #else 99 99 uint64_t uVirtSrc1Addr = uSrc1AddrReg; … … 111 111 && uSrc1AddrReg < pSrc1Hid->u32Limit 112 112 && uSrc1AddrReg + (cLeftPage * (OP_SIZE / 8)) <= pSrc1Hid->u32Limit 113 && uSrc2AddrReg < pCtx->es Hid.u32Limit114 && uSrc2AddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es Hid.u32Limit113 && uSrc2AddrReg < pCtx->es.u32Limit 114 && uSrc2AddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es.u32Limit 115 115 #endif 116 116 ) … … 233 233 return rcStrict; 234 234 235 rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es Hid, X86_SREG_ES);235 rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es, X86_SREG_ES); 236 236 if (rcStrict != VINF_SUCCESS) 237 237 return rcStrict; … … 251 251 */ 252 252 #if ADDR_SIZE != 64 253 ADDR2_TYPE uVirtSrc1Addr = (uint32_t)pSrc1Hid->u64Base 254 ADDR2_TYPE uVirtSrc2Addr = (uint32_t)pCtx->es Hid.u64Base+ uSrc2AddrReg;253 ADDR2_TYPE uVirtSrc1Addr = (uint32_t)pSrc1Hid->u64Base + uSrc1AddrReg; 254 ADDR2_TYPE uVirtSrc2Addr = (uint32_t)pCtx->es.u64Base + uSrc2AddrReg; 255 255 #else 256 256 uint64_t uVirtSrc1Addr = uSrc1AddrReg; … … 268 268 && uSrc1AddrReg < pSrc1Hid->u32Limit 269 269 && uSrc1AddrReg + (cLeftPage * (OP_SIZE / 8)) <= pSrc1Hid->u32Limit 270 && uSrc2AddrReg < pCtx->es Hid.u32Limit271 && uSrc2AddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es Hid.u32Limit270 && uSrc2AddrReg < pCtx->es.u32Limit 271 && uSrc2AddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es.u32Limit 272 272 #endif 273 273 ) … … 385 385 } 386 386 387 VBOXSTRICTRC rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es Hid, X86_SREG_ES);387 VBOXSTRICTRC rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es, X86_SREG_ES); 388 388 if (rcStrict != VINF_SUCCESS) 389 389 return rcStrict; … … 403 403 */ 404 404 #if ADDR_SIZE != 64 405 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es Hid.u64Base + uAddrReg;405 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es.u64Base + uAddrReg; 406 406 #else 407 407 uint64_t uVirtAddr = uAddrReg; … … 413 413 && cbIncr > 0 /** @todo Implement reverse direction string ops. */ 414 414 #if ADDR_SIZE != 64 415 && uAddrReg < pCtx->es Hid.u32Limit416 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es Hid.u32Limit415 && uAddrReg < pCtx->es.u32Limit 416 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es.u32Limit 417 417 #endif 418 418 ) … … 509 509 } 510 510 511 VBOXSTRICTRC rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es Hid, X86_SREG_ES);511 VBOXSTRICTRC rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, &pCtx->es, X86_SREG_ES); 512 512 if (rcStrict != VINF_SUCCESS) 513 513 return rcStrict; … … 527 527 */ 528 528 #if ADDR_SIZE != 64 529 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es Hid.u64Base + uAddrReg;529 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es.u64Base + uAddrReg; 530 530 #else 531 531 uint64_t uVirtAddr = uAddrReg; … … 537 537 && cbIncr > 0 /** @todo Implement reverse direction string ops. */ 538 538 #if ADDR_SIZE != 64 539 && uAddrReg < pCtx->es Hid.u32Limit540 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es Hid.u32Limit539 && uAddrReg < pCtx->es.u32Limit 540 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es.u32Limit 541 541 #endif 542 542 ) … … 640 640 return rcStrict; 641 641 642 rcStrict = iemMemSegCheckWriteAccessEx(pIemCpu, &pCtx->es Hid, X86_SREG_ES);642 rcStrict = iemMemSegCheckWriteAccessEx(pIemCpu, &pCtx->es, X86_SREG_ES); 643 643 if (rcStrict != VINF_SUCCESS) 644 644 return rcStrict; … … 657 657 */ 658 658 #if ADDR_SIZE != 64 659 ADDR2_TYPE uVirtSrcAddr = (uint32_t)pSrcHid->u64Base 660 ADDR2_TYPE uVirtDstAddr = (uint32_t)pCtx->es Hid.u64Base + uDstAddrReg;659 ADDR2_TYPE uVirtSrcAddr = (uint32_t)pSrcHid->u64Base + uSrcAddrReg; 660 ADDR2_TYPE uVirtDstAddr = (uint32_t)pCtx->es.u64Base + uDstAddrReg; 661 661 #else 662 662 uint64_t uVirtSrcAddr = uSrcAddrReg; … … 674 674 && uSrcAddrReg < pSrcHid->u32Limit 675 675 && uSrcAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pSrcHid->u32Limit 676 && uDstAddrReg < pCtx->es Hid.u32Limit677 && uDstAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es Hid.u32Limit676 && uDstAddrReg < pCtx->es.u32Limit 677 && uDstAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es.u32Limit 678 678 #endif 679 679 ) … … 764 764 } 765 765 766 VBOXSTRICTRC rcStrict = iemMemSegCheckWriteAccessEx(pIemCpu, &pCtx->es Hid, X86_SREG_ES);766 VBOXSTRICTRC rcStrict = iemMemSegCheckWriteAccessEx(pIemCpu, &pCtx->es, X86_SREG_ES); 767 767 if (rcStrict != VINF_SUCCESS) 768 768 return rcStrict; … … 781 781 */ 782 782 #if ADDR_SIZE != 64 783 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es Hid.u64Base + uAddrReg;783 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es.u64Base + uAddrReg; 784 784 #else 785 785 uint64_t uVirtAddr = uAddrReg; … … 791 791 && cbIncr > 0 /** @todo Implement reverse direction string ops. */ 792 792 #if ADDR_SIZE != 64 793 && uAddrReg < pCtx->es Hid.u32Limit794 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es Hid.u32Limit793 && uAddrReg < pCtx->es.u32Limit 794 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es.u32Limit 795 795 #endif 796 796 ) … … 1048 1048 } 1049 1049 1050 rcStrict = iemMemSegCheckWriteAccessEx(pIemCpu, &pCtx->es Hid, X86_SREG_ES);1050 rcStrict = iemMemSegCheckWriteAccessEx(pIemCpu, &pCtx->es, X86_SREG_ES); 1051 1051 if (rcStrict != VINF_SUCCESS) 1052 1052 return rcStrict; … … 1064 1064 */ 1065 1065 #if ADDR_SIZE != 64 1066 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es Hid.u64Base + uAddrReg;1066 ADDR2_TYPE uVirtAddr = (uint32_t)pCtx->es.u64Base + uAddrReg; 1067 1067 #else 1068 1068 uint64_t uVirtAddr = uAddrReg; … … 1074 1074 && cbIncr > 0 /** @todo Implement reverse direction string ops. */ 1075 1075 #if ADDR_SIZE != 64 1076 && uAddrReg < pCtx->es Hid.u32Limit1077 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es Hid.u32Limit1076 && uAddrReg < pCtx->es.u32Limit 1077 && uAddrReg + (cLeftPage * (OP_SIZE / 8)) <= pCtx->es.u32Limit 1078 1078 #endif 1079 1079 ) -
trunk/src/VBox/VMM/VMMAll/PATMAll.cpp
r41801 r41906 385 385 if ( pCtx->SysEnter.cs == 0 386 386 || pRegFrame->eflags.Bits.u1VM 387 || (pRegFrame->cs & X86_SEL_RPL) != 3387 || (pRegFrame->cs.Sel & X86_SEL_RPL) != 3 388 388 || pVM->patm.s.pfnSysEnterPatchGC == 0 389 389 || pVM->patm.s.pfnSysEnterGC != (RTRCPTR)(RTRCUINTPTR)pCtx->SysEnter.eip … … 394 394 /** @todo the base and limit are forced to 0 & 4G-1 resp. We assume the selector is wide open here. */ 395 395 /** @note The Intel manual suggests that the OS is responsible for this. */ 396 pRegFrame->cs 396 pRegFrame->cs.Sel = (pCtx->SysEnter.cs & ~X86_SEL_RPL) | 1; 397 397 pRegFrame->eip = /** @todo ugly conversion! */(uint32_t)pVM->patm.s.pfnSysEnterPatchGC; 398 pRegFrame->ss = pRegFrame->cs+ 8; /* SysEnter.cs + 8 */398 pRegFrame->ss.Sel = pRegFrame->cs.Sel + 8; /* SysEnter.cs + 8 */ 399 399 pRegFrame->esp = pCtx->SysEnter.esp; 400 pRegFrame->eflags.u32 &= ~(X86_EFL_VM |X86_EFL_RF);400 pRegFrame->eflags.u32 &= ~(X86_EFL_VM | X86_EFL_RF); 401 401 pRegFrame->eflags.u32 |= X86_EFL_IF; 402 402 … … 408 408 return VINF_SUCCESS; 409 409 } 410 else411 410 if (pCpu->pCurInstr->uOpcode == OP_SYSEXIT) 412 411 { 413 412 if ( pCtx->SysEnter.cs == 0 414 || (pRegFrame->cs & X86_SEL_RPL) != 1413 || (pRegFrame->cs.Sel & X86_SEL_RPL) != 1 415 414 || pRegFrame->eflags.Bits.u1VM 416 415 || !(PATMRawGetEFlags(pVM, pRegFrame) & X86_EFL_IF)) … … 419 418 Log2(("PATMSysCall: sysexit from %RRv to %RRv\n", pRegFrame->eip, pRegFrame->edx)); 420 419 421 pRegFrame->cs 420 pRegFrame->cs.Sel = ((pCtx->SysEnter.cs + 16) & ~X86_SEL_RPL) | 3; 422 421 pRegFrame->eip = pRegFrame->edx; 423 pRegFrame->ss = pRegFrame->cs+ 8; /* SysEnter.cs + 24 */422 pRegFrame->ss.Sel = pRegFrame->cs.Sel + 8; /* SysEnter.cs + 24 */ 424 423 pRegFrame->esp = pRegFrame->ecx; 425 424 … … 428 427 return VINF_SUCCESS; 429 428 } 430 else431 429 if (pCpu->pCurInstr->uOpcode == OP_SYSCALL) 432 430 { -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r41802 r41906 407 407 PVM pVM = pVCpu->CTX_SUFF(pVM); 408 408 409 Log(("PGMTrap0eHandler: uErr=%RGx pvFault=%RGv eip=%04x:%RGv cr3=%RGp\n", uErr, pvFault, pRegFrame->cs , (RTGCPTR)pRegFrame->rip, (RTGCPHYS)CPUMGetGuestCR3(pVCpu)));409 Log(("PGMTrap0eHandler: uErr=%RGx pvFault=%RGv eip=%04x:%RGv cr3=%RGp\n", uErr, pvFault, pRegFrame->cs.Sel, (RTGCPTR)pRegFrame->rip, (RTGCPHYS)CPUMGetGuestCR3(pVCpu))); 410 410 STAM_PROFILE_START(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0e, a); 411 411 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = NULL; } ); -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r41836 r41906 1079 1079 */ 1080 1080 LogRel(("%s: returns rc=%Rrc pvFault=%RGv uErr=%RX64 cs:rip=%04x:%08RX64\n", 1081 __PRETTY_FUNCTION__, rc, pvFault, (uint64_t)uErr, pRegFrame->cs , pRegFrame->rip));1081 __PRETTY_FUNCTION__, rc, pvFault, (uint64_t)uErr, pRegFrame->cs.Sel, pRegFrame->rip)); 1082 1082 return rc; 1083 1083 -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r41803 r41906 853 853 { 854 854 LogFlow(("pgmPoolAccessHandlerPTWorker: Interpretation failed for patch code %04x:%RGv, ignoring.\n", 855 pRegFrame->cs , (RTGCPTR)pRegFrame->eip));855 pRegFrame->cs.Sel, (RTGCPTR)pRegFrame->eip)); 856 856 rc = VINF_SUCCESS; 857 857 STAM_COUNTER_INC(&pPool->StatMonitorRZIntrFailPatch2); … … 990 990 { 991 991 LogFlow(("pgmPoolAccessHandlerPTWorker: Interpretation failed for %04x:%RGv - opcode=%d\n", 992 pRegFrame->cs , (RTGCPTR)pRegFrame->rip, pDis->pCurInstr->uOpcode));992 pRegFrame->cs.Sel, (RTGCPTR)pRegFrame->rip, pDis->pCurInstr->uOpcode)); 993 993 rc = VINF_EM_RAW_EMULATE_INSTR; 994 994 STAM_COUNTER_INC(&pPool->CTX_MID_Z(StatMonitor,EmulateInstr)); -
trunk/src/VBox/VMM/VMMAll/SELMAll.cpp
r41803 r41906 114 114 115 115 /* 64 bits mode: CS, DS, ES and SS are treated as if each segment base is 0 (Intel® 64 and IA-32 Architectures Software Developer's Manual: 3.4.2.1). */ 116 if ( pCtxCore->cs Hid.Attr.n.u1Long116 if ( pCtxCore->cs.Attr.n.u1Long 117 117 && CPUMIsGuestInLongMode(pVCpu)) 118 118 { … … 196 196 197 197 /* 64 bits mode: CS, DS, ES and SS are treated as if each segment base is 0 (Intel® 64 and IA-32 Architectures Software Developer's Manual: 3.4.2.1). */ 198 if ( pCtxCore->cs Hid.Attr.n.u1Long198 if ( pCtxCore->cs.Attr.n.u1Long 199 199 && CPUMIsGuestInLongMode(pVCpu)) 200 200 { -
trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp
r41802 r41906 370 370 # if defined(VBOX_STRICT) || defined(LOG_ENABLED) 371 371 if (pRegFrame->eflags.Bits.u1VM) 372 Log(("TRPMForwardTrap-VM: eip=%04X:%04X iGate=%d\n", pRegFrame->cs , pRegFrame->eip, iGate));372 Log(("TRPMForwardTrap-VM: eip=%04X:%04X iGate=%d\n", pRegFrame->cs.Sel, pRegFrame->eip, iGate)); 373 373 else 374 Log(("TRPMForwardTrap: eip=%04X:%08X iGate=%d\n", pRegFrame->cs , pRegFrame->eip, iGate));374 Log(("TRPMForwardTrap: eip=%04X:%08X iGate=%d\n", pRegFrame->cs.Sel, pRegFrame->eip, iGate)); 375 375 376 376 switch (iGate) { … … 564 564 if (fConforming || dpl == cpl) /* to the same privilege level */ 565 565 { 566 ss_r0 = pRegFrame->ss ;566 ss_r0 = pRegFrame->ss.Sel; 567 567 esp_r0 = pRegFrame->esp; 568 568 … … 584 584 uint32_t *pTrapStack; 585 585 #ifdef IN_RC 586 Assert(eflags.Bits.u1VM || (pRegFrame->ss & X86_SEL_RPL) != 0);586 Assert(eflags.Bits.u1VM || (pRegFrame->ss.Sel & X86_SEL_RPL) != 0); 587 587 /* Check maximum amount we need (10 when executing in V86 mode) */ 588 588 rc = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)pTrapStackGC - 10*sizeof(uint32_t), 10 * sizeof(uint32_t), X86_PTE_RW); 589 589 pTrapStack = (uint32_t *)(uintptr_t)pTrapStackGC; 590 590 #else 591 Assert(eflags.Bits.u1VM || (pRegFrame->ss & X86_SEL_RPL) == 0 || (pRegFrame->ss& X86_SEL_RPL) == 3);591 Assert(eflags.Bits.u1VM || (pRegFrame->ss.Sel & X86_SEL_RPL) == 0 || (pRegFrame->ss.Sel & X86_SEL_RPL) == 3); 592 592 /* Check maximum amount we need (10 when executing in V86 mode) */ 593 593 if ((pTrapStackGC >> PAGE_SHIFT) != ((pTrapStackGC - 10*sizeof(uint32_t)) >> PAGE_SHIFT)) /* fail if we cross a page boundary */ … … 606 606 if (eflags.Bits.u1VM) 607 607 { 608 Log(("TRAP%02X: (VM) Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss & X86_SEL_RPL), pVCpu->trpm.s.uActiveCR2));609 pTrapStack[--idx] = pRegFrame->gs ;610 pTrapStack[--idx] = pRegFrame->fs ;611 pTrapStack[--idx] = pRegFrame->ds ;612 pTrapStack[--idx] = pRegFrame->es ;608 Log(("TRAP%02X: (VM) Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss.Sel & X86_SEL_RPL), pVCpu->trpm.s.uActiveCR2)); 609 pTrapStack[--idx] = pRegFrame->gs.Sel; 610 pTrapStack[--idx] = pRegFrame->fs.Sel; 611 pTrapStack[--idx] = pRegFrame->ds.Sel; 612 pTrapStack[--idx] = pRegFrame->es.Sel; 613 613 614 614 /* clear ds, es, fs & gs in current context */ 615 pRegFrame->ds = pRegFrame->es = pRegFrame->fs = pRegFrame->gs= 0;615 pRegFrame->ds.Sel = pRegFrame->es.Sel = pRegFrame->fs.Sel = pRegFrame->gs.Sel = 0; 616 616 } 617 617 else 618 Log(("TRAP%02X: Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss & X86_SEL_RPL), pVCpu->trpm.s.uActiveCR2));618 Log(("TRAP%02X: Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss.Sel & X86_SEL_RPL), pVCpu->trpm.s.uActiveCR2)); 619 619 620 620 if (!fConforming && dpl < cpl) 621 621 { 622 if ((pRegFrame->ss & X86_SEL_RPL) == 1 && !eflags.Bits.u1VM)623 pTrapStack[--idx] = pRegFrame->ss & ~1; /* Mask away traces of raw ring execution (ring 1). */622 if ((pRegFrame->ss.Sel & X86_SEL_RPL) == 1 && !eflags.Bits.u1VM) 623 pTrapStack[--idx] = pRegFrame->ss.Sel & ~1; /* Mask away traces of raw ring execution (ring 1). */ 624 624 else 625 pTrapStack[--idx] = pRegFrame->ss ;625 pTrapStack[--idx] = pRegFrame->ss.Sel; 626 626 627 627 pTrapStack[--idx] = pRegFrame->esp; … … 632 632 pTrapStack[--idx] = eflags.u32; 633 633 634 if ((pRegFrame->cs & X86_SEL_RPL) == 1 && !eflags.Bits.u1VM)635 pTrapStack[--idx] = pRegFrame->cs & ~1; /* Mask away traces of raw ring execution (ring 1). */634 if ((pRegFrame->cs.Sel & X86_SEL_RPL) == 1 && !eflags.Bits.u1VM) 635 pTrapStack[--idx] = pRegFrame->cs.Sel & ~1; /* Mask away traces of raw ring execution (ring 1). */ 636 636 else 637 pTrapStack[--idx] = pRegFrame->cs ;637 pTrapStack[--idx] = pRegFrame->cs.Sel; 638 638 639 639 if (enmType == TRPM_SOFTWARE_INT) … … 665 665 pRegFrame->eax, pRegFrame->ebx, pRegFrame->ecx, pRegFrame->edx, pRegFrame->esi, pRegFrame->edi, 666 666 pRegFrame->eip, pRegFrame->esp, pRegFrame->ebp, eflags.Bits.u2IOPL, 667 (RTSEL)pRegFrame->cs, (RTSEL)pRegFrame->ds, (RTSEL)pRegFrame->es,668 (RTSEL)pRegFrame->fs, (RTSEL)pRegFrame->gs, eflags.u32));667 pRegFrame->cs.Sel, pRegFrame->ds.Sel, pRegFrame->es.Sel, 668 pRegFrame->fs.Sel, pRegFrame->gs.Sel, eflags.u32)); 669 669 #endif 670 670 … … 705 705 706 706 pRegFrame->eip = pVM->trpm.s.aGuestTrapHandler[iGate]; 707 pRegFrame->cs 707 pRegFrame->cs.Sel = GuestIdte.Gen.u16SegSel; 708 708 pRegFrame->esp = esp_r0; 709 pRegFrame->ss 709 pRegFrame->ss.Sel = ss_r0 & ~X86_SEL_RPL; /* set rpl to ring 0 */ 710 710 STAM_PROFILE_ADV_STOP(&pVM->trpm.s.CTX_SUFF_Z(StatForwardProf), a); 711 711 PGMPhysReleasePageMappingLock(pVM, &PageMappingLock); … … 737 737 STAM_PROFILE_ADV_STOP(&pVM->trpm.s.CTX_SUFF_Z(StatForwardProf), a); 738 738 739 Log(("TRAP%02X: forwarding to REM (ss rpl=%d eflags=%08X VMIF=%d handler=%08X\n", iGate, pRegFrame->ss & X86_SEL_RPL, pRegFrame->eflags.u32, PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame), pVM->trpm.s.aGuestTrapHandler[iGate]));739 Log(("TRAP%02X: forwarding to REM (ss rpl=%d eflags=%08X VMIF=%d handler=%08X\n", iGate, pRegFrame->ss.Sel & X86_SEL_RPL, pRegFrame->eflags.u32, PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame), pVM->trpm.s.aGuestTrapHandler[iGate])); 740 740 #endif 741 741 return VINF_EM_RAW_GUEST_TRAP; … … 760 760 VMMDECL(int) TRPMRaiseXcpt(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt) 761 761 { 762 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x\n", pCtxCore->cs , pCtxCore->eip, enmXcpt));762 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x\n", pCtxCore->cs.Sel, pCtxCore->eip, enmXcpt)); 763 763 /** @todo dispatch the trap. */ 764 764 pVCpu->trpm.s.uActiveVector = enmXcpt; … … 787 787 VMMDECL(int) TRPMRaiseXcptErr(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr) 788 788 { 789 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32\n", pCtxCore->cs , pCtxCore->eip, enmXcpt, uErr));789 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32\n", pCtxCore->cs.Sel, pCtxCore->eip, enmXcpt, uErr)); 790 790 /** @todo dispatch the trap. */ 791 791 pVCpu->trpm.s.uActiveVector = enmXcpt; … … 815 815 VMMDECL(int) TRPMRaiseXcptErrCR2(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2) 816 816 { 817 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32 uCR2=%RGv\n", pCtxCore->cs , pCtxCore->eip, enmXcpt, uErr, uCR2));817 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32 uCR2=%RGv\n", pCtxCore->cs.Sel, pCtxCore->eip, enmXcpt, uErr, uCR2)); 818 818 /** @todo dispatch the trap. */ 819 819 pVCpu->trpm.s.uActiveVector = enmXcpt; -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r41836 r41906 1931 1931 { 1932 1932 Log(("rax=%016RX64 rbx=%016RX64 rcx=%016RX64 rdx=%016RX64\n" 1933 "rsi=%016RX64 rdi=%016RX64 r8 =%016RX64 r9 =%016RX64\n"1934 "r10=%016RX64 r11=%016RX64 r12=%016RX64 r13=%016RX64\n"1935 "r14=%016RX64 r15=%016RX64\n"1936 "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 iopl=%d %*s\n"1937 "cs={%04x base=%016RX64 limit=%08x flags=%08x}\n"1938 "ds={%04x base=%016RX64 limit=%08x flags=%08x}\n"1939 "es={%04x base=%016RX64 limit=%08x flags=%08x}\n"1940 "fs={%04x base=%016RX64 limit=%08x flags=%08x}\n"1941 "gs={%04x base=%016RX64 limit=%08x flags=%08x}\n"1942 "ss={%04x base=%016RX64 limit=%08x flags=%08x}\n"1943 "cr0=%016RX64 cr2=%016RX64 cr3=%016RX64 cr4=%016RX64\n"1944 "dr0=%016RX64 dr1=%016RX64 dr2=%016RX64 dr3=%016RX64\n"1945 "dr4=%016RX64 dr5=%016RX64 dr6=%016RX64 dr7=%016RX64\n"1946 "gdtr=%016RX64:%04x idtr=%016RX64:%04x eflags=%08x\n"1947 "ldtr={%04x base=%08RX64 limit=%08x flags=%08x}\n"1948 "tr ={%04x base=%08RX64 limit=%08x flags=%08x}\n"1949 "SysEnter={cs=%04llx eip=%08llx esp=%08llx}\n"1950 ,1951 pCtx->rax, pCtx->rbx, pCtx->rcx, pCtx->rdx, pCtx->rsi, pCtx->rdi,1952 pCtx->r8, pCtx->r9, pCtx->r10, pCtx->r11, pCtx->r12, pCtx->r13,1953 pCtx->r14, pCtx->r15,1954 pCtx->rip, pCtx->rsp, pCtx->rbp, X86_EFL_GET_IOPL(efl), 31, szEFlags,1955 (RTSEL)pCtx->cs, pCtx->csHid.u64Base, pCtx->csHid.u32Limit, pCtx->csHid.Attr.u,1956 (RTSEL)pCtx->ds, pCtx->dsHid.u64Base, pCtx->dsHid.u32Limit, pCtx->dsHid.Attr.u,1957 (RTSEL)pCtx->es, pCtx->esHid.u64Base, pCtx->esHid.u32Limit, pCtx->esHid.Attr.u,1958 (RTSEL)pCtx->fs, pCtx->fsHid.u64Base, pCtx->fsHid.u32Limit, pCtx->fsHid.Attr.u,1959 (RTSEL)pCtx->gs, pCtx->gsHid.u64Base, pCtx->gsHid.u32Limit, pCtx->gsHid.Attr.u,1960 (RTSEL)pCtx->ss, pCtx->ssHid.u64Base, pCtx->ssHid.u32Limit, pCtx->ssHid.Attr.u,1961 pCtx->cr0, pCtx->cr2, pCtx->cr3, pCtx->cr4,1962 pCtx->dr[0], pCtx->dr[1], pCtx->dr[2], pCtx->dr[3],1963 pCtx->dr[4], pCtx->dr[5], pCtx->dr[6], pCtx->dr[7],1964 pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, efl,1965 (RTSEL)pCtx->ldtr, pCtx->ldtrHid.u64Base, pCtx->ldtrHid.u32Limit, pCtx->ldtrHid.Attr.u,1966 (RTSEL)pCtx->tr, pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,1967 pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp));1933 "rsi=%016RX64 rdi=%016RX64 r8 =%016RX64 r9 =%016RX64\n" 1934 "r10=%016RX64 r11=%016RX64 r12=%016RX64 r13=%016RX64\n" 1935 "r14=%016RX64 r15=%016RX64\n" 1936 "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 iopl=%d %*s\n" 1937 "cs={%04x base=%016RX64 limit=%08x flags=%08x}\n" 1938 "ds={%04x base=%016RX64 limit=%08x flags=%08x}\n" 1939 "es={%04x base=%016RX64 limit=%08x flags=%08x}\n" 1940 "fs={%04x base=%016RX64 limit=%08x flags=%08x}\n" 1941 "gs={%04x base=%016RX64 limit=%08x flags=%08x}\n" 1942 "ss={%04x base=%016RX64 limit=%08x flags=%08x}\n" 1943 "cr0=%016RX64 cr2=%016RX64 cr3=%016RX64 cr4=%016RX64\n" 1944 "dr0=%016RX64 dr1=%016RX64 dr2=%016RX64 dr3=%016RX64\n" 1945 "dr4=%016RX64 dr5=%016RX64 dr6=%016RX64 dr7=%016RX64\n" 1946 "gdtr=%016RX64:%04x idtr=%016RX64:%04x eflags=%08x\n" 1947 "ldtr={%04x base=%08RX64 limit=%08x flags=%08x}\n" 1948 "tr ={%04x base=%08RX64 limit=%08x flags=%08x}\n" 1949 "SysEnter={cs=%04llx eip=%08llx esp=%08llx}\n" 1950 , 1951 pCtx->rax, pCtx->rbx, pCtx->rcx, pCtx->rdx, pCtx->rsi, pCtx->rdi, 1952 pCtx->r8, pCtx->r9, pCtx->r10, pCtx->r11, pCtx->r12, pCtx->r13, 1953 pCtx->r14, pCtx->r15, 1954 pCtx->rip, pCtx->rsp, pCtx->rbp, X86_EFL_GET_IOPL(efl), 31, szEFlags, 1955 pCtx->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u, 1956 pCtx->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u, 1957 pCtx->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u, 1958 pCtx->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, pCtx->fs.Attr.u, 1959 pCtx->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, pCtx->gs.Attr.u, 1960 pCtx->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, pCtx->ss.Attr.u, 1961 pCtx->cr0, pCtx->cr2, pCtx->cr3, pCtx->cr4, 1962 pCtx->dr[0], pCtx->dr[1], pCtx->dr[2], pCtx->dr[3], 1963 pCtx->dr[4], pCtx->dr[5], pCtx->dr[6], pCtx->dr[7], 1964 pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, efl, 1965 pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u, 1966 pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u, 1967 pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp)); 1968 1968 } 1969 1969 else 1970 1970 Log(("eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n" 1971 "eip=%08x esp=%08x ebp=%08x iopl=%d %*s\n"1972 "cs={%04x base=%016RX64 limit=%08x flags=%08x} dr0=%08RX64 dr1=%08RX64\n"1973 "ds={%04x base=%016RX64 limit=%08x flags=%08x} dr2=%08RX64 dr3=%08RX64\n"1974 "es={%04x base=%016RX64 limit=%08x flags=%08x} dr4=%08RX64 dr5=%08RX64\n"1975 "fs={%04x base=%016RX64 limit=%08x flags=%08x} dr6=%08RX64 dr7=%08RX64\n"1976 "gs={%04x base=%016RX64 limit=%08x flags=%08x} cr0=%08RX64 cr2=%08RX64\n"1977 "ss={%04x base=%016RX64 limit=%08x flags=%08x} cr3=%08RX64 cr4=%08RX64\n"1978 "gdtr=%016RX64:%04x idtr=%016RX64:%04x eflags=%08x\n"1979 "ldtr={%04x base=%08RX64 limit=%08x flags=%08x}\n"1980 "tr ={%04x base=%08RX64 limit=%08x flags=%08x}\n"1981 "SysEnter={cs=%04llx eip=%08llx esp=%08llx}\n"1982 ,1983 pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi,1984 pCtx->eip, pCtx->esp, pCtx->ebp, X86_EFL_GET_IOPL(efl), 31, szEFlags,1985 (RTSEL)pCtx->cs, pCtx->csHid.u64Base, pCtx->csHid.u32Limit, pCtx->csHid.Attr.u, pCtx->dr[0], pCtx->dr[1],1986 (RTSEL)pCtx->ds, pCtx->dsHid.u64Base, pCtx->dsHid.u32Limit, pCtx->dsHid.Attr.u, pCtx->dr[2], pCtx->dr[3],1987 (RTSEL)pCtx->es, pCtx->esHid.u64Base, pCtx->esHid.u32Limit, pCtx->esHid.Attr.u, pCtx->dr[4], pCtx->dr[5],1988 (RTSEL)pCtx->fs, pCtx->fsHid.u64Base, pCtx->fsHid.u32Limit, pCtx->fsHid.Attr.u, pCtx->dr[6], pCtx->dr[7],1989 (RTSEL)pCtx->gs, pCtx->gsHid.u64Base, pCtx->gsHid.u32Limit, pCtx->gsHid.Attr.u, pCtx->cr0, pCtx->cr2,1990 (RTSEL)pCtx->ss, pCtx->ssHid.u64Base, pCtx->ssHid.u32Limit, pCtx->ssHid.Attr.u, pCtx->cr3, pCtx->cr4,1991 pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, efl,1992 (RTSEL)pCtx->ldtr, pCtx->ldtrHid.u64Base, pCtx->ldtrHid.u32Limit, pCtx->ldtrHid.Attr.u,1993 (RTSEL)pCtx->tr, pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,1994 pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp));1971 "eip=%08x esp=%08x ebp=%08x iopl=%d %*s\n" 1972 "cs={%04x base=%016RX64 limit=%08x flags=%08x} dr0=%08RX64 dr1=%08RX64\n" 1973 "ds={%04x base=%016RX64 limit=%08x flags=%08x} dr2=%08RX64 dr3=%08RX64\n" 1974 "es={%04x base=%016RX64 limit=%08x flags=%08x} dr4=%08RX64 dr5=%08RX64\n" 1975 "fs={%04x base=%016RX64 limit=%08x flags=%08x} dr6=%08RX64 dr7=%08RX64\n" 1976 "gs={%04x base=%016RX64 limit=%08x flags=%08x} cr0=%08RX64 cr2=%08RX64\n" 1977 "ss={%04x base=%016RX64 limit=%08x flags=%08x} cr3=%08RX64 cr4=%08RX64\n" 1978 "gdtr=%016RX64:%04x idtr=%016RX64:%04x eflags=%08x\n" 1979 "ldtr={%04x base=%08RX64 limit=%08x flags=%08x}\n" 1980 "tr ={%04x base=%08RX64 limit=%08x flags=%08x}\n" 1981 "SysEnter={cs=%04llx eip=%08llx esp=%08llx}\n" 1982 , 1983 pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi, 1984 pCtx->eip, pCtx->esp, pCtx->ebp, X86_EFL_GET_IOPL(efl), 31, szEFlags, 1985 pCtx->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u, pCtx->dr[0], pCtx->dr[1], 1986 pCtx->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u, pCtx->dr[2], pCtx->dr[3], 1987 pCtx->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u, pCtx->dr[4], pCtx->dr[5], 1988 pCtx->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, pCtx->fs.Attr.u, pCtx->dr[6], pCtx->dr[7], 1989 pCtx->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, pCtx->gs.Attr.u, pCtx->cr0, pCtx->cr2, 1990 pCtx->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, pCtx->ss.Attr.u, pCtx->cr3, pCtx->cr4, 1991 pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, efl, 1992 pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u, 1993 pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u, 1994 pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp)); 1995 1995 1996 1996 Log(("FPU:\n" -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r41823 r41906 923 923 924 924 /* Set CPL */ 925 pVMCB->guest.u8CPL = pCtx->ss Hid.Attr.n.u2Dpl;925 pVMCB->guest.u8CPL = pCtx->ss.Attr.n.u2Dpl; 926 926 927 927 /* RAX/EAX too, as VMRUN uses RAX as an implicit parameter. */ … … 946 946 #endif 947 947 /* Unconditionally update these as wrmsr might have changed them. (HWACCM_CHANGED_GUEST_SEGMENT_REGS will not be set) */ 948 pVMCB->guest.FS.u64Base = pCtx->fs Hid.u64Base;949 pVMCB->guest.GS.u64Base = pCtx->gs Hid.u64Base;948 pVMCB->guest.FS.u64Base = pCtx->fs.u64Base; 949 pVMCB->guest.GS.u64Base = pCtx->gs.u64Base; 950 950 } 951 951 else … … 1644 1644 * register (yet). 1645 1645 */ 1646 if ( !pCtx->cs Hid.Attr.n.u1Granularity1647 && pCtx->cs Hid.Attr.n.u1Present1648 && pCtx->cs Hid.u32Limit > UINT32_C(0xfffff))1649 { 1650 Assert((pCtx->cs Hid.u32Limit & 0xfff) == 0xfff);1651 pCtx->cs Hid.Attr.n.u1Granularity = 1;1646 if ( !pCtx->cs.Attr.n.u1Granularity 1647 && pCtx->cs.Attr.n.u1Present 1648 && pCtx->cs.u32Limit > UINT32_C(0xfffff)) 1649 { 1650 Assert((pCtx->cs.u32Limit & 0xfff) == 0xfff); 1651 pCtx->cs.Attr.n.u1Granularity = 1; 1652 1652 } 1653 1653 #define SVM_ASSERT_SEL_GRANULARITY(reg) \ 1654 AssertMsg( !pCtx->reg ##Hid.Attr.n.u1Present \1655 || ( pCtx->reg ##Hid.Attr.n.u1Granularity \1656 ? (pCtx->reg ##Hid.u32Limit & 0xfff) == 0xfff \1657 : pCtx->reg ##Hid.u32Limit <= 0xfffff), \1658 ("%#x %#x %#llx\n", pCtx->reg ##Hid.u32Limit, pCtx->reg##Hid.Attr.u, pCtx->reg##Hid.u64Base))1654 AssertMsg( !pCtx->reg.Attr.n.u1Present \ 1655 || ( pCtx->reg.Attr.n.u1Granularity \ 1656 ? (pCtx->reg.u32Limit & 0xfff) == 0xfff \ 1657 : pCtx->reg.u32Limit <= 0xfffff), \ 1658 ("%#x %#x %#llx\n", pCtx->reg.u32Limit, pCtx->reg.Attr.u, pCtx->reg.u64Base)) 1659 1659 SVM_ASSERT_SEL_GRANULARITY(ss); 1660 1660 SVM_ASSERT_SEL_GRANULARITY(cs); … … 1672 1672 */ 1673 1673 Assert(!(pVMCB->guest.u8CPL & ~0x3)); 1674 pCtx->ss Hid.Attr.n.u2Dpl = pVMCB->guest.u8CPL & 0x3;1674 pCtx->ss.Attr.n.u2Dpl = pVMCB->guest.u8CPL & 0x3; 1675 1675 1676 1676 /* … … 1775 1775 #ifdef DBGFTRACE_ENABLED /** @todo DTrace */ 1776 1776 RTTraceBufAddMsgF(pVM->CTX_SUFF(hTraceBuf), "vmexit %08x at %04:%08RX64 %RX64 %RX64 %RX64", 1777 exitCode, pCtx->cs , pCtx->rip,1777 exitCode, pCtx->cs.Sel, pCtx->rip, 1778 1778 pVMCB->ctrl.u64ExitInfo1, pVMCB->ctrl.u64ExitInfo2, pVMCB->ctrl.ExitIntInfo.au64[0]); 1779 1779 #endif … … 1825 1825 } 1826 1826 /* Return to ring 3 to deal with the debug exit code. */ 1827 Log(("Debugger hardware BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs , pCtx->rip, VBOXSTRICTRC_VAL(rc)));1827 Log(("Debugger hardware BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs.Sel, pCtx->rip, VBOXSTRICTRC_VAL(rc))); 1828 1828 break; 1829 1829 } … … 2031 2031 break; 2032 2032 } 2033 Log(("Trap %x at %04x:%RGv esi=%x\n", vector, pCtx->cs , (RTGCPTR)pCtx->rip, pCtx->esi));2033 Log(("Trap %x at %04x:%RGv esi=%x\n", vector, pCtx->cs.Sel, (RTGCPTR)pCtx->rip, pCtx->esi)); 2034 2034 hmR0SvmInjectEvent(pVCpu, pVMCB, pCtx, &Event); 2035 2035 goto ResumeExecution; … … 2971 2971 * Only allow 32 & 64 bit code. 2972 2972 */ 2973 DISCPUMODE enmMode = SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->cs , &pRegFrame->csHid);2973 DISCPUMODE enmMode = SELMGetCpuModeFromSelector(pVCpu, pRegFrame->eflags, pRegFrame->cs.Sel, &pRegFrame->cs); 2974 2974 if (enmMode != DISCPUMODE_16BIT) 2975 2975 { -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.h
r41335 r41906 200 200 #define SVM_HIDSEGATTR_SVM2VMX(a) (a & 0xFF) | ((a & 0x0F00) << 4) 201 201 202 #define SVM_WRITE_SELREG(REG, reg) \ 203 { \ 204 pVMCB->guest.REG.u16Sel = pCtx->reg; \ 205 pVMCB->guest.REG.u32Limit = pCtx->reg##Hid.u32Limit; \ 206 pVMCB->guest.REG.u64Base = pCtx->reg##Hid.u64Base; \ 207 pVMCB->guest.REG.u16Attr = SVM_HIDSEGATTR_VMX2SVM(pCtx->reg##Hid.Attr.u); \ 208 } 209 210 #define SVM_READ_SELREG(REG, reg) \ 211 { \ 212 pCtx->reg = pVMCB->guest.REG.u16Sel; \ 213 pCtx->reg##Hid.u32Limit = pVMCB->guest.REG.u32Limit; \ 214 pCtx->reg##Hid.u64Base = pVMCB->guest.REG.u64Base; \ 215 pCtx->reg##Hid.Attr.u = SVM_HIDSEGATTR_SVM2VMX(pVMCB->guest.REG.u16Attr); \ 216 } 202 #define SVM_WRITE_SELREG(REG, reg) \ 203 do \ 204 { \ 205 Assert(pCtx->reg.fFlags & CPUMSELREG_FLAGS_VALID); \ 206 Assert(pCtx->reg.ValidSel == pCtx->reg.Sel); \ 207 pVMCB->guest.REG.u16Sel = pCtx->reg.Sel; \ 208 pVMCB->guest.REG.u32Limit = pCtx->reg.u32Limit; \ 209 pVMCB->guest.REG.u64Base = pCtx->reg.u64Base; \ 210 pVMCB->guest.REG.u16Attr = SVM_HIDSEGATTR_VMX2SVM(pCtx->reg.Attr.u); \ 211 } while (0) 212 213 #define SVM_READ_SELREG(REG, reg) \ 214 do \ 215 { \ 216 pCtx->reg.Sel = pVMCB->guest.REG.u16Sel; \ 217 pCtx->reg.ValidSel = pVMCB->guest.REG.u16Sel; \ 218 pCtx->reg.fFlags = CPUMSELREG_FLAGS_VALID; \ 219 pCtx->reg.u32Limit = pVMCB->guest.REG.u32Limit; \ 220 pCtx->reg.u64Base = pVMCB->guest.REG.u64Base; \ 221 pCtx->reg.Attr.u = SVM_HIDSEGATTR_SVM2VMX(pVMCB->guest.REG.u16Attr); \ 222 } while (0) 217 223 218 224 #endif /* IN_RING0 */ … … 222 228 RT_C_DECLS_END 223 229 224 #endif /* ___VMMR0_HWSVMR0_h */225 230 #endif /* !___VMMR0_HWSVMR0_h */ 231 -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r41834 r41906 904 904 /** @todo Check stack limit. */ 905 905 pCtx->sp -= 2; 906 LogFlow(("ss:sp %04X:%04X eflags=%x\n", pCtx->ss , pCtx->sp, pCtx->eflags.u));907 rc = PGMPhysSimpleWriteGCPhys(pVM, pCtx->ss Hid.u64Base + pCtx->sp, &pCtx->eflags, sizeof(uint16_t)); AssertRC(rc);906 LogFlow(("ss:sp %04X:%04X eflags=%x\n", pCtx->ss.Sel, pCtx->sp, pCtx->eflags.u)); 907 rc = PGMPhysSimpleWriteGCPhys(pVM, pCtx->ss.u64Base + pCtx->sp, &pCtx->eflags, sizeof(uint16_t)); AssertRC(rc); 908 908 pCtx->sp -= 2; 909 LogFlow(("ss:sp %04X:%04X cs=%x\n", pCtx->ss , pCtx->sp, pCtx->cs));910 rc = PGMPhysSimpleWriteGCPhys(pVM, pCtx->ss Hid.u64Base + pCtx->sp, &pCtx->cs, sizeof(uint16_t)); AssertRC(rc);909 LogFlow(("ss:sp %04X:%04X cs=%x\n", pCtx->ss.Sel, pCtx->sp, pCtx->cs.Sel)); 910 rc = PGMPhysSimpleWriteGCPhys(pVM, pCtx->ss.u64Base + pCtx->sp, &pCtx->cs, sizeof(uint16_t)); AssertRC(rc); 911 911 pCtx->sp -= 2; 912 LogFlow(("ss:sp %04X:%04X ip=%x\n", pCtx->ss , pCtx->sp, ip));913 rc = PGMPhysSimpleWriteGCPhys(pVM, pCtx->ss Hid.u64Base + pCtx->sp, &ip, sizeof(ip)); AssertRC(rc);912 LogFlow(("ss:sp %04X:%04X ip=%x\n", pCtx->ss.Sel, pCtx->sp, ip)); 913 rc = PGMPhysSimpleWriteGCPhys(pVM, pCtx->ss.u64Base + pCtx->sp, &ip, sizeof(ip)); AssertRC(rc); 914 914 915 915 /* … … 917 917 */ 918 918 pCtx->rip = offset; 919 pCtx->cs 920 pCtx->cs Hid.u64Base= sel << 4;919 pCtx->cs.Sel = sel; 920 pCtx->cs.u64Base = sel << 4; 921 921 pCtx->eflags.u &= ~(X86_EFL_IF | X86_EFL_TF | X86_EFL_RF | X86_EFL_AC); 922 922 … … 1009 1009 rc = PDMGetInterrupt(pVCpu, &u8Interrupt); 1010 1010 Log(("CPU%d: Dispatch interrupt: u8Interrupt=%x (%d) rc=%Rrc cs:rip=%04X:%RGv\n", pVCpu->idCpu, 1011 u8Interrupt, u8Interrupt, rc, pCtx->cs , (RTGCPTR)pCtx->rip));1011 u8Interrupt, u8Interrupt, rc, pCtx->cs.Sel, (RTGCPTR)pCtx->rip)); 1012 1012 if (RT_SUCCESS(rc)) 1013 1013 { … … 1642 1642 * DPL of all hidden selector registers must match the current CPL (0). 1643 1643 */ 1644 pCtx->cs Hid.Attr.n.u2Dpl = 0;1645 pCtx->cs Hid.Attr.n.u4Type = X86_SEL_TYPE_CODE | X86_SEL_TYPE_RW_ACC;1646 1647 pCtx->ds Hid.Attr.n.u2Dpl = 0;1648 pCtx->es Hid.Attr.n.u2Dpl = 0;1649 pCtx->fs Hid.Attr.n.u2Dpl = 0;1650 pCtx->gs Hid.Attr.n.u2Dpl = 0;1651 pCtx->ss Hid.Attr.n.u2Dpl = 0;1644 pCtx->cs.Attr.n.u2Dpl = 0; 1645 pCtx->cs.Attr.n.u4Type = X86_SEL_TYPE_CODE | X86_SEL_TYPE_RW_ACC; 1646 1647 pCtx->ds.Attr.n.u2Dpl = 0; 1648 pCtx->es.Attr.n.u2Dpl = 0; 1649 pCtx->fs.Attr.n.u2Dpl = 0; 1650 pCtx->gs.Attr.n.u2Dpl = 0; 1651 pCtx->ss.Attr.n.u2Dpl = 0; 1652 1652 } 1653 1653 pVCpu->hwaccm.s.vmx.enmLastSeenGuestMode = enmGuestMode; 1654 1654 } 1655 1655 else if ( CPUMIsGuestInRealModeEx(pCtx) 1656 && pCtx->cs Hid.u64Base == 0xffff0000)1656 && pCtx->cs.u64Base == 0xffff0000) 1657 1657 { 1658 1658 /* VT-x will fail with a guest invalid state otherwise... (CPU state after a reset) */ 1659 pCtx->cs Hid.u64Base = 0xf0000;1660 pCtx->cs =0xf000;1659 pCtx->cs.u64Base = 0xf0000; 1660 pCtx->cs.Sel = 0xf000; 1661 1661 } 1662 1662 } … … 1686 1686 if (pVCpu->hwaccm.s.fContextUseFlags & HWACCM_CHANGED_GUEST_LDTR) 1687 1687 { 1688 if (pCtx->ldtr == 0)1688 if (pCtx->ldtr.Sel == 0) 1689 1689 { 1690 1690 rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_LDTR, 0); … … 1696 1696 else 1697 1697 { 1698 rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_LDTR, pCtx->ldtr );1699 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_LDTR_LIMIT, pCtx->ldtr Hid.u32Limit);1700 rc |= VMXWriteVMCS64(VMX_VMCS64_GUEST_LDTR_BASE, pCtx->ldtr Hid.u64Base);1701 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_LDTR_ACCESS_RIGHTS, pCtx->ldtr Hid.Attr.u);1698 rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_LDTR, pCtx->ldtr.Sel); 1699 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_LDTR_LIMIT, pCtx->ldtr.u32Limit); 1700 rc |= VMXWriteVMCS64(VMX_VMCS64_GUEST_LDTR_BASE, pCtx->ldtr.u64Base); 1701 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_LDTR_ACCESS_RIGHTS, pCtx->ldtr.Attr.u); 1702 1702 } 1703 1703 AssertRC(rc); … … 1735 1735 else 1736 1736 { 1737 rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_TR, pCtx->tr );1738 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_TR_LIMIT, pCtx->tr Hid.u32Limit);1739 rc |= VMXWriteVMCS64(VMX_VMCS64_GUEST_TR_BASE, pCtx->tr Hid.u64Base);1740 1741 val = pCtx->tr Hid.Attr.u;1737 rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_TR, pCtx->tr.Sel); 1738 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_TR_LIMIT, pCtx->tr.u32Limit); 1739 rc |= VMXWriteVMCS64(VMX_VMCS64_GUEST_TR_BASE, pCtx->tr.u64Base); 1740 1741 val = pCtx->tr.Attr.u; 1742 1742 1743 1743 /* The TSS selector must be busy (REM bugs? see defect #XXXX). */ … … 2076 2076 { 2077 2077 /* Update these as wrmsr might have changed them. */ 2078 rc = VMXWriteVMCS64(VMX_VMCS64_GUEST_FS_BASE, pCtx->fs Hid.u64Base);2078 rc = VMXWriteVMCS64(VMX_VMCS64_GUEST_FS_BASE, pCtx->fs.u64Base); 2079 2079 AssertRC(rc); 2080 rc = VMXWriteVMCS64(VMX_VMCS64_GUEST_GS_BASE, pCtx->gs Hid.u64Base);2080 rc = VMXWriteVMCS64(VMX_VMCS64_GUEST_GS_BASE, pCtx->gs.u64Base); 2081 2081 AssertRC(rc); 2082 2082 } … … 3215 3215 #endif 3216 3216 3217 Log2(("E%d: New EIP=%x:%RGv\n", (uint32_t)exitReason, pCtx->cs , (RTGCPTR)pCtx->rip));3217 Log2(("E%d: New EIP=%x:%RGv\n", (uint32_t)exitReason, pCtx->cs.Sel, (RTGCPTR)pCtx->rip)); 3218 3218 Log2(("Exit reason %d, exitQualification %RGv\n", (uint32_t)exitReason, exitQualification)); 3219 3219 Log2(("instrInfo=%d instrError=%d instr length=%d\n", (uint32_t)instrInfo, (uint32_t)instrError, (uint32_t)cbInstr)); … … 3233 3233 #ifdef DBGFTRACE_ENABLED /** @todo DTrace later. */ 3234 3234 RTTraceBufAddMsgF(pVM->CTX_SUFF(hTraceBuf), "vmexit %08x %016RX64 at %04:%08RX64 %RX64", 3235 exitReason, (uint64_t)exitQualification, pCtx->cs , pCtx->rip, (uint64_t)intInfo);3235 exitReason, (uint64_t)exitQualification, pCtx->cs.Sel, pCtx->rip, (uint64_t)intInfo); 3236 3236 #endif 3237 3237 STAM_PROFILE_ADV_STOP_START(&pVCpu->hwaccm.s.StatExit1, &pVCpu->hwaccm.s.StatExit2, x); … … 3445 3445 break; 3446 3446 } 3447 Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs , (RTGCPTR)pCtx->rip));3447 Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs.Sel, (RTGCPTR)pCtx->rip)); 3448 3448 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 3449 3449 cbInstr, errCode); … … 3506 3506 } 3507 3507 /* Return to ring 3 to deal with the debug exit code. */ 3508 Log(("Debugger hardware BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs , pCtx->rip, VBOXSTRICTRC_VAL(rc)));3508 Log(("Debugger hardware BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs.Sel, pCtx->rip, VBOXSTRICTRC_VAL(rc))); 3509 3509 break; 3510 3510 } … … 3516 3516 if (rc == VINF_EM_RAW_GUEST_TRAP) 3517 3517 { 3518 Log(("Guest #BP at %04x:%RGv\n", pCtx->cs , pCtx->rip));3518 Log(("Guest #BP at %04x:%RGv\n", pCtx->cs.Sel, pCtx->rip)); 3519 3519 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 3520 3520 cbInstr, errCode); … … 3528 3528 goto ResumeExecution; 3529 3529 } 3530 Log(("Debugger BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs , pCtx->rip, VBOXSTRICTRC_VAL(rc)));3530 Log(("Debugger BP at %04x:%RGv (rc=%Rrc)\n", pCtx->cs.Sel, pCtx->rip, VBOXSTRICTRC_VAL(rc))); 3531 3531 break; 3532 3532 } … … 3542 3542 || !pVM->hwaccm.s.vmx.pRealModeTSS) 3543 3543 { 3544 Log(("Trap %x at %04X:%RGv errorCode=%RGv\n", vector, pCtx->cs , (RTGCPTR)pCtx->rip, errCode));3544 Log(("Trap %x at %04X:%RGv errorCode=%RGv\n", vector, pCtx->cs.Sel, (RTGCPTR)pCtx->rip, errCode)); 3545 3545 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 3546 3546 cbInstr, errCode); … … 3552 3552 Assert(CPUMIsGuestInRealModeEx(pCtx)); 3553 3553 3554 LogFlow(("Real mode X86_XCPT_GP instruction emulation at %x:%RGv\n", pCtx->cs , (RTGCPTR)pCtx->rip));3554 LogFlow(("Real mode X86_XCPT_GP instruction emulation at %x:%RGv\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip)); 3555 3555 3556 3556 rc2 = EMInterpretDisasOne(pVM, pVCpu, CPUMCTX2CORE(pCtx), pDis, &cbOp); … … 3695 3695 } 3696 3696 pCtx->ip = aIretFrame[0]; 3697 pCtx->cs = aIretFrame[1]; 3698 pCtx->csHid.u64Base = pCtx->cs << 4; 3697 pCtx->cs.Sel = aIretFrame[1]; 3698 pCtx->cs.ValidSel = aIretFrame[1]; 3699 pCtx->cs.u64Base = (uint32_t)pCtx->cs.Sel << 4; 3699 3700 pCtx->eflags.u = (pCtx->eflags.u & ~(X86_EFL_POPF_BITS & uMask)) 3700 3701 | (aIretFrame[2] & X86_EFL_POPF_BITS & uMask); 3701 3702 pCtx->sp += sizeof(aIretFrame); 3702 3703 3703 LogFlow(("iret to %04x:%x\n", pCtx->cs , pCtx->ip));3704 LogFlow(("iret to %04x:%x\n", pCtx->cs.Sel, pCtx->ip)); 3704 3705 fUpdateRIP = false; 3705 3706 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIret); … … 3813 3814 } 3814 3815 3815 Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs , (RTGCPTR)pCtx->rip));3816 Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs.Sel, (RTGCPTR)pCtx->rip)); 3816 3817 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 3817 3818 cbInstr, errCode); … … 3827 3828 && pVM->hwaccm.s.vmx.pRealModeTSS) 3828 3829 { 3829 Log(("Real Mode Trap %x at %04x:%04X error code %x\n", vector, pCtx->cs , pCtx->eip, errCode));3830 Log(("Real Mode Trap %x at %04x:%04X error code %x\n", vector, pCtx->cs.Sel, pCtx->eip, errCode)); 3830 3831 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 3831 3832 cbInstr, errCode); -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.h
r41330 r41906 217 217 218 218 # define VMX_WRITE_SELREG(REG, reg) \ 219 { \ 220 rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_##REG, pCtx->reg); \ 221 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_##REG##_LIMIT, pCtx->reg##Hid.u32Limit); \ 222 rc |= VMXWriteVMCS64(VMX_VMCS64_GUEST_##REG##_BASE, pCtx->reg##Hid.u64Base); \ 219 do \ 220 { \ 221 rc = VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_##REG, pCtx->reg.Sel); \ 222 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_##REG##_LIMIT, pCtx->reg.u32Limit); \ 223 rc |= VMXWriteVMCS64(VMX_VMCS64_GUEST_##REG##_BASE, pCtx->reg.u64Base); \ 223 224 if ((pCtx->eflags.u32 & X86_EFL_VM)) \ 224 225 { \ 225 226 /* Must override this or else VT-x will fail with invalid guest state errors. */ \ 226 227 /* DPL=3, present, code/data, r/w/accessed. */ \ 227 val = (pCtx->reg ##Hid.Attr.u & ~0xFF) | 0xF3;\228 val = (pCtx->reg.Attr.u & ~0xFF) | 0xF3; \ 228 229 } \ 229 230 else \ … … 236 237 } \ 237 238 else \ 238 if ( ( pCtx->reg 239 if ( ( pCtx->reg.Sel \ 239 240 || !CPUMIsGuestInPagedProtectedModeEx(pCtx) \ 240 || (!pCtx->cs Hid.Attr.n.u1DefBig && !CPUMIsGuestIn64BitCodeEx(pCtx))\241 || (!pCtx->cs.Attr.n.u1DefBig && !CPUMIsGuestIn64BitCodeEx(pCtx)) \ 241 242 ) \ 242 && pCtx->reg ##Hid.Attr.n.u1Present == 1)\243 && pCtx->reg.Attr.n.u1Present == 1) \ 243 244 { \ 244 val = pCtx->reg ##Hid.Attr.u | X86_SEL_TYPE_ACCESSED;\245 val = pCtx->reg.Attr.u | X86_SEL_TYPE_ACCESSED; \ 245 246 } \ 246 247 else \ … … 248 249 \ 249 250 rc |= VMXWriteVMCS(VMX_VMCS32_GUEST_##REG##_ACCESS_RIGHTS, val); \ 250 } 251 } while (0) 251 252 252 253 # define VMX_READ_SELREG(REG, reg) \ 253 { \ 254 VMXReadCachedVMCS(VMX_VMCS16_GUEST_FIELD_##REG, &val); \ 255 pCtx->reg = val; \ 256 VMXReadCachedVMCS(VMX_VMCS32_GUEST_##REG##_LIMIT, &val); \ 257 pCtx->reg##Hid.u32Limit = val; \ 258 VMXReadCachedVMCS(VMX_VMCS64_GUEST_##REG##_BASE, &val); \ 259 pCtx->reg##Hid.u64Base = val; \ 260 VMXReadCachedVMCS(VMX_VMCS32_GUEST_##REG##_ACCESS_RIGHTS, &val); \ 261 pCtx->reg##Hid.Attr.u = val; \ 262 } 254 do \ 255 { \ 256 VMXReadCachedVMCS(VMX_VMCS16_GUEST_FIELD_##REG, &val); \ 257 pCtx->reg.Sel = val; \ 258 pCtx->reg.ValidSel = val; \ 259 pCtx->reg.fFlags = CPUMSELREG_FLAGS_VALID; \ 260 VMXReadCachedVMCS(VMX_VMCS32_GUEST_##REG##_LIMIT, &val); \ 261 pCtx->reg.u32Limit = val; \ 262 VMXReadCachedVMCS(VMX_VMCS64_GUEST_##REG##_BASE, &val); \ 263 pCtx->reg.u64Base = val; \ 264 VMXReadCachedVMCS(VMX_VMCS32_GUEST_##REG##_ACCESS_RIGHTS, &val); \ 265 pCtx->reg.Attr.u = val; \ 266 } while (0) 263 267 264 268 /* Don't read from the cache in this macro; used only in case of failure where the cache is out of sync. */ 265 269 # define VMX_LOG_SELREG(REG, szSelReg, val) \ 266 { \ 267 VMXReadVMCS(VMX_VMCS16_GUEST_FIELD_##REG, &(val)); \ 268 Log(("%s Selector %x\n", szSelReg, (val))); \ 269 VMXReadVMCS(VMX_VMCS32_GUEST_##REG##_LIMIT, &(val)); \ 270 Log(("%s Limit %x\n", szSelReg, (val))); \ 271 VMXReadVMCS(VMX_VMCS64_GUEST_##REG##_BASE, &(val)); \ 272 Log(("%s Base %RX64\n", szSelReg, (uint64_t)(val))); \ 273 VMXReadVMCS(VMX_VMCS32_GUEST_##REG##_ACCESS_RIGHTS, &(val)); \ 274 Log(("%s Attributes %x\n", szSelReg, (val))); \ 275 } 270 do \ 271 { \ 272 VMXReadVMCS(VMX_VMCS16_GUEST_FIELD_##REG, &(val)); \ 273 Log(("%s Selector %x\n", szSelReg, (val))); \ 274 VMXReadVMCS(VMX_VMCS32_GUEST_##REG##_LIMIT, &(val)); \ 275 Log(("%s Limit %x\n", szSelReg, (val))); \ 276 VMXReadVMCS(VMX_VMCS64_GUEST_##REG##_BASE, &(val)); \ 277 Log(("%s Base %RX64\n", szSelReg, (uint64_t)(val))); \ 278 VMXReadVMCS(VMX_VMCS32_GUEST_##REG##_ACCESS_RIGHTS, &(val)); \ 279 Log(("%s Attributes %x\n", szSelReg, (val))); \ 280 } while (0) 276 281 277 282 /** -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r41905 r41906 176 176 SSMFIELD_ENTRY( CPUMCTX, rsp), 177 177 SSMFIELD_ENTRY_OLD( lss_esp, sizeof(uint32_t)), 178 SSMFIELD_ENTRY( CPUMCTX, ss ),178 SSMFIELD_ENTRY( CPUMCTX, ss.Sel), 179 179 SSMFIELD_ENTRY_OLD( ssPadding, sizeof(uint16_t)), 180 SSMFIELD_ENTRY( CPUMCTX, gs ),180 SSMFIELD_ENTRY( CPUMCTX, gs.Sel), 181 181 SSMFIELD_ENTRY_OLD( gsPadding, sizeof(uint16_t)), 182 SSMFIELD_ENTRY( CPUMCTX, fs ),182 SSMFIELD_ENTRY( CPUMCTX, fs.Sel), 183 183 SSMFIELD_ENTRY_OLD( fsPadding, sizeof(uint16_t)), 184 SSMFIELD_ENTRY( CPUMCTX, es ),184 SSMFIELD_ENTRY( CPUMCTX, es.Sel), 185 185 SSMFIELD_ENTRY_OLD( esPadding, sizeof(uint16_t)), 186 SSMFIELD_ENTRY( CPUMCTX, ds ),186 SSMFIELD_ENTRY( CPUMCTX, ds.Sel), 187 187 SSMFIELD_ENTRY_OLD( dsPadding, sizeof(uint16_t)), 188 SSMFIELD_ENTRY( CPUMCTX, cs ),188 SSMFIELD_ENTRY( CPUMCTX, cs.Sel), 189 189 SSMFIELD_ENTRY_OLD( csPadding, sizeof(uint16_t)*3), 190 190 SSMFIELD_ENTRY( CPUMCTX, rflags), … … 198 198 SSMFIELD_ENTRY( CPUMCTX, r14), 199 199 SSMFIELD_ENTRY( CPUMCTX, r15), 200 SSMFIELD_ENTRY( CPUMCTX, es Hid.u64Base),201 SSMFIELD_ENTRY( CPUMCTX, es Hid.u32Limit),202 SSMFIELD_ENTRY( CPUMCTX, es Hid.Attr),203 SSMFIELD_ENTRY( CPUMCTX, cs Hid.u64Base),204 SSMFIELD_ENTRY( CPUMCTX, cs Hid.u32Limit),205 SSMFIELD_ENTRY( CPUMCTX, cs Hid.Attr),206 SSMFIELD_ENTRY( CPUMCTX, ss Hid.u64Base),207 SSMFIELD_ENTRY( CPUMCTX, ss Hid.u32Limit),208 SSMFIELD_ENTRY( CPUMCTX, ss Hid.Attr),209 SSMFIELD_ENTRY( CPUMCTX, ds Hid.u64Base),210 SSMFIELD_ENTRY( CPUMCTX, ds Hid.u32Limit),211 SSMFIELD_ENTRY( CPUMCTX, ds Hid.Attr),212 SSMFIELD_ENTRY( CPUMCTX, fs Hid.u64Base),213 SSMFIELD_ENTRY( CPUMCTX, fs Hid.u32Limit),214 SSMFIELD_ENTRY( CPUMCTX, fs Hid.Attr),215 SSMFIELD_ENTRY( CPUMCTX, gs Hid.u64Base),216 SSMFIELD_ENTRY( CPUMCTX, gs Hid.u32Limit),217 SSMFIELD_ENTRY( CPUMCTX, gs Hid.Attr),200 SSMFIELD_ENTRY( CPUMCTX, es.u64Base), 201 SSMFIELD_ENTRY( CPUMCTX, es.u32Limit), 202 SSMFIELD_ENTRY( CPUMCTX, es.Attr), 203 SSMFIELD_ENTRY( CPUMCTX, cs.u64Base), 204 SSMFIELD_ENTRY( CPUMCTX, cs.u32Limit), 205 SSMFIELD_ENTRY( CPUMCTX, cs.Attr), 206 SSMFIELD_ENTRY( CPUMCTX, ss.u64Base), 207 SSMFIELD_ENTRY( CPUMCTX, ss.u32Limit), 208 SSMFIELD_ENTRY( CPUMCTX, ss.Attr), 209 SSMFIELD_ENTRY( CPUMCTX, ds.u64Base), 210 SSMFIELD_ENTRY( CPUMCTX, ds.u32Limit), 211 SSMFIELD_ENTRY( CPUMCTX, ds.Attr), 212 SSMFIELD_ENTRY( CPUMCTX, fs.u64Base), 213 SSMFIELD_ENTRY( CPUMCTX, fs.u32Limit), 214 SSMFIELD_ENTRY( CPUMCTX, fs.Attr), 215 SSMFIELD_ENTRY( CPUMCTX, gs.u64Base), 216 SSMFIELD_ENTRY( CPUMCTX, gs.u32Limit), 217 SSMFIELD_ENTRY( CPUMCTX, gs.Attr), 218 218 SSMFIELD_ENTRY( CPUMCTX, cr0), 219 219 SSMFIELD_ENTRY( CPUMCTX, cr2), … … 234 234 SSMFIELD_ENTRY( CPUMCTX, idtr.pIdt), 235 235 SSMFIELD_ENTRY_OLD( idtrPadding, sizeof(uint16_t)), 236 SSMFIELD_ENTRY( CPUMCTX, ldtr ),236 SSMFIELD_ENTRY( CPUMCTX, ldtr.Sel), 237 237 SSMFIELD_ENTRY_OLD( ldtrPadding, sizeof(uint16_t)), 238 SSMFIELD_ENTRY( CPUMCTX, tr ),238 SSMFIELD_ENTRY( CPUMCTX, tr.Sel), 239 239 SSMFIELD_ENTRY_OLD( trPadding, sizeof(uint16_t)), 240 240 SSMFIELD_ENTRY( CPUMCTX, SysEnter.cs), … … 248 248 SSMFIELD_ENTRY( CPUMCTX, msrSFMASK), 249 249 SSMFIELD_ENTRY( CPUMCTX, msrKERNELGSBASE), 250 SSMFIELD_ENTRY( CPUMCTX, ldtr Hid.u64Base),251 SSMFIELD_ENTRY( CPUMCTX, ldtr Hid.u32Limit),252 SSMFIELD_ENTRY( CPUMCTX, ldtr Hid.Attr),253 SSMFIELD_ENTRY( CPUMCTX, tr Hid.u64Base),254 SSMFIELD_ENTRY( CPUMCTX, tr Hid.u32Limit),255 SSMFIELD_ENTRY( CPUMCTX, tr Hid.Attr),250 SSMFIELD_ENTRY( CPUMCTX, ldtr.u64Base), 251 SSMFIELD_ENTRY( CPUMCTX, ldtr.u32Limit), 252 SSMFIELD_ENTRY( CPUMCTX, ldtr.Attr), 253 SSMFIELD_ENTRY( CPUMCTX, tr.u64Base), 254 SSMFIELD_ENTRY( CPUMCTX, tr.u32Limit), 255 SSMFIELD_ENTRY( CPUMCTX, tr.Attr), 256 256 SSMFIELD_ENTRY_TERM() 257 257 }; … … 305 305 SSMFIELD_ENTRY( CPUMCTX, rcx), 306 306 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, rsp), 307 SSMFIELD_ENTRY( CPUMCTX, ss ),307 SSMFIELD_ENTRY( CPUMCTX, ss.Sel), 308 308 SSMFIELD_ENTRY_OLD( ssPadding, sizeof(uint16_t)), 309 309 SSMFIELD_ENTRY_OLD( CPUMCTX, sizeof(uint64_t) /*rsp_notused*/), 310 SSMFIELD_ENTRY( CPUMCTX, gs ),310 SSMFIELD_ENTRY( CPUMCTX, gs.Sel), 311 311 SSMFIELD_ENTRY_OLD( gsPadding, sizeof(uint16_t)), 312 SSMFIELD_ENTRY( CPUMCTX, fs ),312 SSMFIELD_ENTRY( CPUMCTX, fs.Sel), 313 313 SSMFIELD_ENTRY_OLD( fsPadding, sizeof(uint16_t)), 314 SSMFIELD_ENTRY( CPUMCTX, es ),314 SSMFIELD_ENTRY( CPUMCTX, es.Sel), 315 315 SSMFIELD_ENTRY_OLD( esPadding, sizeof(uint16_t)), 316 SSMFIELD_ENTRY( CPUMCTX, ds ),316 SSMFIELD_ENTRY( CPUMCTX, ds.Sel), 317 317 SSMFIELD_ENTRY_OLD( dsPadding, sizeof(uint16_t)), 318 SSMFIELD_ENTRY( CPUMCTX, cs ),318 SSMFIELD_ENTRY( CPUMCTX, cs.Sel), 319 319 SSMFIELD_ENTRY_OLD( csPadding, sizeof(uint16_t)*3), 320 320 SSMFIELD_ENTRY( CPUMCTX, rflags), … … 328 328 SSMFIELD_ENTRY( CPUMCTX, r14), 329 329 SSMFIELD_ENTRY( CPUMCTX, r15), 330 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, es Hid.u64Base),331 SSMFIELD_ENTRY( CPUMCTX, es Hid.u32Limit),332 SSMFIELD_ENTRY( CPUMCTX, es Hid.Attr),333 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, cs Hid.u64Base),334 SSMFIELD_ENTRY( CPUMCTX, cs Hid.u32Limit),335 SSMFIELD_ENTRY( CPUMCTX, cs Hid.Attr),336 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, ss Hid.u64Base),337 SSMFIELD_ENTRY( CPUMCTX, ss Hid.u32Limit),338 SSMFIELD_ENTRY( CPUMCTX, ss Hid.Attr),339 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, ds Hid.u64Base),340 SSMFIELD_ENTRY( CPUMCTX, ds Hid.u32Limit),341 SSMFIELD_ENTRY( CPUMCTX, ds Hid.Attr),342 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, fs Hid.u64Base),343 SSMFIELD_ENTRY( CPUMCTX, fs Hid.u32Limit),344 SSMFIELD_ENTRY( CPUMCTX, fs Hid.Attr),345 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, gs Hid.u64Base),346 SSMFIELD_ENTRY( CPUMCTX, gs Hid.u32Limit),347 SSMFIELD_ENTRY( CPUMCTX, gs Hid.Attr),330 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, es.u64Base), 331 SSMFIELD_ENTRY( CPUMCTX, es.u32Limit), 332 SSMFIELD_ENTRY( CPUMCTX, es.Attr), 333 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, cs.u64Base), 334 SSMFIELD_ENTRY( CPUMCTX, cs.u32Limit), 335 SSMFIELD_ENTRY( CPUMCTX, cs.Attr), 336 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, ss.u64Base), 337 SSMFIELD_ENTRY( CPUMCTX, ss.u32Limit), 338 SSMFIELD_ENTRY( CPUMCTX, ss.Attr), 339 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, ds.u64Base), 340 SSMFIELD_ENTRY( CPUMCTX, ds.u32Limit), 341 SSMFIELD_ENTRY( CPUMCTX, ds.Attr), 342 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, fs.u64Base), 343 SSMFIELD_ENTRY( CPUMCTX, fs.u32Limit), 344 SSMFIELD_ENTRY( CPUMCTX, fs.Attr), 345 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, gs.u64Base), 346 SSMFIELD_ENTRY( CPUMCTX, gs.u32Limit), 347 SSMFIELD_ENTRY( CPUMCTX, gs.Attr), 348 348 SSMFIELD_ENTRY( CPUMCTX, cr0), 349 349 SSMFIELD_ENTRY( CPUMCTX, cr2), … … 367 367 SSMFIELD_ENTRY_OLD( idtrPadding, sizeof(uint16_t)), 368 368 SSMFIELD_ENTRY_OLD( idtrPadding64, sizeof(uint64_t)), 369 SSMFIELD_ENTRY( CPUMCTX, ldtr ),369 SSMFIELD_ENTRY( CPUMCTX, ldtr.Sel), 370 370 SSMFIELD_ENTRY_OLD( ldtrPadding, sizeof(uint16_t)), 371 SSMFIELD_ENTRY( CPUMCTX, tr ),371 SSMFIELD_ENTRY( CPUMCTX, tr.Sel), 372 372 SSMFIELD_ENTRY_OLD( trPadding, sizeof(uint16_t)), 373 373 SSMFIELD_ENTRY( CPUMCTX, SysEnter.cs), … … 383 383 SSMFIELD_ENTRY_OLD( msrGSBASE, sizeof(uint64_t)), 384 384 SSMFIELD_ENTRY( CPUMCTX, msrKERNELGSBASE), 385 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, ldtr Hid.u64Base),386 SSMFIELD_ENTRY( CPUMCTX, ldtr Hid.u32Limit),387 SSMFIELD_ENTRY( CPUMCTX, ldtr Hid.Attr),388 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, tr Hid.u64Base),389 SSMFIELD_ENTRY( CPUMCTX, tr Hid.u32Limit),390 SSMFIELD_ENTRY( CPUMCTX, tr Hid.Attr),385 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, ldtr.u64Base), 386 SSMFIELD_ENTRY( CPUMCTX, ldtr.u32Limit), 387 SSMFIELD_ENTRY( CPUMCTX, ldtr.Attr), 388 SSMFIELD_ENTRY_U32_ZX_U64( CPUMCTX, tr.u64Base), 389 SSMFIELD_ENTRY( CPUMCTX, tr.u32Limit), 390 SSMFIELD_ENTRY( CPUMCTX, tr.Attr), 391 391 SSMFIELD_ENTRY_OLD( padding, sizeof(uint32_t)*2), 392 392 SSMFIELD_ENTRY_TERM() … … 1358 1358 pCtx->eflags.Bits.u1Reserved0 = 1; 1359 1359 1360 pCtx->cs = 0xf000; 1361 pCtx->csHid.u64Base = UINT64_C(0xffff0000); 1362 pCtx->csHid.u32Limit = 0x0000ffff; 1363 pCtx->csHid.Attr.n.u1DescType = 1; /* code/data segment */ 1364 pCtx->csHid.Attr.n.u1Present = 1; 1365 pCtx->csHid.Attr.n.u4Type = X86_SEL_TYPE_READ | X86_SEL_TYPE_CODE; 1366 1367 pCtx->dsHid.u32Limit = 0x0000ffff; 1368 pCtx->dsHid.Attr.n.u1DescType = 1; /* code/data segment */ 1369 pCtx->dsHid.Attr.n.u1Present = 1; 1370 pCtx->dsHid.Attr.n.u4Type = X86_SEL_TYPE_RW; 1371 1372 pCtx->esHid.u32Limit = 0x0000ffff; 1373 pCtx->esHid.Attr.n.u1DescType = 1; /* code/data segment */ 1374 pCtx->esHid.Attr.n.u1Present = 1; 1375 pCtx->esHid.Attr.n.u4Type = X86_SEL_TYPE_RW; 1376 1377 pCtx->fsHid.u32Limit = 0x0000ffff; 1378 pCtx->fsHid.Attr.n.u1DescType = 1; /* code/data segment */ 1379 pCtx->fsHid.Attr.n.u1Present = 1; 1380 pCtx->fsHid.Attr.n.u4Type = X86_SEL_TYPE_RW; 1381 1382 pCtx->gsHid.u32Limit = 0x0000ffff; 1383 pCtx->gsHid.Attr.n.u1DescType = 1; /* code/data segment */ 1384 pCtx->gsHid.Attr.n.u1Present = 1; 1385 pCtx->gsHid.Attr.n.u4Type = X86_SEL_TYPE_RW; 1386 1387 pCtx->ssHid.u32Limit = 0x0000ffff; 1388 pCtx->ssHid.Attr.n.u1Present = 1; 1389 pCtx->ssHid.Attr.n.u1DescType = 1; /* code/data segment */ 1390 pCtx->ssHid.Attr.n.u4Type = X86_SEL_TYPE_RW; 1360 pCtx->cs.Sel = 0xf000; 1361 pCtx->cs.ValidSel = 0xf000; 1362 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1363 pCtx->cs.u64Base = UINT64_C(0xffff0000); 1364 pCtx->cs.u32Limit = 0x0000ffff; 1365 pCtx->cs.Attr.n.u1DescType = 1; /* code/data segment */ 1366 pCtx->cs.Attr.n.u1Present = 1; 1367 pCtx->cs.Attr.n.u4Type = X86_SEL_TYPE_READ | X86_SEL_TYPE_CODE; 1368 1369 pCtx->ds.fFlags = CPUMSELREG_FLAGS_VALID; 1370 pCtx->ds.u32Limit = 0x0000ffff; 1371 pCtx->ds.Attr.n.u1DescType = 1; /* code/data segment */ 1372 pCtx->ds.Attr.n.u1Present = 1; 1373 pCtx->ds.Attr.n.u4Type = X86_SEL_TYPE_RW; 1374 1375 pCtx->es.fFlags = CPUMSELREG_FLAGS_VALID; 1376 pCtx->es.u32Limit = 0x0000ffff; 1377 pCtx->es.Attr.n.u1DescType = 1; /* code/data segment */ 1378 pCtx->es.Attr.n.u1Present = 1; 1379 pCtx->es.Attr.n.u4Type = X86_SEL_TYPE_RW; 1380 1381 pCtx->fs.fFlags = CPUMSELREG_FLAGS_VALID; 1382 pCtx->fs.u32Limit = 0x0000ffff; 1383 pCtx->fs.Attr.n.u1DescType = 1; /* code/data segment */ 1384 pCtx->fs.Attr.n.u1Present = 1; 1385 pCtx->fs.Attr.n.u4Type = X86_SEL_TYPE_RW; 1386 1387 pCtx->gs.fFlags = CPUMSELREG_FLAGS_VALID; 1388 pCtx->gs.u32Limit = 0x0000ffff; 1389 pCtx->gs.Attr.n.u1DescType = 1; /* code/data segment */ 1390 pCtx->gs.Attr.n.u1Present = 1; 1391 pCtx->gs.Attr.n.u4Type = X86_SEL_TYPE_RW; 1392 1393 pCtx->ss.fFlags = CPUMSELREG_FLAGS_VALID; 1394 pCtx->ss.u32Limit = 0x0000ffff; 1395 pCtx->ss.Attr.n.u1Present = 1; 1396 pCtx->ss.Attr.n.u1DescType = 1; /* code/data segment */ 1397 pCtx->ss.Attr.n.u4Type = X86_SEL_TYPE_RW; 1391 1398 1392 1399 pCtx->idtr.cbIdt = 0xffff; 1393 1400 pCtx->gdtr.cbGdt = 0xffff; 1394 1401 1395 pCtx->ldtrHid.u32Limit = 0xffff; 1396 pCtx->ldtrHid.Attr.n.u1Present = 1; 1397 pCtx->ldtrHid.Attr.n.u4Type = X86_SEL_TYPE_SYS_LDT; 1398 1399 pCtx->trHid.u32Limit = 0xffff; 1400 pCtx->trHid.Attr.n.u1Present = 1; 1401 pCtx->trHid.Attr.n.u4Type = X86_SEL_TYPE_SYS_386_TSS_BUSY; /* Deduction, not properly documented by Intel. */ 1402 pCtx->ldtr.fFlags = CPUMSELREG_FLAGS_VALID; 1403 pCtx->ldtr.u32Limit = 0xffff; 1404 pCtx->ldtr.Attr.n.u1Present = 1; 1405 pCtx->ldtr.Attr.n.u4Type = X86_SEL_TYPE_SYS_LDT; 1406 1407 pCtx->tr.fFlags = CPUMSELREG_FLAGS_VALID; 1408 pCtx->tr.u32Limit = 0xffff; 1409 pCtx->tr.Attr.n.u1Present = 1; 1410 pCtx->tr.Attr.n.u4Type = X86_SEL_TYPE_SYS_386_TSS_BUSY; /* Deduction, not properly documented by Intel. */ 1402 1411 1403 1412 pCtx->dr[6] = X86_DR6_INIT_VAL; … … 2614 2623 pszPrefix, pCtxCore->r14, pszPrefix, pCtxCore->r15, 2615 2624 pszPrefix, pCtxCore->rip, pszPrefix, pCtxCore->rsp, pszPrefix, pCtxCore->rbp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags, 2616 pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,2617 pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, efl);2625 pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel, 2626 pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, efl); 2618 2627 else 2619 2628 pHlp->pfnPrintf(pHlp, … … 2623 2632 pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi, 2624 2633 pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags, 2625 pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,2626 pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, efl);2634 pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel, 2635 pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, efl); 2627 2636 break; 2628 2637 … … 2642 2651 pszPrefix, pCtxCore->r14, pszPrefix, pCtxCore->r15, 2643 2652 pszPrefix, pCtxCore->rip, pszPrefix, pCtxCore->rsp, pszPrefix, pCtxCore->rbp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags, 2644 pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,2645 pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, (RTSEL)pCtx->tr, pszPrefix, efl,2653 pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel, 2654 pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, pCtx->tr.Sel, pszPrefix, efl, 2646 2655 pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4, 2647 pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, (RTSEL)pCtx->ldtr);2656 pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->ldtr.Sel); 2648 2657 else 2649 2658 pHlp->pfnPrintf(pHlp, … … 2655 2664 pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi, 2656 2665 pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags, 2657 pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,2658 pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, (RTSEL)pCtx->tr, pszPrefix, efl,2666 pszPrefix, pCtxCore->cs.Sel, pszPrefix, pCtxCore->ss.Sel, pszPrefix, pCtxCore->ds.Sel, pszPrefix, pCtxCore->es.Sel, 2667 pszPrefix, pCtxCore->fs.Sel, pszPrefix, pCtxCore->gs.Sel, pszPrefix, pCtx->tr.Sel, pszPrefix, efl, 2659 2668 pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4, 2660 pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, (RTSEL)pCtx->ldtr);2669 pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->ldtr.Sel); 2661 2670 break; 2662 2671 … … 2687 2696 pszPrefix, pCtxCore->r14, pszPrefix, pCtxCore->r15, 2688 2697 pszPrefix, pCtxCore->rip, pszPrefix, pCtxCore->rsp, pszPrefix, pCtxCore->rbp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags, 2689 pszPrefix, (RTSEL)pCtxCore->cs, pCtx->csHid.u64Base, pCtx->csHid.u32Limit, pCtx->csHid.Attr.u,2690 pszPrefix, (RTSEL)pCtxCore->ds, pCtx->dsHid.u64Base, pCtx->dsHid.u32Limit, pCtx->dsHid.Attr.u,2691 pszPrefix, (RTSEL)pCtxCore->es, pCtx->esHid.u64Base, pCtx->esHid.u32Limit, pCtx->esHid.Attr.u,2692 pszPrefix, (RTSEL)pCtxCore->fs, pCtx->fsHid.u64Base, pCtx->fsHid.u32Limit, pCtx->fsHid.Attr.u,2693 pszPrefix, (RTSEL)pCtxCore->gs, pCtx->gsHid.u64Base, pCtx->gsHid.u32Limit, pCtx->gsHid.Attr.u,2694 pszPrefix, (RTSEL)pCtxCore->ss, pCtx->ssHid.u64Base, pCtx->ssHid.u32Limit, pCtx->ssHid.Attr.u,2698 pszPrefix, pCtxCore->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u, 2699 pszPrefix, pCtxCore->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u, 2700 pszPrefix, pCtxCore->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u, 2701 pszPrefix, pCtxCore->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, pCtx->fs.Attr.u, 2702 pszPrefix, pCtxCore->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, pCtx->gs.Attr.u, 2703 pszPrefix, pCtxCore->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, pCtx->ss.Attr.u, 2695 2704 pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4, 2696 2705 pszPrefix, pCtx->dr[0], pszPrefix, pCtx->dr[1], pszPrefix, pCtx->dr[2], pszPrefix, pCtx->dr[3], 2697 2706 pszPrefix, pCtx->dr[4], pszPrefix, pCtx->dr[5], pszPrefix, pCtx->dr[6], pszPrefix, pCtx->dr[7], 2698 2707 pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, pszPrefix, efl, 2699 pszPrefix, (RTSEL)pCtx->ldtr, pCtx->ldtrHid.u64Base, pCtx->ldtrHid.u32Limit, pCtx->ldtrHid.Attr.u,2700 pszPrefix, (RTSEL)pCtx->tr, pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,2708 pszPrefix, pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u, 2709 pszPrefix, pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u, 2701 2710 pszPrefix, pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp); 2702 2711 else … … 2717 2726 pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi, 2718 2727 pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags, 2719 pszPrefix, (RTSEL)pCtxCore->cs, pCtx->csHid.u64Base, pCtx->csHid.u32Limit, pCtx->csHid.Attr.u, pszPrefix, pCtx->dr[0], pszPrefix, pCtx->dr[1],2720 pszPrefix, (RTSEL)pCtxCore->ds, pCtx->dsHid.u64Base, pCtx->dsHid.u32Limit, pCtx->dsHid.Attr.u, pszPrefix, pCtx->dr[2], pszPrefix, pCtx->dr[3],2721 pszPrefix, (RTSEL)pCtxCore->es, pCtx->esHid.u64Base, pCtx->esHid.u32Limit, pCtx->esHid.Attr.u, pszPrefix, pCtx->dr[4], pszPrefix, pCtx->dr[5],2722 pszPrefix, (RTSEL)pCtxCore->fs, pCtx->fsHid.u64Base, pCtx->fsHid.u32Limit, pCtx->fsHid.Attr.u, pszPrefix, pCtx->dr[6], pszPrefix, pCtx->dr[7],2723 pszPrefix, (RTSEL)pCtxCore->gs, pCtx->gsHid.u64Base, pCtx->gsHid.u32Limit, pCtx->gsHid.Attr.u, pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2,2724 pszPrefix, (RTSEL)pCtxCore->ss, pCtx->ssHid.u64Base, pCtx->ssHid.u32Limit, pCtx->ssHid.Attr.u, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4,2728 pszPrefix, pCtxCore->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u, pszPrefix, pCtx->dr[0], pszPrefix, pCtx->dr[1], 2729 pszPrefix, pCtxCore->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u, pszPrefix, pCtx->dr[2], pszPrefix, pCtx->dr[3], 2730 pszPrefix, pCtxCore->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u, pszPrefix, pCtx->dr[4], pszPrefix, pCtx->dr[5], 2731 pszPrefix, pCtxCore->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, pCtx->fs.Attr.u, pszPrefix, pCtx->dr[6], pszPrefix, pCtx->dr[7], 2732 pszPrefix, pCtxCore->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, pCtx->gs.Attr.u, pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2, 2733 pszPrefix, pCtxCore->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, pCtx->ss.Attr.u, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4, 2725 2734 pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, pszPrefix, efl, 2726 pszPrefix, (RTSEL)pCtx->ldtr, pCtx->ldtrHid.u64Base, pCtx->ldtrHid.u32Limit, pCtx->ldtrHid.Attr.u,2727 pszPrefix, (RTSEL)pCtx->tr, pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,2735 pszPrefix, pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u, 2736 pszPrefix, pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u, 2728 2737 pszPrefix, pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp); 2729 2738 … … 2964 2973 /*pCtx->eax,*/ pCtx->ebx, /*pCtx->ecx, pCtx->edx,*/ pCtx->esi, pCtx->edi, 2965 2974 /*pCtx->eip,*/ pCtx->esp, pCtx->ebp, X86_EFL_GET_IOPL(efl), szEFlags, 2966 (RTSEL)pCtx->cs, (RTSEL)pCtx->ds, (RTSEL)pCtx->es, (RTSEL)pCtx->fs, (RTSEL)pCtx->gs, efl,2975 pCtx->cs, pCtx->ds, pCtx->es, pCtx->fs, pCtx->gs, efl, 2967 2976 pCtx->cr0, /*pCtx->cr2,*/ pCtx->cr3, pCtx->cr4, 2968 2977 pCtx->dr0, pCtx->dr1, pCtx->dr2, pCtx->dr3, pCtx->dr6, pCtx->dr7, 2969 (uint32_t)pCtx->gdtr.uAddr, pCtx->gdtr.cb, (RTSEL)pCtx->ldtr,2978 (uint32_t)pCtx->gdtr.uAddr, pCtx->gdtr.cb, pCtx->ldtr, 2970 2979 pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp); 2971 2980 } … … 3000 3009 pCtx->r14, pCtx->r15, 3001 3010 X86_EFL_GET_IOPL(efl), szEFlags, 3002 (RTSEL)pCtx->cs, (RTSEL)pCtx->ds, (RTSEL)pCtx->es, (RTSEL)pCtx->fs, (RTSEL)pCtx->gs, efl,3011 pCtx->cs, pCtx->ds, pCtx->es, pCtx->fs, pCtx->gs, efl, 3003 3012 pCtx->cr0, /*pCtx->cr2,*/ pCtx->cr3, 3004 3013 pCtx->cr4, pCtx->ldtr, pCtx->tr, … … 3827 3836 if (CPUMAreHiddenSelRegsValid(pVCpu)) 3828 3837 { 3829 State.f64Bits = enmMode >= PGMMODE_AMD64 && pCtx->cs Hid.Attr.n.u1Long;3830 State.GCPtrSegBase = pCtx->cs Hid.u64Base;3831 State.GCPtrSegEnd = pCtx->cs Hid.u32Limit + 1 + (RTGCUINTPTR)pCtx->csHid.u64Base;3832 State.cbSegLimit = pCtx->cs Hid.u32Limit;3838 State.f64Bits = enmMode >= PGMMODE_AMD64 && pCtx->cs.Attr.n.u1Long; 3839 State.GCPtrSegBase = pCtx->cs.u64Base; 3840 State.GCPtrSegEnd = pCtx->cs.u32Limit + 1 + (RTGCUINTPTR)pCtx->cs.u64Base; 3841 State.cbSegLimit = pCtx->cs.u32Limit; 3833 3842 enmDisCpuMode = (State.f64Bits) 3834 3843 ? DISCPUMODE_64BIT 3835 : pCtx->cs Hid.Attr.n.u1DefBig3844 : pCtx->cs.Attr.n.u1DefBig 3836 3845 ? DISCPUMODE_32BIT 3837 3846 : DISCPUMODE_16BIT; … … 3841 3850 DBGFSELINFO SelInfo; 3842 3851 3843 rc = SELMR3GetShadowSelectorInfo(pVM, pCtx->cs , &SelInfo);3852 rc = SELMR3GetShadowSelectorInfo(pVM, pCtx->cs.Sel, &SelInfo); 3844 3853 if (RT_FAILURE(rc)) 3845 3854 { 3846 AssertMsgFailed(("SELMR3GetShadowSelectorInfo failed for %04X:%RGv rc=%d\n", pCtx->cs , GCPtrPC, rc));3855 AssertMsgFailed(("SELMR3GetShadowSelectorInfo failed for %04X:%RGv rc=%d\n", pCtx->cs.Sel, GCPtrPC, rc)); 3847 3856 return rc; 3848 3857 } … … 3851 3860 * Validate the selector. 3852 3861 */ 3853 rc = DBGFR3SelInfoValidateCS(&SelInfo, pCtx->ss );3862 rc = DBGFR3SelInfoValidateCS(&SelInfo, pCtx->ss.Sel); 3854 3863 if (RT_FAILURE(rc)) 3855 3864 { 3856 AssertMsgFailed(("SELMSelInfoValidateCS failed for %04X:%RGv rc=%d\n", pCtx->cs , GCPtrPC, rc));3865 AssertMsgFailed(("SELMSelInfoValidateCS failed for %04X:%RGv rc=%d\n", pCtx->cs.Sel, GCPtrPC, rc)); 3857 3866 return rc; 3858 3867 } … … 3867 3876 /* real or V86 mode */ 3868 3877 enmDisCpuMode = DISCPUMODE_16BIT; 3869 State.GCPtrSegBase = pCtx->cs * 16;3878 State.GCPtrSegBase = pCtx->cs.Sel * 16; 3870 3879 State.GCPtrSegEnd = 0xFFFFFFFF; 3871 3880 State.cbSegLimit = 0xFFFFFFFF; … … 3895 3904 } 3896 3905 else 3897 Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%RGv rc=%Rrc\n", pCtx->cs , GCPtrPC, rc));3906 Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%RGv rc=%Rrc\n", pCtx->cs.Sel, GCPtrPC, rc)); 3898 3907 3899 3908 /* Release mapping lock acquired in cpumR3DisasInstrRead. */ … … 4009 4018 * Are we in Ring-0? 4010 4019 */ 4011 if ( pCtxCore->ss && (pCtxCore->ss& X86_SEL_RPL) == 04020 if ( pCtxCore->ss.Sel && (pCtxCore->ss.Sel & X86_SEL_RPL) == 0 4012 4021 && !pCtxCore->eflags.Bits.u1VM) 4013 4022 { … … 4020 4029 * Set CPL to Ring-1. 4021 4030 */ 4022 pCtxCore->ss |= 1;4023 if (pCtxCore->cs && (pCtxCore->cs& X86_SEL_RPL) == 0)4024 pCtxCore->cs |= 1;4031 pCtxCore->ss.Sel |= 1; 4032 if (pCtxCore->cs.Sel && (pCtxCore->cs.Sel & X86_SEL_RPL) == 0) 4033 pCtxCore->cs.Sel |= 1; 4025 4034 } 4026 4035 else 4027 4036 { 4028 AssertMsg((pCtxCore->ss & X86_SEL_RPL) >= 2 || pCtxCore->eflags.Bits.u1VM,4037 AssertMsg((pCtxCore->ss.Sel & X86_SEL_RPL) >= 2 || pCtxCore->eflags.Bits.u1VM, 4029 4038 ("ring-1 code not supported\n")); 4030 4039 /* … … 4043 4052 */ 4044 4053 AssertMsg((pCtxCore->eflags.u32 & X86_EFL_IF), ("X86_EFL_IF is clear\n")); 4045 AssertReleaseMsg( pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss & X86_SEL_RPL)4054 AssertReleaseMsg( pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss.Sel & X86_SEL_RPL) 4046 4055 || pCtxCore->eflags.Bits.u1VM, 4047 ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss & X86_SEL_RPL));4056 ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss.Sel & X86_SEL_RPL)); 4048 4057 Assert((pVCpu->cpum.s.Guest.cr0 & (X86_CR0_PG | X86_CR0_WP | X86_CR0_PE)) == (X86_CR0_PG | X86_CR0_PE | X86_CR0_WP)); 4049 4058 … … 4082 4091 if (!pCtxCore) 4083 4092 pCtxCore = CPUMCTX2CORE(pCtx); 4084 Assert(pCtxCore->eflags.Bits.u1VM || (pCtxCore->ss & X86_SEL_RPL));4085 AssertMsg(pCtxCore->eflags.Bits.u1VM || pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss & X86_SEL_RPL),4086 ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss & X86_SEL_RPL));4093 Assert(pCtxCore->eflags.Bits.u1VM || (pCtxCore->ss.Sel & X86_SEL_RPL)); 4094 AssertMsg(pCtxCore->eflags.Bits.u1VM || pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss.Sel & X86_SEL_RPL), 4095 ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss.Sel & X86_SEL_RPL)); 4087 4096 4088 4097 /* 4089 4098 * Are we executing in raw ring-1? 4090 4099 */ 4091 if ( (pCtxCore->ss & X86_SEL_RPL) == 14100 if ( (pCtxCore->ss.Sel & X86_SEL_RPL) == 1 4092 4101 && !pCtxCore->eflags.Bits.u1VM) 4093 4102 { … … 4098 4107 /* Not quite sure if this is really required, but shouldn't harm (too much anyways). */ 4099 4108 /** @todo See what happens if we remove this. */ 4100 if ((pCtxCore->ds & X86_SEL_RPL) == 1)4101 pCtxCore->ds &= ~X86_SEL_RPL;4102 if ((pCtxCore->es & X86_SEL_RPL) == 1)4103 pCtxCore->es &= ~X86_SEL_RPL;4104 if ((pCtxCore->fs & X86_SEL_RPL) == 1)4105 pCtxCore->fs &= ~X86_SEL_RPL;4106 if ((pCtxCore->gs & X86_SEL_RPL) == 1)4107 pCtxCore->gs &= ~X86_SEL_RPL;4109 if ((pCtxCore->ds.Sel & X86_SEL_RPL) == 1) 4110 pCtxCore->ds.Sel &= ~X86_SEL_RPL; 4111 if ((pCtxCore->es.Sel & X86_SEL_RPL) == 1) 4112 pCtxCore->es.Sel &= ~X86_SEL_RPL; 4113 if ((pCtxCore->fs.Sel & X86_SEL_RPL) == 1) 4114 pCtxCore->fs.Sel &= ~X86_SEL_RPL; 4115 if ((pCtxCore->gs.Sel & X86_SEL_RPL) == 1) 4116 pCtxCore->gs.Sel &= ~X86_SEL_RPL; 4108 4117 4109 4118 /* 4110 4119 * Ring-1 selector => Ring-0. 4111 4120 */ 4112 pCtxCore->ss &= ~X86_SEL_RPL;4113 if ((pCtxCore->cs & X86_SEL_RPL) == 1)4114 pCtxCore->cs &= ~X86_SEL_RPL;4121 pCtxCore->ss.Sel &= ~X86_SEL_RPL; 4122 if ((pCtxCore->cs.Sel & X86_SEL_RPL) == 1) 4123 pCtxCore->cs.Sel &= ~X86_SEL_RPL; 4115 4124 } 4116 4125 else … … 4123 4132 { 4124 4133 /** @todo See what happens if we remove this. */ 4125 if ((pCtxCore->ds & X86_SEL_RPL) == 1)4126 pCtxCore->ds &= ~X86_SEL_RPL;4127 if ((pCtxCore->es & X86_SEL_RPL) == 1)4128 pCtxCore->es &= ~X86_SEL_RPL;4129 if ((pCtxCore->fs & X86_SEL_RPL) == 1)4130 pCtxCore->fs &= ~X86_SEL_RPL;4131 if ((pCtxCore->gs & X86_SEL_RPL) == 1)4132 pCtxCore->gs &= ~X86_SEL_RPL;4134 if ((pCtxCore->ds.Sel & X86_SEL_RPL) == 1) 4135 pCtxCore->ds.Sel &= ~X86_SEL_RPL; 4136 if ((pCtxCore->es.Sel & X86_SEL_RPL) == 1) 4137 pCtxCore->es.Sel &= ~X86_SEL_RPL; 4138 if ((pCtxCore->fs.Sel & X86_SEL_RPL) == 1) 4139 pCtxCore->fs.Sel &= ~X86_SEL_RPL; 4140 if ((pCtxCore->gs.Sel & X86_SEL_RPL) == 1) 4141 pCtxCore->gs.Sel &= ~X86_SEL_RPL; 4133 4142 } 4134 4143 } -
trunk/src/VBox/VMM/VMMR3/CPUMDbg.cpp
r41803 r41906 1013 1013 1014 1014 #define CPU_REG_SEG(UName, LName) \ 1015 CPU_REG_RW_AS(#LName, UName, U16, LName ,cpumR3RegGet_Generic, cpumR3RegSet_seg, NULL, NULL ), \1016 CPU_REG_RW_AS(#LName "_attr", UName##_ATTR, U32, LName ##Hid.Attr.u,cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL, g_aCpumRegFields_seg), \1017 CPU_REG_RW_AS(#LName "_base", UName##_BASE, U64, LName ##Hid.u64Base,cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL, NULL ), \1018 CPU_REG_RW_AS(#LName "_lim", UName##_LIMIT, U32, LName ##Hid.u32Limit,cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL, NULL )1015 CPU_REG_RW_AS(#LName, UName, U16, LName.Sel, cpumR3RegGet_Generic, cpumR3RegSet_seg, NULL, NULL ), \ 1016 CPU_REG_RW_AS(#LName "_attr", UName##_ATTR, U32, LName.Attr.u, cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL, g_aCpumRegFields_seg), \ 1017 CPU_REG_RW_AS(#LName "_base", UName##_BASE, U64, LName.u64Base, cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL, NULL ), \ 1018 CPU_REG_RW_AS(#LName "_lim", UName##_LIMIT, U32, LName.u32Limit, cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL, NULL ) 1019 1019 1020 1020 #define CPU_REG_MM(n) \ -
trunk/src/VBox/VMM/VMMR3/CSAM.cpp
r41886 r41906 2295 2295 { 2296 2296 /* Assuming 32 bits code for now. */ 2297 Assert(SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pCtxCore->eflags, pCtxCore->cs , &pCtxCore->csHid) == DISCPUMODE_32BIT);2297 Assert(SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pCtxCore->eflags, pCtxCore->cs.Sel, &pCtxCore->cs) == DISCPUMODE_32BIT); 2298 2298 2299 2299 pInstrGC = SELMToFlat(pVM, DISSELREG_CS, pCtxCore, pInstrGC); -
trunk/src/VBox/VMM/VMMR3/DBGF.cpp
r41801 r41906 588 588 /* @todo SMP support!! */ 589 589 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(VMMGetCpu(pVM)); 590 RTGCPTR eip = pCtx->rip + pCtx->cs Hid.u64Base;590 RTGCPTR eip = pCtx->rip + pCtx->cs.u64Base; 591 591 #endif 592 592 for (iBp = 0; iBp < RT_ELEMENTS(pVM->dbgf.s.aBreakpoints); iBp++) -
trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp
r41803 r41906 353 353 else 354 354 pCtxCore = CPUMGetHyperCtxCore(pVCpu); 355 Sel = pCtxCore->cs ;356 pHiddenSel = ( CPUMSELREGHID *)&pCtxCore->csHid;355 Sel = pCtxCore->cs.Sel; 356 pHiddenSel = (PCPUMSELREGHID)&pCtxCore->cs; 357 357 GCPtr = pCtxCore->rip; 358 358 } … … 413 413 { /* Assume the current CS defines the execution mode. */ 414 414 pCtxCore = CPUMGetGuestCtxCore(pVCpu); 415 pHiddenSel = (CPUMSELREGHID *)&pCtxCore->cs Hid;415 pHiddenSel = (CPUMSELREGHID *)&pCtxCore->cs; 416 416 417 417 SelInfo.u.Raw.Gen.u1Present = pHiddenSel->Attr.n.u1Present; -
trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp
r41783 r41906 301 301 pCur->AddrPC = *pAddrPC; 302 302 else 303 rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrPC, pCtxCore->cs , pCtxCore->rip);303 rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrPC, pCtxCore->cs.Sel, pCtxCore->rip); 304 304 if (RT_SUCCESS(rc)) 305 305 { … … 341 341 pCur->AddrStack = *pAddrStack; 342 342 else 343 rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrStack, pCtxCore->ss , pCtxCore->rsp & fAddrMask);343 rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrStack, pCtxCore->ss.Sel, pCtxCore->rsp & fAddrMask); 344 344 345 345 if (pAddrFrame) 346 346 pCur->AddrFrame = *pAddrFrame; 347 347 else if (RT_SUCCESS(rc)) 348 rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrFrame, pCtxCore->ss , pCtxCore->rbp & fAddrMask);348 rc = DBGFR3AddrFromSelOff(pVM, idCpu, &pCur->AddrFrame, pCtxCore->ss.Sel, pCtxCore->rbp & fAddrMask); 349 349 } 350 350 else -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r41801 r41906 965 965 966 966 if (pCtx->eflags.Bits.u1VM) 967 Log(("EMV86: %04X:%08X IF=%d\n", pCtx->cs , pCtx->eip, pCtx->eflags.Bits.u1IF));967 Log(("EMV86: %04X:%08X IF=%d\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags.Bits.u1IF)); 968 968 else 969 Log(("EMR%d: %04X:%08X ESP=%08X IF=%d CR0=%x eflags=%x\n", cpl, pCtx->cs , pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, (uint32_t)pCtx->cr0, pCtx->eflags.u));969 Log(("EMR%d: %04X:%08X ESP=%08X IF=%d CR0=%x eflags=%x\n", cpl, pCtx->cs.Sel, pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, (uint32_t)pCtx->cr0, pCtx->eflags.u)); 970 970 #endif 971 971 STAM_REL_PROFILE_ADV_START(&pVCpu->em.s.StatREMTotal, a); … … 1243 1243 } 1244 1244 1245 unsigned uSS = pCtx->ss ;1245 unsigned uSS = pCtx->ss.Sel; 1246 1246 if ( pCtx->eflags.Bits.u1VM 1247 1247 || (uSS & X86_SEL_RPL) == 3) … … 1276 1276 // Let's start with pure 32 bits ring 0 code first 1277 1277 /** @todo What's pure 32-bit mode? flat? */ 1278 if ( !(pCtx->ss Hid.Attr.n.u1DefBig)1279 || !(pCtx->cs Hid.Attr.n.u1DefBig))1278 if ( !(pCtx->ss.Attr.n.u1DefBig) 1279 || !(pCtx->cs.Attr.n.u1DefBig)) 1280 1280 { 1281 1281 Log2(("raw r0 mode refused: SS/CS not 32bit\n")); -
trunk/src/VBox/VMM/VMMR3/EMHwaccm.cpp
r41836 r41906 231 231 #endif /* 0 */ 232 232 STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, a); 233 Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs , (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp));233 Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp)); 234 234 #ifdef VBOX_WITH_REM 235 235 EMRemLock(pVM); … … 469 469 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 470 470 471 LogFlow(("emR3HwAccExecute%d: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pCtx->cs , (RTGCPTR)pCtx->rip));471 LogFlow(("emR3HwAccExecute%d: (cs:eip=%04x:%RGv)\n", pVCpu->idCpu, pCtx->cs.Sel, (RTGCPTR)pCtx->rip)); 472 472 *pfFFDone = false; 473 473 … … 509 509 */ 510 510 if (TRPMHasTrap(pVCpu)) 511 Log(("CPU%d: Pending hardware interrupt=0x%x cs:rip=%04X:%RGv\n", pVCpu->idCpu, TRPMGetTrapNo(pVCpu), pCtx->cs , (RTGCPTR)pCtx->rip));511 Log(("CPU%d: Pending hardware interrupt=0x%x cs:rip=%04X:%RGv\n", pVCpu->idCpu, TRPMGetTrapNo(pVCpu), pCtx->cs.Sel, (RTGCPTR)pCtx->rip)); 512 512 513 513 uint32_t cpl = CPUMGetGuestCPL(pVCpu, CPUMCTX2CORE(pCtx)); … … 518 518 Log(("HWV86: %08X IF=%d\n", pCtx->eip, pCtx->eflags.Bits.u1IF)); 519 519 else if (CPUMIsGuestIn64BitCodeEx(pCtx)) 520 Log(("HWR%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs , (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));520 Log(("HWR%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs.Sel, (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER)); 521 521 else 522 Log(("HWR%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs , pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));522 Log(("HWR%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pCtx->cs.Sel, pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER)); 523 523 } 524 524 else … … 527 527 Log(("HWV86-CPU%d: %08X IF=%d\n", pVCpu->idCpu, pCtx->eip, pCtx->eflags.Bits.u1IF)); 528 528 else if (CPUMIsGuestIn64BitCodeEx(pCtx)) 529 Log(("HWR%d-CPU%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs , (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));529 Log(("HWR%d-CPU%d: %04X:%RGv ESP=%RGv IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs.Sel, (RTGCPTR)pCtx->rip, pCtx->rsp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER)); 530 530 else 531 Log(("HWR%d-CPU%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs , pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER));531 Log(("HWR%d-CPU%d: %04X:%08X ESP=%08X IF=%d IOPL=%d CR0=%x CR4=%x EFER=%x\n", cpl, pVCpu->idCpu, pCtx->cs.Sel, pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pCtx->eflags.Bits.u2IOPL, (uint32_t)pCtx->cr0, (uint32_t)pCtx->cr4, (uint32_t)pCtx->msrEFER)); 532 532 } 533 533 #endif /* LOG_ENABLED */ -
trunk/src/VBox/VMM/VMMR3/EMRaw.cpp
r41801 r41906 123 123 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 124 124 Assert(pVCpu->em.s.enmState == EMSTATE_DEBUG_HYPER); 125 Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr\n", pCtx->cs , pCtx->eip, pCtx->eflags));125 Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags)); 126 126 127 127 /* … … 131 131 CPUMSetHyperEFlags(pVCpu, CPUMGetHyperEFlags(pVCpu) | X86_EFL_RF); 132 132 rc = VMMR3ResumeHyper(pVM, pVCpu); 133 Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr - returned from GC with rc=%Rrc\n", pCtx->cs , pCtx->eip, pCtx->eflags, rc));133 Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr - returned from GC with rc=%Rrc\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags, rc)); 134 134 rc = CPUMR3RawLeave(pVCpu, NULL, rc); 135 135 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); … … 367 367 368 368 STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, a); 369 Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs , (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp));369 Log(("EMINS: %04x:%RGv RSP=%RGv\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip, (RTGCPTR)pCtx->rsp)); 370 370 #ifdef VBOX_WITH_REM 371 371 EMRemLock(pVM); … … 578 578 */ 579 579 /** @todo move this up before the dispatching? */ 580 if ( (pCtx->ss & X86_SEL_RPL) <= 1580 if ( (pCtx->ss.Sel & X86_SEL_RPL) <= 1 581 581 && !pCtx->eflags.Bits.u1VM) 582 582 { … … 643 643 int rc2 = PGMGstGetPage(pVCpu, uCR2, &fFlags, &GCPhys); 644 644 Log(("emR3RawGuestTrap: cs:eip=%04x:%08x: trap=%02x err=%08x cr2=%08x cr0=%08x%s: Phys=%RGp fFlags=%08llx %s %s %s%s rc2=%d\n", 645 pCtx->cs, pCtx->eip, u8TrapNo, uErrorCode, uCR2, (uint32_t)pCtx->cr0, (enmType == TRPM_SOFTWARE_INT) ? " software" : "", GCPhys, fFlags, 645 pCtx->cs.Sel, pCtx->eip, u8TrapNo, uErrorCode, uCR2, (uint32_t)pCtx->cr0, 646 (enmType == TRPM_SOFTWARE_INT) ? " software" : "", GCPhys, fFlags, 646 647 fFlags & X86_PTE_P ? "P " : "NP", fFlags & X86_PTE_US ? "U" : "S", 647 648 fFlags & X86_PTE_RW ? "RW" : "R0", fFlags & X86_PTE_G ? " G" : "", rc2)); … … 684 685 { 685 686 rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, DISSELREG_CS, CPUMCTX2CORE(pCtx), pCtx->eip), 686 (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0); 687 SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs.Sel, &pCtx->cs) 688 == DISCPUMODE_32BIT ? PATMFL_CODE32 : 0); 687 689 if (RT_SUCCESS(rc)) 688 690 { … … 929 931 return VERR_EM_RAW_PATCH_CONFLICT; 930 932 } 931 if ( (pCtx->ss & X86_SEL_RPL) == 0933 if ( (pCtx->ss.Sel & X86_SEL_RPL) == 0 932 934 && !pCtx->eflags.Bits.u1VM 933 935 && !PATMIsPatchGCAddr(pVM, pCtx->eip)) 934 936 { 935 937 int rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, DISSELREG_CS, CPUMCTX2CORE(pCtx), pCtx->eip), 936 (SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0); 938 ( SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs.Sel, &pCtx->cs) 939 == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0); 937 940 if (RT_SUCCESS(rc)) 938 941 { … … 1039 1042 } 1040 1043 #endif /* VBOX_WITH_STATISTICS */ 1041 if ( (pCtx->ss & X86_SEL_RPL) == 01044 if ( (pCtx->ss.Sel & X86_SEL_RPL) == 0 1042 1045 && !pCtx->eflags.Bits.u1VM 1043 && SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs , &pCtx->csHid) == DISCPUMODE_32BIT)1046 && SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs.Sel, &pCtx->cs) == DISCPUMODE_32BIT) 1044 1047 { 1045 1048 STAM_PROFILE_START(&pVCpu->em.s.StatPrivEmu, a); … … 1339 1342 int rc = VERR_IPE_UNINITIALIZED_STATUS; 1340 1343 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 1341 LogFlow(("emR3RawExecute: (cs:eip=%04x:%08x)\n", pCtx->cs , pCtx->eip));1344 LogFlow(("emR3RawExecute: (cs:eip=%04x:%08x)\n", pCtx->cs.Sel, pCtx->eip)); 1342 1345 pVCpu->em.s.fForceRAW = false; 1343 1346 *pfFFDone = false; … … 1361 1364 Assert(REMR3QueryPendingInterrupt(pVM, pVCpu) == REM_NO_PENDING_IRQ); 1362 1365 # endif 1363 Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss & X86_SEL_RPL) == 3 || (pCtx->ss& X86_SEL_RPL) == 0);1366 Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss.Sel & X86_SEL_RPL) == 3 || (pCtx->ss.Sel & X86_SEL_RPL) == 0); 1364 1367 AssertMsg( (pCtx->eflags.u32 & X86_EFL_IF) 1365 1368 || PATMShouldUseRawMode(pVM, (RTGCPTR)pCtx->eip), … … 1401 1404 * Scan code before executing it. Don't bother with user mode or V86 code 1402 1405 */ 1403 if ( (pCtx->ss & X86_SEL_RPL) <= 11406 if ( (pCtx->ss.Sel & X86_SEL_RPL) <= 1 1404 1407 && !pCtx->eflags.Bits.u1VM 1405 1408 && !PATMIsPatchGCAddr(pVM, pCtx->eip)) … … 1427 1430 PPATMGCSTATE pGCState = PATMR3QueryGCStateHC(pVM); 1428 1431 if (pCtx->eflags.Bits.u1VM) 1429 Log(("RV86: %04X:%08X IF=%d VMFlags=%x\n", pCtx->cs , pCtx->eip, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags));1430 else if ((pCtx->ss & X86_SEL_RPL) == 1)1432 Log(("RV86: %04X:%08X IF=%d VMFlags=%x\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags)); 1433 else if ((pCtx->ss.Sel & X86_SEL_RPL) == 1) 1431 1434 { 1432 1435 bool fCSAMScanned = CSAMIsPageScanned(pVM, (RTGCPTR)pCtx->eip); 1433 Log(("RR0: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d (Scanned=%d)\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss & X86_SEL_RPL), fCSAMScanned));1434 } 1435 else if ((pCtx->ss & X86_SEL_RPL) == 3)1436 Log(("RR0: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d (Scanned=%d)\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss.Sel & X86_SEL_RPL), fCSAMScanned)); 1437 } 1438 else if ((pCtx->ss.Sel & X86_SEL_RPL) == 3) 1436 1439 Log(("RR3: %08X ESP=%08X IF=%d VMFlags=%x\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags)); 1437 1440 #endif /* LOG_ENABLED */ … … 1461 1464 STAM_PROFILE_ADV_START(&pVCpu->em.s.StatRAWTail, d); 1462 1465 1463 LogFlow(("RR0-E: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss & X86_SEL_RPL)));1466 LogFlow(("RR0-E: %08X ESP=%08X IF=%d VMFlags=%x PIF=%d CPL=%d\n", pCtx->eip, pCtx->esp, pCtx->eflags.Bits.u1IF, pGCState->uVMFlags, pGCState->fPIF, (pCtx->ss.Sel & X86_SEL_RPL))); 1464 1467 LogFlow(("VMMR3RawRunGC returned %Rrc\n", rc)); 1465 1468 … … 1542 1545 || VMCPU_FF_ISPENDING(pVCpu, ~VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 1543 1546 { 1544 Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss & X86_SEL_RPL) != 1);1547 Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss.Sel & X86_SEL_RPL) != 1); 1545 1548 1546 1549 STAM_REL_PROFILE_ADV_SUSPEND(&pVCpu->em.s.StatRAWTotal, a); -
trunk/src/VBox/VMM/VMMR3/HWACCM.cpp
r41894 r41906 1517 1517 1518 1518 /* After a real mode switch to protected mode we must force 1519 * CPL to 0. Our real mode emulation had to set it to 3. 1520 */ 1521 pCtx->ssHid.Attr.n.u2Dpl = 0; 1519 CPL to 0. Our real mode emulation had to set it to 3. */ 1520 pCtx->ss.Attr.n.u2Dpl = 0; 1522 1521 } 1523 1522 } … … 2163 2162 { 2164 2163 char szOutput[256]; 2165 rc = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs , GCPtrInstr, DBGF_DISAS_FLAGS_DEFAULT_MODE,2164 rc = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, GCPtrInstr, DBGF_DISAS_FLAGS_DEFAULT_MODE, 2166 2165 szOutput, sizeof(szOutput), &cbCurInstr); 2167 2166 if (RT_SUCCESS(rc)) … … 2305 2304 if (CPUMIsGuestInRealModeEx(pCtx)) 2306 2305 { 2307 /* VT-x will not allow high selector bases in v86 mode; fall back to the recompiler in that case.2308 * The base must also be equal to (sel << 4).2309 */2310 if ( ( pCtx->cs != (pCtx->csHid.u64Base >> 4)2311 && pCtx->cs Hid.u64Base != 0xffff0000 /* we can deal with the BIOS code as it's also mapped into the lower region. */)2312 || (pCtx->cs Hid.u32Limit != 0xffff)2313 || (pCtx->ds Hid.u32Limit != 0xffff)2314 || (pCtx->es Hid.u32Limit != 0xffff)2315 || (pCtx->ss Hid.u32Limit != 0xffff)2316 || (pCtx->fs Hid.u32Limit != 0xffff)2317 || (pCtx->gs Hid.u32Limit != 0xffff)2318 || pCtx->ds != (pCtx->dsHid.u64Base >> 4)2319 || pCtx->es != (pCtx->esHid.u64Base >> 4)2320 || pCtx->fs != (pCtx->fsHid.u64Base >> 4)2321 || pCtx->gs != (pCtx->gsHid.u64Base >> 4)2322 || pCtx->ss != (pCtx->ssHid.u64Base >> 4))2306 /* VT-x will not allow high selector bases in v86 mode; fall 2307 back to the recompiler in that case. 2308 The base must also be equal to (sel << 4). */ 2309 if ( ( pCtx->cs.Sel != (pCtx->cs.u64Base >> 4) 2310 && pCtx->cs.u64Base != 0xffff0000 /* we can deal with the BIOS code as it's also mapped into the lower region. */) 2311 || (pCtx->cs.u32Limit != 0xffff) 2312 || (pCtx->ds.u32Limit != 0xffff) 2313 || (pCtx->es.u32Limit != 0xffff) 2314 || (pCtx->ss.u32Limit != 0xffff) 2315 || (pCtx->fs.u32Limit != 0xffff) 2316 || (pCtx->gs.u32Limit != 0xffff) 2317 || pCtx->ds.Sel != (pCtx->ds.u64Base >> 4) 2318 || pCtx->es.Sel != (pCtx->es.u64Base >> 4) 2319 || pCtx->fs.Sel != (pCtx->fs.u64Base >> 4) 2320 || pCtx->gs.Sel != (pCtx->gs.u64Base >> 4) 2321 || pCtx->ss.Sel != (pCtx->ss.u64Base >> 4)) 2323 2322 { 2324 2323 return false; … … 2328 2327 { 2329 2328 PGMMODE enmGuestMode = PGMGetGuestMode(pVCpu); 2330 /* Verify the requirements for executing code in protected mode. VT-x can't handle the CPU state right after a switch2331 * from real to protected mode. (all sorts of RPL & DPL assumptions)2332 */2329 /* Verify the requirements for executing code in protected 2330 mode. VT-x can't handle the CPU state right after a switch 2331 from real to protected mode. (all sorts of RPL & DPL assumptions) */ 2333 2332 if ( pVCpu->hwaccm.s.vmx.enmLastSeenGuestMode == PGMMODE_REAL 2334 2333 && enmGuestMode >= PGMMODE_PROTECTED) 2335 2334 { 2336 if ( (pCtx->cs & X86_SEL_RPL)2337 || (pCtx->ds & X86_SEL_RPL)2338 || (pCtx->es & X86_SEL_RPL)2339 || (pCtx->fs & X86_SEL_RPL)2340 || (pCtx->gs & X86_SEL_RPL)2341 || (pCtx->ss & X86_SEL_RPL))2335 if ( (pCtx->cs.Sel & X86_SEL_RPL) 2336 || (pCtx->ds.Sel & X86_SEL_RPL) 2337 || (pCtx->es.Sel & X86_SEL_RPL) 2338 || (pCtx->fs.Sel & X86_SEL_RPL) 2339 || (pCtx->gs.Sel & X86_SEL_RPL) 2340 || (pCtx->ss.Sel & X86_SEL_RPL)) 2342 2341 { 2343 2342 return false; … … 2346 2345 /* VT-x also chokes on invalid tr or ldtr selectors (minix) */ 2347 2346 if ( pCtx->gdtr.cbGdt 2348 && ( pCtx->tr > pCtx->gdtr.cbGdt2349 || pCtx->ldtr > pCtx->gdtr.cbGdt))2347 && ( pCtx->tr.Sel > pCtx->gdtr.cbGdt 2348 || pCtx->ldtr.Sel > pCtx->gdtr.cbGdt)) 2350 2349 { 2351 2350 return false; … … 2370 2369 2371 2370 /* Too early for VT-x; Solaris guests will fail with a guru meditation otherwise; same for XP. */ 2372 if (pCtx->idtr.pIdt == 0 || pCtx->idtr.cbIdt == 0 || pCtx->tr == 0)2371 if (pCtx->idtr.pIdt == 0 || pCtx->idtr.cbIdt == 0 || pCtx->tr.Sel == 0) 2373 2372 return false; 2374 2373 … … 2376 2375 /* Windows XP; switch to protected mode; all selectors are marked not present in the 2377 2376 * hidden registers (possible recompiler bug; see load_seg_vm) */ 2378 if (pCtx->cs Hid.Attr.n.u1Present == 0)2377 if (pCtx->cs.Attr.n.u1Present == 0) 2379 2378 return false; 2380 if (pCtx->ss Hid.Attr.n.u1Present == 0)2379 if (pCtx->ss.Attr.n.u1Present == 0) 2381 2380 return false; 2382 2381 … … 2385 2384 /** @todo This check is actually wrong, it doesn't take the direction of the 2386 2385 * stack segment into account. But, it does the job for now. */ 2387 if (pCtx->rsp >= pCtx->ss Hid.u32Limit)2386 if (pCtx->rsp >= pCtx->ss.u32Limit) 2388 2387 return false; 2389 2388 #if 0 2390 if ( pCtx->cs >= pCtx->gdtr.cbGdt2391 || pCtx->ss >= pCtx->gdtr.cbGdt2392 || pCtx->ds >= pCtx->gdtr.cbGdt2393 || pCtx->es >= pCtx->gdtr.cbGdt2394 || pCtx->fs >= pCtx->gdtr.cbGdt2395 || pCtx->gs >= pCtx->gdtr.cbGdt)2389 if ( pCtx->cs.Sel >= pCtx->gdtr.cbGdt 2390 || pCtx->ss.Sel >= pCtx->gdtr.cbGdt 2391 || pCtx->ds.Sel >= pCtx->gdtr.cbGdt 2392 || pCtx->es.Sel >= pCtx->gdtr.cbGdt 2393 || pCtx->fs.Sel >= pCtx->gdtr.cbGdt 2394 || pCtx->gs.Sel >= pCtx->gdtr.cbGdt) 2396 2395 return false; 2397 2396 #endif -
trunk/src/VBox/VMM/VMMR3/PATM.cpp
r41898 r41906 4088 4088 if (pInstrGCFlat != pInstrGC) 4089 4089 { 4090 Log(("PATMR3InstallPatch: code selector not wide open: %04x:%RRv != %RRv eflags=%08x\n", pCtx->cs , pInstrGCFlat, pInstrGC, pCtx->eflags.u32));4090 Log(("PATMR3InstallPatch: code selector not wide open: %04x:%RRv != %RRv eflags=%08x\n", pCtx->cs.Sel, pInstrGCFlat, pInstrGC, pCtx->eflags.u32)); 4091 4091 return VERR_PATCHING_REFUSED; 4092 4092 } … … 6105 6105 #ifdef DEBUG 6106 6106 char szBuf[256]; 6107 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs , pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,6107 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE, 6108 6108 szBuf, sizeof(szBuf), NULL); 6109 6109 Log(("DIRTY: %s\n", szBuf)); … … 6168 6168 #ifdef DEBUG 6169 6169 char szBuf[256]; 6170 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs , pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,6170 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE, 6171 6171 szBuf, sizeof(szBuf), NULL); 6172 6172 Log(("NEW: %s\n", szBuf)); … … 6184 6184 #ifdef DEBUG 6185 6185 char szBuf[256]; 6186 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs , pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,6186 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE, 6187 6187 szBuf, sizeof(szBuf), NULL); 6188 6188 Log(("NEW: %s (FAILED)\n", szBuf)); … … 6221 6221 #ifdef DEBUG 6222 6222 char szBuf[256]; 6223 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs , pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE,6223 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurPatchInstrGC, DBGF_DISAS_FLAGS_DEFAULT_MODE, 6224 6224 szBuf, sizeof(szBuf), NULL); 6225 6225 Log(("FILL: %s\n", szBuf)); … … 6233 6233 #ifdef DEBUG 6234 6234 char szBuf[256]; 6235 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs , pCurPatchInstrGC + i,6235 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pCurPatchInstrGC + i, 6236 6236 DBGF_DISAS_FLAGS_DEFAULT_MODE, szBuf, sizeof(szBuf), NULL); 6237 6237 Log(("FILL: %s\n", szBuf)); … … 6425 6425 6426 6426 char szBuf[256]; 6427 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs , pEip, DBGF_DISAS_FLAGS_DEFAULT_MODE, szBuf, sizeof(szBuf), NULL);6427 DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs.Sel, pEip, DBGF_DISAS_FLAGS_DEFAULT_MODE, szBuf, sizeof(szBuf), NULL); 6428 6428 6429 6429 /* Very bad. We crashed in emitted code. Probably stack? */ … … 6542 6542 6543 6543 Log2(("pPatchBlockGC %RRv - pEip %RRv corresponding GC address %RRv\n", PATCHCODE_PTR_GC(&pPatch->patch), pEip, pNewEip)); 6544 DBGFR3DisasInstrLog(pVCpu, pCtx->cs , pNewEip, "PATCHRET: ");6544 DBGFR3DisasInstrLog(pVCpu, pCtx->cs.Sel, pNewEip, "PATCHRET: "); 6545 6545 if (pNewEip >= pPatch->patch.pPrivInstrGC && pNewEip < pPatch->patch.pPrivInstrGC + pPatch->patch.cbPatchJump) 6546 6546 { -
trunk/src/VBox/VMM/VMMR3/VMM.cpp
r41803 r41906 1330 1330 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 1331 1331 1332 pCtx->cs = uVector << 8; 1333 pCtx->csHid.u64Base = uVector << 12; 1334 pCtx->csHid.u32Limit = 0x0000ffff; 1335 pCtx->rip = 0; 1332 pCtx->cs.Sel = uVector << 8; 1333 pCtx->cs.ValidSel = uVector << 8; 1334 pCtx->cs.fFlags = CPUMSELREG_FLAGS_VALID; 1335 pCtx->cs.u64Base = uVector << 12; 1336 pCtx->cs.u32Limit = UINT32_C(0x0000ffff); 1337 pCtx->rip = 0; 1336 1338 1337 1339 Log(("vmmR3SendSipi for VCPU %d with vector %x\n", uVector)); -
trunk/src/VBox/VMM/VMMR3/VMMTests.cpp
r41783 r41906 448 448 449 449 #define SYNC_SEL(pHyperCtx, reg) \ 450 if (pHyperCtx->reg )\450 if (pHyperCtx->reg.Sel) \ 451 451 { \ 452 452 DBGFSELINFO selInfo; \ 453 int rc2 = SELMR3GetShadowSelectorInfo(pVM, pHyperCtx->reg , &selInfo);\453 int rc2 = SELMR3GetShadowSelectorInfo(pVM, pHyperCtx->reg.Sel, &selInfo); \ 454 454 AssertRC(rc2); \ 455 455 \ 456 pHyperCtx->reg ##Hid.u64Base = selInfo.GCPtrBase;\457 pHyperCtx->reg ##Hid.u32Limit = selInfo.cbLimit;\458 pHyperCtx->reg ##Hid.Attr.n.u1Present = selInfo.u.Raw.Gen.u1Present;\459 pHyperCtx->reg ##Hid.Attr.n.u1DefBig = selInfo.u.Raw.Gen.u1DefBig;\460 pHyperCtx->reg ##Hid.Attr.n.u1Granularity = selInfo.u.Raw.Gen.u1Granularity;\461 pHyperCtx->reg ##Hid.Attr.n.u4Type = selInfo.u.Raw.Gen.u4Type;\462 pHyperCtx->reg ##Hid.Attr.n.u2Dpl = selInfo.u.Raw.Gen.u2Dpl;\463 pHyperCtx->reg ##Hid.Attr.n.u1DescType = selInfo.u.Raw.Gen.u1DescType;\464 pHyperCtx->reg ##Hid.Attr.n.u1Long = selInfo.u.Raw.Gen.u1Long;\456 pHyperCtx->reg.u64Base = selInfo.GCPtrBase; \ 457 pHyperCtx->reg.u32Limit = selInfo.cbLimit; \ 458 pHyperCtx->reg.Attr.n.u1Present = selInfo.u.Raw.Gen.u1Present; \ 459 pHyperCtx->reg.Attr.n.u1DefBig = selInfo.u.Raw.Gen.u1DefBig; \ 460 pHyperCtx->reg.Attr.n.u1Granularity = selInfo.u.Raw.Gen.u1Granularity; \ 461 pHyperCtx->reg.Attr.n.u4Type = selInfo.u.Raw.Gen.u4Type; \ 462 pHyperCtx->reg.Attr.n.u2Dpl = selInfo.u.Raw.Gen.u2Dpl; \ 463 pHyperCtx->reg.Attr.n.u1DescType = selInfo.u.Raw.Gen.u1DescType; \ 464 pHyperCtx->reg.Attr.n.u1Long = selInfo.u.Raw.Gen.u1Long; \ 465 465 } 466 466 -
trunk/src/VBox/VMM/VMMRC/CPUMRC.cpp
r41783 r41906 95 95 96 96 pGstCtxCore->eip = *pEsp++; 97 pGstCtxCore->cs 97 pGstCtxCore->cs.Sel = (RTSEL)*pEsp++; 98 98 pGstCtxCore->eflags.u32 = *pEsp++; 99 99 pGstCtxCore->esp = *pEsp++; 100 pGstCtxCore->ss 100 pGstCtxCore->ss.Sel = (RTSEL)*pEsp++; 101 101 if (pGstCtxCore->eflags.Bits.u1VM) 102 102 { 103 pGstCtxCore->es 104 pGstCtxCore->ds 105 pGstCtxCore->fs 106 pGstCtxCore->gs 103 pGstCtxCore->es.Sel = (RTSEL)*pEsp++; 104 pGstCtxCore->ds.Sel = (RTSEL)*pEsp++; 105 pGstCtxCore->fs.Sel = (RTSEL)*pEsp++; 106 pGstCtxCore->gs.Sel = (RTSEL)*pEsp++; 107 107 } 108 108 -
trunk/src/VBox/VMM/VMMRC/CPUMRCA.asm
r37955 r41906 74 74 mov ecx, [edx + CPUMCPU.Guest.eip] 75 75 mov [eax + 0h], ecx 76 mov ecx, [edx + CPUMCPU.Guest.cs ]76 mov ecx, [edx + CPUMCPU.Guest.cs.Sel] 77 77 mov [eax + 4h], ecx 78 78 mov ecx, [edx + CPUMCPU.Guest.eflags] … … 80 80 mov ecx, [edx + CPUMCPU.Guest.esp] 81 81 mov [eax + 0ch], ecx 82 mov ecx, [edx + CPUMCPU.Guest.ss ]82 mov ecx, [edx + CPUMCPU.Guest.ss.Sel] 83 83 mov [eax + 10h], ecx 84 84 … … 91 91 ; todo: potential trouble loading invalid es,fs,gs,ds because 92 92 ; of a VMM imposed exception? 93 mov es, [edx + CPUMCPU.Guest.es ]94 mov fs, [edx + CPUMCPU.Guest.fs ]95 mov gs, [edx + CPUMCPU.Guest.gs ]93 mov es, [edx + CPUMCPU.Guest.es.Sel] 94 mov fs, [edx + CPUMCPU.Guest.fs.Sel] 95 mov gs, [edx + CPUMCPU.Guest.gs.Sel] 96 96 mov esi, [edx + CPUMCPU.Guest.esi] 97 97 mov edi, [edx + CPUMCPU.Guest.edi] … … 100 100 mov ecx, [edx + CPUMCPU.Guest.ecx] 101 101 mov eax, [edx + CPUMCPU.Guest.eax] 102 push dword [edx + CPUMCPU.Guest.ds ]102 push dword [edx + CPUMCPU.Guest.ds.Sel] 103 103 mov edx, [edx + CPUMCPU.Guest.edx] 104 104 pop ds … … 108 108 CPUMGCRestoreInt_V86: 109 109 ; iret restores ds, es, fs & gs 110 mov ecx, [edx + CPUMCPU.Guest.es ]110 mov ecx, [edx + CPUMCPU.Guest.es.Sel] 111 111 mov [eax + 14h], ecx 112 mov ecx, [edx + CPUMCPU.Guest.ds ]112 mov ecx, [edx + CPUMCPU.Guest.ds.Sel] 113 113 mov [eax + 18h], ecx 114 mov ecx, [edx + CPUMCPU.Guest.fs ]114 mov ecx, [edx + CPUMCPU.Guest.fs.Sel] 115 115 mov [eax + 1Ch], ecx 116 mov ecx, [edx + CPUMCPU.Guest.gs ]116 mov ecx, [edx + CPUMCPU.Guest.gs.Sel] 117 117 mov [eax + 20h], ecx 118 118 mov esi, [edx + CPUMCPU.Guest.esi] … … 172 172 ;; @todo load segment registers *before* enabling WP. 173 173 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_GS | CPUM_HANDLER_CTXCORE_IN_EBP 174 mov gs, [ebp + CPUMCTXCORE.gs ]174 mov gs, [ebp + CPUMCTXCORE.gs.Sel] 175 175 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_FS | CPUM_HANDLER_CTXCORE_IN_EBP 176 mov fs, [ebp + CPUMCTXCORE.fs ]176 mov fs, [ebp + CPUMCTXCORE.fs.Sel] 177 177 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_ES | CPUM_HANDLER_CTXCORE_IN_EBP 178 mov es, [ebp + CPUMCTXCORE.es ]178 mov es, [ebp + CPUMCTXCORE.es.Sel] 179 179 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_DS | CPUM_HANDLER_CTXCORE_IN_EBP 180 mov ds, [ebp + CPUMCTXCORE.ds ]180 mov ds, [ebp + CPUMCTXCORE.ds.Sel] 181 181 182 182 mov eax, [ebp + CPUMCTXCORE.eax] … … 202 202 203 203 ; construct iret stack frame 204 push dword [ebp + CPUMCTXCORE.gs ]205 push dword [ebp + CPUMCTXCORE.fs ]206 push dword [ebp + CPUMCTXCORE.ds ]207 push dword [ebp + CPUMCTXCORE.es ]208 push dword [ebp + CPUMCTXCORE.ss ]204 push dword [ebp + CPUMCTXCORE.gs.Sel] 205 push dword [ebp + CPUMCTXCORE.fs.Sel] 206 push dword [ebp + CPUMCTXCORE.ds.Sel] 207 push dword [ebp + CPUMCTXCORE.es.Sel] 208 push dword [ebp + CPUMCTXCORE.ss.Sel] 209 209 push dword [ebp + CPUMCTXCORE.esp] 210 210 push dword [ebp + CPUMCTXCORE.eflags] 211 push dword [ebp + CPUMCTXCORE.cs ]211 push dword [ebp + CPUMCTXCORE.cs.Sel] 212 212 push dword [ebp + CPUMCTXCORE.eip] 213 213 … … 253 253 ; Setup iretd 254 254 ; 255 push dword [edx + CPUMCPU.Guest.ss ]255 push dword [edx + CPUMCPU.Guest.ss.Sel] 256 256 push dword [edx + CPUMCPU.Guest.esp] 257 257 push dword [edx + CPUMCPU.Guest.eflags] 258 push dword [edx + CPUMCPU.Guest.cs ]258 push dword [edx + CPUMCPU.Guest.cs.Sel] 259 259 push dword [edx + CPUMCPU.Guest.eip] 260 260 … … 263 263 ; 264 264 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_ES 265 mov es, [edx + CPUMCPU.Guest.es ]265 mov es, [edx + CPUMCPU.Guest.es.Sel] 266 266 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_FS 267 mov fs, [edx + CPUMCPU.Guest.fs ]267 mov fs, [edx + CPUMCPU.Guest.fs.Sel] 268 268 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_GS 269 mov gs, [edx + CPUMCPU.Guest.gs ]269 mov gs, [edx + CPUMCPU.Guest.gs.Sel] 270 270 271 271 %ifdef VBOX_WITH_STATISTICS … … 302 302 mov ecx, [edx + CPUMCPU.Guest.ecx] 303 303 mov eax, [edx + CPUMCPU.Guest.eax] 304 push dword [edx + CPUMCPU.Guest.ds ]304 push dword [edx + CPUMCPU.Guest.ds.Sel] 305 305 mov edx, [edx + CPUMCPU.Guest.edx] 306 306 TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_DS … … 331 331 ; Setup iretd 332 332 ; 333 push dword [edx + CPUMCPU.Guest.gs ]334 push dword [edx + CPUMCPU.Guest.fs ]335 push dword [edx + CPUMCPU.Guest.ds ]336 push dword [edx + CPUMCPU.Guest.es ]337 338 push dword [edx + CPUMCPU.Guest.ss ]333 push dword [edx + CPUMCPU.Guest.gs.Sel] 334 push dword [edx + CPUMCPU.Guest.fs.Sel] 335 push dword [edx + CPUMCPU.Guest.ds.Sel] 336 push dword [edx + CPUMCPU.Guest.es.Sel] 337 338 push dword [edx + CPUMCPU.Guest.ss.Sel] 339 339 push dword [edx + CPUMCPU.Guest.esp] 340 340 341 341 push dword [edx + CPUMCPU.Guest.eflags] 342 push dword [edx + CPUMCPU.Guest.cs ]342 push dword [edx + CPUMCPU.Guest.cs.Sel] 343 343 push dword [edx + CPUMCPU.Guest.eip] 344 344 -
trunk/src/VBox/VMM/VMMRC/CSAMRC.cpp
r41800 r41906 102 102 cpl = 3; 103 103 else 104 cpl = (pRegFrame->ss & X86_SEL_RPL);104 cpl = (pRegFrame->ss.Sel & X86_SEL_RPL); 105 105 106 106 Log(("CSAMGCCodePageWriteHandler: code page write at %RGv original address %RGv (cpl=%d)\n", pvFault, (RTGCUINTPTR)pvRange + offRange, cpl)); -
trunk/src/VBox/VMM/VMMRC/PATMRC.cpp
r41897 r41906 155 155 156 156 /* Very important check -> otherwise we have a security leak. */ 157 AssertReturn(!pRegFrame->eflags.Bits.u1VM && (pRegFrame->ss & X86_SEL_RPL) == 1, VERR_ACCESS_DENIED);157 AssertReturn(!pRegFrame->eflags.Bits.u1VM && (pRegFrame->ss.Sel & X86_SEL_RPL) == 1, VERR_ACCESS_DENIED); 158 158 Assert(PATMIsPatchGCAddr(pVM, pRegFrame->eip)); 159 159 … … 455 455 int rc; 456 456 457 AssertReturn(!pRegFrame->eflags.Bits.u1VM && (pRegFrame->ss & X86_SEL_RPL) == 1, VERR_ACCESS_DENIED);457 AssertReturn(!pRegFrame->eflags.Bits.u1VM && (pRegFrame->ss.Sel & X86_SEL_RPL) == 1, VERR_ACCESS_DENIED); 458 458 459 459 /* Int 3 in PATM generated code? (most common case) */ … … 510 510 } 511 511 512 DISCPUMODE enmCpuMode = SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pRegFrame->eflags, pRegFrame->cs , 0);512 DISCPUMODE enmCpuMode = SELMGetCpuModeFromSelector(VMMGetCpu0(pVM), pRegFrame->eflags, pRegFrame->cs.Sel, 0); 513 513 if (enmCpuMode != DISCPUMODE_32BIT) 514 514 { -
trunk/src/VBox/VMM/VMMRC/SELMRC.cpp
r41803 r41906 140 140 141 141 #ifdef LOG_ENABLED 142 if (Sel == (pRegFrame->cs & X86_SEL_MASK))143 Log(("GDT write to selector in CS register %04X\n", pRegFrame->cs ));144 else if (Sel == (pRegFrame->ds & X86_SEL_MASK))145 Log(("GDT write to selector in DS register %04X\n", pRegFrame->ds ));146 else if (Sel == (pRegFrame->es & X86_SEL_MASK))147 Log(("GDT write to selector in ES register %04X\n", pRegFrame->es ));148 else if (Sel == (pRegFrame->fs & X86_SEL_MASK))149 Log(("GDT write to selector in FS register %04X\n", pRegFrame->fs ));150 else if (Sel == (pRegFrame->gs & X86_SEL_MASK))151 Log(("GDT write to selector in GS register %04X\n", pRegFrame->gs ));152 else if (Sel == (pRegFrame->ss & X86_SEL_MASK))153 Log(("GDT write to selector in SS register %04X\n", pRegFrame->ss ));142 if (Sel == (pRegFrame->cs.Sel & X86_SEL_MASK)) 143 Log(("GDT write to selector in CS register %04X\n", pRegFrame->cs.Sel)); 144 else if (Sel == (pRegFrame->ds.Sel & X86_SEL_MASK)) 145 Log(("GDT write to selector in DS register %04X\n", pRegFrame->ds.Sel)); 146 else if (Sel == (pRegFrame->es.Sel & X86_SEL_MASK)) 147 Log(("GDT write to selector in ES register %04X\n", pRegFrame->es.Sel)); 148 else if (Sel == (pRegFrame->fs.Sel & X86_SEL_MASK)) 149 Log(("GDT write to selector in FS register %04X\n", pRegFrame->fs.Sel)); 150 else if (Sel == (pRegFrame->gs.Sel & X86_SEL_MASK)) 151 Log(("GDT write to selector in GS register %04X\n", pRegFrame->gs.Sel)); 152 else if (Sel == (pRegFrame->ss.Sel & X86_SEL_MASK)) 153 Log(("GDT write to selector in SS register %04X\n", pRegFrame->ss.Sel)); 154 154 #endif 155 155 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp
r41823 r41906 257 257 AssertMsg( rc != VINF_SUCCESS 258 258 || ( pRegFrame->eflags.Bits.u1IF 259 && ( pRegFrame->eflags.Bits.u2IOPL < (unsigned)(pRegFrame->ss & X86_SEL_RPL) || pRegFrame->eflags.Bits.u1VM))260 , ("rc=%Rrc\neflags=%RX32 ss=%RTsel IOPL=%d\n", rc, pRegFrame->eflags.u32, pRegFrame->ss , pRegFrame->eflags.Bits.u2IOPL));259 && ( pRegFrame->eflags.Bits.u2IOPL < (unsigned)(pRegFrame->ss.Sel & X86_SEL_RPL) || pRegFrame->eflags.Bits.u1VM)) 260 , ("rc=%Rrc\neflags=%RX32 ss=%RTsel IOPL=%d\n", rc, pRegFrame->eflags.u32, pRegFrame->ss.Sel, pRegFrame->eflags.Bits.u2IOPL)); 261 261 PGMRZDynMapReleaseAutoSet(pVCpu); 262 262 return rc; … … 281 281 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); 282 282 283 LogFlow(("TRPMGC01: cs:eip=%04x:%08x uDr6=%RTreg\n", pRegFrame->cs , pRegFrame->eip, uDr6));283 LogFlow(("TRPMGC01: cs:eip=%04x:%08x uDr6=%RTreg\n", pRegFrame->cs.Sel, pRegFrame->eip, uDr6)); 284 284 285 285 /* … … 302 302 303 303 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); 304 Log6(("TRPMGC01: %Rrc (%04x:%08x %RTreg)\n", rc, pRegFrame->cs , pRegFrame->eip, uDr6));304 Log6(("TRPMGC01: %Rrc (%04x:%08x %RTreg)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip, uDr6)); 305 305 return rc; 306 306 } … … 328 328 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); 329 329 330 LogFlow(("TRPMGCHyper01: cs:eip=%04x:%08x uDr6=%RTreg\n", pRegFrame->cs , pRegFrame->eip, uDr6));330 LogFlow(("TRPMGCHyper01: cs:eip=%04x:%08x uDr6=%RTreg\n", pRegFrame->cs.Sel, pRegFrame->eip, uDr6)); 331 331 332 332 /* … … 346 346 AssertStmt(rc != VINF_EM_RAW_GUEST_TRAP, rc = VERR_TRPM_IPE_1); 347 347 348 Log6(("TRPMGCHyper01: %Rrc (%04x:%08x %RTreg)\n", rc, pRegFrame->cs , pRegFrame->eip, uDr6));348 Log6(("TRPMGCHyper01: %Rrc (%04x:%08x %RTreg)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip, uDr6)); 349 349 return rc; 350 350 } … … 365 365 DECLASM(int) TRPMGCTrap02Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 366 366 { 367 LogFlow(("TRPMGCTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs , pRegFrame->eip));368 RTLogComPrintf("TRPMGCTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs , pRegFrame->eip);367 LogFlow(("TRPMGCTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip)); 368 RTLogComPrintf("TRPMGCTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip); 369 369 NOREF(pTrpmCpu); 370 370 return VERR_TRPM_DONT_PANIC; … … 389 389 DECLASM(int) TRPMGCHyperTrap02Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 390 390 { 391 LogFlow(("TRPMGCHyperTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs , pRegFrame->eip));392 RTLogComPrintf("TRPMGCHyperTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs , pRegFrame->eip);391 LogFlow(("TRPMGCHyperTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip)); 392 RTLogComPrintf("TRPMGCHyperTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip); 393 393 NOREF(pTrpmCpu); 394 394 return VERR_TRPM_DONT_PANIC; … … 409 409 DECLASM(int) TRPMGCTrap03Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 410 410 { 411 LogFlow(("TRPMGC03: %04x:%08x\n", pRegFrame->cs , pRegFrame->eip));411 LogFlow(("TRPMGC03: %04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip)); 412 412 PVM pVM = TRPMCPU_2_VM(pTrpmCpu); 413 413 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); … … 418 418 * PATM is using INT3s, let them have a go first. 419 419 */ 420 if ( (pRegFrame->ss & X86_SEL_RPL) == 1420 if ( (pRegFrame->ss.Sel & X86_SEL_RPL) == 1 421 421 && !pRegFrame->eflags.Bits.u1VM) 422 422 { … … 428 428 { 429 429 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); 430 Log6(("TRPMGC03: %Rrc (%04x:%08x) (PATM)\n", rc, pRegFrame->cs , pRegFrame->eip));430 Log6(("TRPMGC03: %Rrc (%04x:%08x) (PATM)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 431 431 return rc; 432 432 } … … 436 436 /* anything we should do with this? Schedule it in GC? */ 437 437 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); 438 Log6(("TRPMGC03: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs , pRegFrame->eip));438 Log6(("TRPMGC03: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 439 439 return rc; 440 440 } … … 457 457 DECLASM(int) TRPMGCHyperTrap03Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 458 458 { 459 LogFlow(("TRPMGCHyper03: %04x:%08x\n", pRegFrame->cs , pRegFrame->eip));459 LogFlow(("TRPMGCHyper03: %04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip)); 460 460 PVM pVM = TRPMCPU_2_VM(pTrpmCpu); 461 461 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); … … 467 467 AssertStmt(rc != VINF_EM_RAW_GUEST_TRAP, rc = VERR_TRPM_IPE_2); 468 468 469 Log6(("TRPMGCHyper03: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs , pRegFrame->eip));469 Log6(("TRPMGCHyper03: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 470 470 return rc; 471 471 } … … 485 485 DECLASM(int) TRPMGCTrap06Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 486 486 { 487 LogFlow(("TRPMGC06: %04x:%08x efl=%x\n", pRegFrame->cs , pRegFrame->eip, pRegFrame->eflags.u32));487 LogFlow(("TRPMGC06: %04x:%08x efl=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, pRegFrame->eflags.u32)); 488 488 PVM pVM = TRPMCPU_2_VM(pTrpmCpu); 489 489 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); … … 497 497 */ 498 498 RTGCPTR PC; 499 rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss , pRegFrame->cs, &pRegFrame->csHid,499 rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss.Sel, pRegFrame->cs.Sel, &pRegFrame->cs, 500 500 pRegFrame->rip, &PC); 501 501 if (RT_FAILURE(rc)) 502 502 { 503 Log(("TRPMGCTrap06Handler: Failed to convert %RTsel:%RX32 (cpl=%d) - rc=%Rrc !!\n", pRegFrame->cs , pRegFrame->eip, pRegFrame->ss& X86_SEL_RPL, rc));503 Log(("TRPMGCTrap06Handler: Failed to convert %RTsel:%RX32 (cpl=%d) - rc=%Rrc !!\n", pRegFrame->cs.Sel, pRegFrame->eip, pRegFrame->ss.Sel & X86_SEL_RPL, rc)); 504 504 rc = trpmGCExitTrap(pVM, pVCpu, VINF_EM_RAW_GUEST_TRAP, pRegFrame); 505 Log6(("TRPMGC06: %Rrc (%04x:%08x) (SELM)\n", rc, pRegFrame->cs , pRegFrame->eip));505 Log6(("TRPMGC06: %Rrc (%04x:%08x) (SELM)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 506 506 return rc; 507 507 } … … 513 513 { 514 514 rc = trpmGCExitTrap(pVM, pVCpu, VINF_EM_RAW_EMULATE_INSTR, pRegFrame); 515 Log6(("TRPMGC06: %Rrc (%04x:%08x) (EM)\n", rc, pRegFrame->cs , pRegFrame->eip));515 Log6(("TRPMGC06: %Rrc (%04x:%08x) (EM)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 516 516 return rc; 517 517 } … … 535 535 { 536 536 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); 537 Log6(("TRPMGC06: %Rrc (%04x:%08x) (PATM)\n", rc, pRegFrame->cs , pRegFrame->eip));537 Log6(("TRPMGC06: %Rrc (%04x:%08x) (PATM)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 538 538 return rc; 539 539 } … … 576 576 577 577 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); 578 Log6(("TRPMGC06: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs , pRegFrame->eip));578 Log6(("TRPMGC06: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 579 579 return rc; 580 580 } … … 596 596 DECLASM(int) TRPMGCTrap07Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 597 597 { 598 LogFlow(("TRPMGC07: %04x:%08x\n", pRegFrame->cs , pRegFrame->eip));598 LogFlow(("TRPMGC07: %04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip)); 599 599 PVM pVM = TRPMCPU_2_VM(pTrpmCpu); 600 600 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); … … 603 603 int rc = CPUMHandleLazyFPU(pVCpu); 604 604 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); 605 Log6(("TRPMGC07: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs , pRegFrame->eip));605 Log6(("TRPMGC07: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 606 606 return rc; 607 607 } … … 621 621 DECLASM(int) TRPMGCTrap0bHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 622 622 { 623 LogFlow(("TRPMGC0b: %04x:%08x\n", pRegFrame->cs , pRegFrame->eip));623 LogFlow(("TRPMGC0b: %04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip)); 624 624 PVM pVM = TRPMCPU_2_VM(pTrpmCpu); 625 625 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); … … 632 632 */ 633 633 RTGCPTR GCPtr; 634 if ( SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss , pRegFrame->cs, &pRegFrame->csHid,634 if ( SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss.Sel, pRegFrame->cs.Sel, &pRegFrame->cs, 635 635 (RTGCPTR)pRegFrame->eip, &GCPtr) 636 636 == VINF_SUCCESS) … … 697 697 */ 698 698 pTrpmCpu->uActiveVector = UINT32_MAX; 699 Log6(("TRPMGC0b: %Rrc (%04x:%08x) (CG)\n", VINF_EM_RAW_RING_SWITCH, pRegFrame->cs , pRegFrame->eip));699 Log6(("TRPMGC0b: %Rrc (%04x:%08x) (CG)\n", VINF_EM_RAW_RING_SWITCH, pRegFrame->cs.Sel, pRegFrame->eip)); 700 700 PGMRZDynMapReleaseAutoSet(pVCpu); 701 701 return VINF_EM_RAW_RING_SWITCH; … … 706 706 * Pass trap 0b as is to the recompiler in all other cases. 707 707 */ 708 Log6(("TRPMGC0b: %Rrc (%04x:%08x)\n", VINF_EM_RAW_GUEST_TRAP, pRegFrame->cs , pRegFrame->eip));708 Log6(("TRPMGC0b: %Rrc (%04x:%08x)\n", VINF_EM_RAW_GUEST_TRAP, pRegFrame->cs.Sel, pRegFrame->eip)); 709 709 PGMRZDynMapReleaseAutoSet(pVCpu); 710 710 return VINF_EM_RAW_GUEST_TRAP; … … 890 890 { 891 891 uint32_t efl = CPUMRawGetEFlags(pVCpu, pRegFrame); 892 if (X86_EFL_GET_IOPL(efl) >= (unsigned)(pRegFrame->ss & X86_SEL_RPL))892 if (X86_EFL_GET_IOPL(efl) >= (unsigned)(pRegFrame->ss.Sel & X86_SEL_RPL)) 893 893 { 894 894 LogFlow(("trpmGCTrap0dHandlerRing3: CLI/STI -> REM\n")); … … 945 945 static int trpmGCTrap0dHandler(PVM pVM, PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 946 946 { 947 LogFlow(("trpmGCTrap0dHandler: cs:eip=%RTsel:%08RX32 uErr=%RGv\n", pRegFrame-> ss, pRegFrame->eip, pTrpmCpu->uActiveErrorCode));947 LogFlow(("trpmGCTrap0dHandler: cs:eip=%RTsel:%08RX32 uErr=%RGv\n", pRegFrame->cs.Sel, pRegFrame->eip, pTrpmCpu->uActiveErrorCode)); 948 948 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); 949 949 … … 954 954 RTGCPTR PC; 955 955 uint32_t cBits; 956 int rc = SELMValidateAndConvertCSAddrGCTrap(pVCpu, pRegFrame->eflags, pRegFrame->ss , pRegFrame->cs,956 int rc = SELMValidateAndConvertCSAddrGCTrap(pVCpu, pRegFrame->eflags, pRegFrame->ss.Sel, pRegFrame->cs.Sel, 957 957 pRegFrame->rip, &PC, &cBits); 958 958 if (RT_FAILURE(rc)) 959 959 { 960 960 Log(("trpmGCTrap0dHandler: Failed to convert %RTsel:%RX32 (cpl=%d) - rc=%Rrc !!\n", 961 pRegFrame->cs , pRegFrame->eip, pRegFrame->ss& X86_SEL_RPL, rc));961 pRegFrame->cs.Sel, pRegFrame->eip, pRegFrame->ss.Sel & X86_SEL_RPL, rc)); 962 962 STAM_PROFILE_STOP(&pVM->trpm.s.StatTrap0dDisasm, a); 963 963 return trpmGCExitTrap(pVM, pVCpu, VINF_EM_RAW_EMULATE_INSTR, pRegFrame); … … 1004 1004 * Deal with Ring-0 (privileged instructions) 1005 1005 */ 1006 if ( (pRegFrame->ss & X86_SEL_RPL) <= 11006 if ( (pRegFrame->ss.Sel & X86_SEL_RPL) <= 1 1007 1007 && !pRegFrame->eflags.Bits.u1VM) 1008 1008 return trpmGCTrap0dHandlerRing0(pVM, pVCpu, pRegFrame, &Cpu, PC); … … 1024 1024 X86EFLAGS eflags; 1025 1025 eflags.u32 = CPUMRawGetEFlags(pVCpu, pRegFrame); /* Get the correct value. */ 1026 Log3(("TRPM #GP V86: cs:eip=%04x:%08x IOPL=%d efl=%08x\n", pRegFrame->cs , pRegFrame->eip, eflags.Bits.u2IOPL, eflags.u));1026 Log3(("TRPM #GP V86: cs:eip=%04x:%08x IOPL=%d efl=%08x\n", pRegFrame->cs.Sel, pRegFrame->eip, eflags.Bits.u2IOPL, eflags.u)); 1027 1027 if (eflags.Bits.u2IOPL != 3) 1028 1028 { … … 1053 1053 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); 1054 1054 1055 LogFlow(("TRPMGC0d: %04x:%08x err=%x\n", pRegFrame->cs , pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode));1055 LogFlow(("TRPMGC0d: %04x:%08x err=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode)); 1056 1056 1057 1057 PGMRZDynMapStartAutoSet(pVCpu); … … 1088 1088 break; 1089 1089 } 1090 Log6(("TRPMGC0d: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs , pRegFrame->eip));1090 Log6(("TRPMGC0d: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 1091 1091 return rc; 1092 1092 } … … 1112 1112 PVMCPU pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu); 1113 1113 1114 LogFlow(("TRPMGC0e: %04x:%08x err=%x cr2=%08x\n", pRegFrame->cs , pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode, (uint32_t)pVCpu->trpm.s.uActiveCR2));1114 LogFlow(("TRPMGC0e: %04x:%08x err=%x cr2=%08x\n", pRegFrame->cs.Sel, pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode, (uint32_t)pVCpu->trpm.s.uActiveCR2)); 1115 1115 1116 1116 /* … … 1164 1164 } 1165 1165 rc = trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame); 1166 Log6(("TRPMGC0e: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs , pRegFrame->eip));1166 Log6(("TRPMGC0e: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs.Sel, pRegFrame->eip)); 1167 1167 return rc; 1168 1168 } … … 1303 1303 { 1304 1304 case TRPM_TRAP_IN_MOV_GS: 1305 pRegFrame->eax = 0;1306 pRegFrame->gs = 0; /* prevent recursive trouble. */1305 pRegFrame->eax = 0; 1306 pRegFrame->gs.Sel = 0; /* prevent recursive trouble. */ 1307 1307 break; 1308 1308 case TRPM_TRAP_IN_MOV_FS: 1309 pRegFrame->eax = 0;1310 pRegFrame->fs = 0; /* prevent recursive trouble. */1309 pRegFrame->eax = 0; 1310 pRegFrame->fs.Sel = 0; /* prevent recursive trouble. */ 1311 1311 return VINF_SUCCESS; 1312 1312 … … 1349 1349 */ 1350 1350 case TRPM_TRAP_IN_IRET: 1351 CtxCore.eip = *pEsp++;1352 CtxCore.cs = (RTSEL)*pEsp++;1351 CtxCore.eip = *pEsp++; 1352 CtxCore.cs.Sel = (RTSEL)*pEsp++; 1353 1353 CtxCore.eflags.u32 = *pEsp++; 1354 CtxCore.esp = *pEsp++;1355 CtxCore.ss = (RTSEL)*pEsp++;1354 CtxCore.esp = *pEsp++; 1355 CtxCore.ss.Sel = (RTSEL)*pEsp++; 1356 1356 rc = VINF_EM_RAW_IRET_TRAP; 1357 1357 break; … … 1361 1361 */ 1362 1362 case TRPM_TRAP_IN_IRET | TRPM_TRAP_IN_V86: 1363 CtxCore.eip = *pEsp++;1364 CtxCore.cs = (RTSEL)*pEsp++;1363 CtxCore.eip = *pEsp++; 1364 CtxCore.cs.Sel = (RTSEL)*pEsp++; 1365 1365 CtxCore.eflags.u32 = *pEsp++; 1366 CtxCore.esp = *pEsp++;1367 CtxCore.ss = (RTSEL)*pEsp++;1368 CtxCore.es = (RTSEL)*pEsp++;1369 CtxCore.ds = (RTSEL)*pEsp++;1370 CtxCore.fs = (RTSEL)*pEsp++;1371 CtxCore.gs = (RTSEL)*pEsp++;1366 CtxCore.esp = *pEsp++; 1367 CtxCore.ss.Sel = (RTSEL)*pEsp++; 1368 CtxCore.es.Sel = (RTSEL)*pEsp++; 1369 CtxCore.ds.Sel = (RTSEL)*pEsp++; 1370 CtxCore.fs.Sel = (RTSEL)*pEsp++; 1371 CtxCore.gs.Sel = (RTSEL)*pEsp++; 1372 1372 rc = VINF_EM_RAW_IRET_TRAP; 1373 1373 break; -
trunk/src/VBox/VMM/VMMRC/TRPMRCHandlersA.asm
r38867 r41906 265 265 mov [esp + CPUMCTXCORE.esp], eax 266 266 mov eax, [esp + 18h + ESPOFF] ; ss 267 mov dword [esp + CPUMCTXCORE.ss ], eax267 mov dword [esp + CPUMCTXCORE.ss.Sel], eax 268 268 269 269 mov eax, [esp + 0ch + ESPOFF] ; cs 270 mov dword [esp + CPUMCTXCORE.cs ], eax270 mov dword [esp + CPUMCTXCORE.cs.Sel], eax 271 271 mov eax, [esp + 08h + ESPOFF] ; eip 272 272 mov [esp + CPUMCTXCORE.eip], eax … … 288 288 289 289 mov eax, es 290 mov dword [esp + CPUMCTXCORE.es ], eax290 mov dword [esp + CPUMCTXCORE.es.Sel], eax 291 291 mov eax, ds 292 mov dword [esp + CPUMCTXCORE.ds ], eax292 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 293 293 mov eax, fs 294 mov dword [esp + CPUMCTXCORE.fs ], eax294 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 295 295 mov eax, gs 296 mov dword [esp + CPUMCTXCORE.gs ], eax296 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 297 297 298 298 test dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM … … 303 303 ; 304 304 mov eax, dword [esp + ESPOFF + 1Ch] 305 mov dword [esp + CPUMCTXCORE.es ], eax305 mov dword [esp + CPUMCTXCORE.es.Sel], eax 306 306 307 307 mov eax, dword [esp + ESPOFF + 20h] 308 mov dword [esp + CPUMCTXCORE.ds ], eax308 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 309 309 310 310 mov eax, dword [esp + ESPOFF + 24h] 311 mov dword [esp + CPUMCTXCORE.fs ], eax311 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 312 312 313 313 mov eax, dword [esp + ESPOFF + 28h] 314 mov dword [esp + CPUMCTXCORE.gs ], eax314 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 315 315 316 316 gt_SkipV86Entry: … … 467 467 mov eax, [esp + CPUMCTXCORE.esp] 468 468 mov [esp + 14h + ESPOFF], eax ; esp 469 mov eax, dword [esp + CPUMCTXCORE.ss ]469 mov eax, dword [esp + CPUMCTXCORE.ss.Sel] 470 470 mov [esp + 18h + ESPOFF], eax ; ss 471 471 472 mov eax, dword [esp + CPUMCTXCORE.gs ]472 mov eax, dword [esp + CPUMCTXCORE.gs.Sel] 473 473 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS 474 474 mov gs, eax 475 475 476 mov eax, dword [esp + CPUMCTXCORE.fs ]476 mov eax, dword [esp + CPUMCTXCORE.fs.Sel] 477 477 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_FS 478 478 mov fs, eax 479 479 480 mov eax, dword [esp + CPUMCTXCORE.es ]480 mov eax, dword [esp + CPUMCTXCORE.es.Sel] 481 481 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_ES 482 482 mov es, eax 483 483 484 mov eax, dword [esp + CPUMCTXCORE.ds ]484 mov eax, dword [esp + CPUMCTXCORE.ds.Sel] 485 485 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_DS 486 486 mov ds, eax 487 487 488 mov eax, dword [esp + CPUMCTXCORE.cs ]488 mov eax, dword [esp + CPUMCTXCORE.cs.Sel] 489 489 mov [esp + 0ch + ESPOFF], eax ; cs 490 490 mov eax, [esp + CPUMCTXCORE.eflags] … … 512 512 mov eax, [esp + CPUMCTXCORE.esp] 513 513 mov [esp + 14h + ESPOFF], eax ; esp 514 mov eax, dword [esp + CPUMCTXCORE.ss ]514 mov eax, dword [esp + CPUMCTXCORE.ss.Sel] 515 515 mov [esp + 18h + ESPOFF], eax ; ss 516 516 517 mov eax, dword [esp + CPUMCTXCORE.es ]517 mov eax, dword [esp + CPUMCTXCORE.es.Sel] 518 518 mov [esp + 1ch + ESPOFF], eax ; es 519 mov eax, dword [esp + CPUMCTXCORE.ds ]519 mov eax, dword [esp + CPUMCTXCORE.ds.Sel] 520 520 mov [esp + 20h + ESPOFF], eax ; ds 521 mov eax, dword [esp + CPUMCTXCORE.fs ]521 mov eax, dword [esp + CPUMCTXCORE.fs.Sel] 522 522 mov [esp + 24h + ESPOFF], eax ; fs 523 mov eax, dword [esp + CPUMCTXCORE.gs ]523 mov eax, dword [esp + CPUMCTXCORE.gs.Sel] 524 524 mov [esp + 28h + ESPOFF], eax ; gs 525 525 526 526 mov eax, [esp + CPUMCTXCORE.eip] 527 527 mov [esp + 08h + ESPOFF], eax ; eip 528 mov eax, dword [esp + CPUMCTXCORE.cs ]528 mov eax, dword [esp + CPUMCTXCORE.cs.Sel] 529 529 mov [esp + 0ch + ESPOFF], eax ; cs 530 530 mov eax, [esp + CPUMCTXCORE.eflags] … … 549 549 lea ebx, [esp + 14h + ESPOFF] ; calc esp at trap 550 550 mov [esp + CPUMCTXCORE.esp], ebx; update esp in register frame 551 mov [esp + CPUMCTXCORE.ss ], ss; update ss in register frame551 mov [esp + CPUMCTXCORE.ss.Sel], ss ; update ss in register frame 552 552 553 553 ; tell cpum about the context core. … … 656 656 mov edi, [esp + CPUMCTXCORE.edi] 657 657 658 mov eax, dword [esp + CPUMCTXCORE.gs ]658 mov eax, dword [esp + CPUMCTXCORE.gs.Sel] 659 659 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS | TRPM_TRAP_IN_HYPER 660 660 mov gs, eax 661 661 662 mov eax, dword [esp + CPUMCTXCORE.fs ]662 mov eax, dword [esp + CPUMCTXCORE.fs.Sel] 663 663 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_FS | TRPM_TRAP_IN_HYPER 664 664 mov fs, eax 665 665 666 mov eax, dword [esp + CPUMCTXCORE.es ]666 mov eax, dword [esp + CPUMCTXCORE.es.Sel] 667 667 mov es, eax 668 mov eax, dword [esp + CPUMCTXCORE.ds ]668 mov eax, dword [esp + CPUMCTXCORE.ds.Sel] 669 669 mov ds, eax 670 670 … … 673 673 mov eax, [esp + CPUMCTXCORE.eip] 674 674 mov [esp + 08h + ESPOFF], eax ; eip 675 mov eax, dword [esp + CPUMCTXCORE.cs ]675 mov eax, dword [esp + CPUMCTXCORE.cs.Sel] 676 676 mov [esp + 0ch + ESPOFF], eax ; cs 677 677 mov eax, [esp + CPUMCTXCORE.eflags] … … 769 769 mov [esp + CPUMCTXCORE.eip], eax 770 770 mov eax, dword [esp + 08h + ESPOFF] ; cs 771 mov [esp + CPUMCTXCORE.cs ], eax771 mov [esp + CPUMCTXCORE.cs.Sel], eax 772 772 mov eax, [esp + 0ch + ESPOFF] ; eflags 773 773 mov [esp + CPUMCTXCORE.eflags], eax … … 776 776 mov [esp + CPUMCTXCORE.esp], eax 777 777 mov eax, dword [esp + 14h + ESPOFF] ; ss 778 mov [esp + CPUMCTXCORE.ss ], eax778 mov [esp + CPUMCTXCORE.ss.Sel], eax 779 779 780 780 %if GC_ARCH_BITS == 64 … … 792 792 793 793 mov eax, es 794 mov dword [esp + CPUMCTXCORE.es ], eax794 mov dword [esp + CPUMCTXCORE.es.Sel], eax 795 795 mov eax, ds 796 mov dword [esp + CPUMCTXCORE.ds ], eax796 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 797 797 mov eax, fs 798 mov dword [esp + CPUMCTXCORE.fs ], eax798 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 799 799 mov eax, gs 800 mov dword [esp + CPUMCTXCORE.gs ], eax800 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 801 801 802 802 test dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM … … 807 807 ; 808 808 mov eax, dword [esp + ESPOFF + 18h] 809 mov dword [esp + CPUMCTXCORE.es ], eax809 mov dword [esp + CPUMCTXCORE.es.Sel], eax 810 810 811 811 mov eax, dword [esp + ESPOFF + 1Ch] 812 mov dword [esp + CPUMCTXCORE.ds ], eax812 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 813 813 814 814 mov eax, dword [esp + ESPOFF + 20h] 815 mov dword [esp + CPUMCTXCORE.fs ], eax815 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 816 816 817 817 mov eax, dword [esp + ESPOFF + 24h] 818 mov dword [esp + CPUMCTXCORE.gs ], eax818 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 819 819 820 820 ti_SkipV86Entry: … … 925 925 lea eax, [esp + 14h + ESPOFF] ; calc esp at trap 926 926 mov [esp + CPUMCTXCORE.esp], eax ; update esp in register frame 927 mov [esp + CPUMCTXCORE.ss ], ss; update ss in register frame927 mov [esp + CPUMCTXCORE.ss.Sel], ss ; update ss in register frame 928 928 929 929 %ifdef DEBUG_STUFF_INT … … 964 964 jnz short ti_SkipSelRegs 965 965 966 mov eax, [esp + CPUMCTXCORE.gs ]966 mov eax, [esp + CPUMCTXCORE.gs.Sel] 967 967 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS | TRPM_TRAP_IN_HYPER 968 968 mov gs, eax 969 969 970 mov eax, [esp + CPUMCTXCORE.fs ]970 mov eax, [esp + CPUMCTXCORE.fs.Sel] 971 971 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_FS | TRPM_TRAP_IN_HYPER 972 972 mov fs, eax 973 973 974 mov eax, [esp + CPUMCTXCORE.es ]974 mov eax, [esp + CPUMCTXCORE.es.Sel] 975 975 mov es, eax 976 mov eax, [esp + CPUMCTXCORE.ds ]976 mov eax, [esp + CPUMCTXCORE.ds.Sel] 977 977 mov ds, eax 978 978 … … 1099 1099 1100 1100 movzx eax, word [ecx + VBOXTSS.cs] 1101 mov dword [esp + CPUMCTXCORE.cs ], eax1101 mov dword [esp + CPUMCTXCORE.cs.Sel], eax 1102 1102 movzx eax, word [ecx + VBOXTSS.ds] 1103 mov dword [esp + CPUMCTXCORE.ds ], eax1103 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 1104 1104 movzx eax, word [ecx + VBOXTSS.es] 1105 mov dword [esp + CPUMCTXCORE.es ], eax1105 mov dword [esp + CPUMCTXCORE.es.Sel], eax 1106 1106 movzx eax, word [ecx + VBOXTSS.fs] 1107 mov dword [esp + CPUMCTXCORE.fs ], eax1107 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 1108 1108 movzx eax, word [ecx + VBOXTSS.gs] 1109 mov dword [esp + CPUMCTXCORE.gs ], eax1109 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 1110 1110 movzx eax, word [ecx + VBOXTSS.ss] 1111 mov [esp + CPUMCTXCORE.ss ], eax1111 mov [esp + CPUMCTXCORE.ss.Sel], eax 1112 1112 mov eax, [ecx + VBOXTSS.esp] 1113 1113 mov [esp + CPUMCTXCORE.esp], eax … … 1260 1260 tddrf_regs: 1261 1261 COM_S_PRINT ' ***',10,13,'cs:eip=' 1262 movzx ecx, word [eax + CPUMCTXCORE.cs ]1262 movzx ecx, word [eax + CPUMCTXCORE.cs.Sel] 1263 1263 COM_S_DWORD_REG ecx 1264 1264 COM_S_CHAR ':' … … 1267 1267 1268 1268 COM_S_PRINT ' ss:esp=' 1269 movzx ecx, word [eax + CPUMCTXCORE.ss ]1269 movzx ecx, word [eax + CPUMCTXCORE.ss.Sel] 1270 1270 COM_S_DWORD_REG ecx 1271 1271 COM_S_CHAR ':' … … 1323 1323 1324 1324 COM_S_PRINT 10,13,' ds=' 1325 movzx ecx, word [eax + CPUMCTXCORE.ds ]1325 movzx ecx, word [eax + CPUMCTXCORE.ds.Sel] 1326 1326 COM_S_DWORD_REG ecx 1327 1327 1328 1328 COM_S_PRINT ' es=' 1329 movzx ecx, word [eax + CPUMCTXCORE.es ]1329 movzx ecx, word [eax + CPUMCTXCORE.es.Sel] 1330 1330 COM_S_DWORD_REG ecx 1331 1331 1332 1332 COM_S_PRINT ' fs=' 1333 movzx ecx, word [eax + CPUMCTXCORE.fs ]1333 movzx ecx, word [eax + CPUMCTXCORE.fs.Sel] 1334 1334 COM_S_DWORD_REG ecx 1335 1335 1336 1336 COM_S_PRINT ' gs=' 1337 movzx ecx, word [eax + CPUMCTXCORE.gs ]1337 movzx ecx, word [eax + CPUMCTXCORE.gs.Sel] 1338 1338 COM_S_DWORD_REG ecx 1339 1339 -
trunk/src/VBox/VMM/VMMRC/VMMRC.cpp
r41801 r41906 371 371 { 372 372 int rc = vmmGCTestTmpPFHandler(pVM, pRegFrame); 373 pRegFrame->fs = 0x30;373 pRegFrame->fs.Sel = 0x30; 374 374 return rc; 375 375 } -
trunk/src/VBox/VMM/VMMRC/VMMRC.mac
r35335 r41906 39 39 [section .VMMR0.%1 progbits alloc noexec nowrite align=1 ] 40 40 %else 41 [section .VMMR0.%1 align=1]41 [section .VMMR0.%1 ] 42 42 %endif 43 43 %endmacro -
trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp
r41823 r41906 46 46 { 47 47 #ifdef IN_RC 48 const bool fInHyper = !(pRegFrame->ss & X86_SEL_RPL) && !pRegFrame->eflags.Bits.u1VM;48 const bool fInHyper = !(pRegFrame->ss.Sel & X86_SEL_RPL) && !pRegFrame->eflags.Bits.u1VM; 49 49 #else 50 50 const bool fInHyper = false; … … 66 66 pVCpu->dbgf.s.fSingleSteppingRaw = false; 67 67 LogFlow(("DBGFRZTrap03Handler: hit hw breakpoint %d at %04x:%RGv\n", 68 pVM->dbgf.s.aHwBreakpoints[iBp].iBp, pRegFrame->cs , pRegFrame->rip));68 pVM->dbgf.s.aHwBreakpoints[iBp].iBp, pRegFrame->cs.Sel, pRegFrame->rip)); 69 69 70 70 return fInHyper ? VINF_EM_DBG_HYPER_BREAKPOINT : VINF_EM_DBG_BREAKPOINT; … … 81 81 { 82 82 pVCpu->dbgf.s.fSingleSteppingRaw = false; 83 LogFlow(("DBGFRZTrap01Handler: single step at %04x:%RGv\n", pRegFrame->cs , pRegFrame->rip));83 LogFlow(("DBGFRZTrap01Handler: single step at %04x:%RGv\n", pRegFrame->cs.Sel, pRegFrame->rip)); 84 84 return fInHyper ? VINF_EM_DBG_HYPER_STEPPED : VINF_EM_DBG_STEPPED; 85 85 } … … 91 91 */ 92 92 AssertMsg(uDr6 & X86_DR6_BS, ("hey! we're not doing guest BPs yet! dr6=%RTreg %04x:%RGv\n", 93 uDr6, pRegFrame->cs , pRegFrame->rip));93 uDr6, pRegFrame->cs.Sel, pRegFrame->rip)); 94 94 #endif 95 95 96 LogFlow(("DBGFRZTrap01Handler: guest debug event %RTreg at %04x:%RGv!\n", uDr6, pRegFrame->cs , pRegFrame->rip));96 LogFlow(("DBGFRZTrap01Handler: guest debug event %RTreg at %04x:%RGv!\n", uDr6, pRegFrame->cs.Sel, pRegFrame->rip)); 97 97 return fInHyper ? VERR_DBGF_HYPER_DB_XCPT : VINF_EM_RAW_GUEST_TRAP; 98 98 } … … 113 113 { 114 114 #ifdef IN_RC 115 const bool fInHyper = !(pRegFrame->ss & X86_SEL_RPL) && !pRegFrame->eflags.Bits.u1VM;115 const bool fInHyper = !(pRegFrame->ss.Sel & X86_SEL_RPL) && !pRegFrame->eflags.Bits.u1VM; 116 116 #else 117 117 const bool fInHyper = false; … … 125 125 { 126 126 RTGCPTR pPc; 127 int rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss , pRegFrame->cs, &pRegFrame->csHid,127 int rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss.Sel, pRegFrame->cs.Sel, &pRegFrame->cs, 128 128 #ifdef IN_RC 129 129 pRegFrame->eip - 1, … … 143 143 144 144 LogFlow(("DBGFRZTrap03Handler: hit breakpoint %d at %RGv (%04x:%RGv) cHits=0x%RX64\n", 145 pVM->dbgf.s.aBreakpoints[iBp].iBp, pPc, pRegFrame->cs , pRegFrame->rip,145 pVM->dbgf.s.aBreakpoints[iBp].iBp, pPc, pRegFrame->cs.Sel, pRegFrame->rip, 146 146 pVM->dbgf.s.aBreakpoints[iBp].cHits)); 147 147 return fInHyper -
trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac
r41905 r41906 544 544 ; Setup stack. 545 545 DEBUG_CHAR('3') 546 mov ax, [edx + CPUMCPU.Hyper.ss ]546 mov ax, [edx + CPUMCPU.Hyper.ss.Sel] 547 547 mov ss, ax 548 548 mov esp, [edx + CPUMCPU.Hyper.esp] … … 553 553 and dword [0ffffffffh], ~0200h ; clear busy flag (2nd type2 bit) 554 554 DEBUG_CHAR('5') 555 ltr word [edx + CPUMCPU.Hyper.tr ]555 ltr word [edx + CPUMCPU.Hyper.tr.Sel] 556 556 DEBUG_CHAR('6') 557 557 558 558 ; Activate the ldt (now we can safely crash). 559 lldt [edx + CPUMCPU.Hyper.ldtr ]559 lldt [edx + CPUMCPU.Hyper.ldtr.Sel] 560 560 DEBUG_CHAR('7') 561 561 … … 750 750 mov [edx + CPUMCPU.Guest.esp], eax 751 751 ; selectors 752 mov eax, [esp + 4 + CPUMCTXCORE.ss ]753 mov [edx + CPUMCPU.Guest.ss ], eax754 mov eax, [esp + 4 + CPUMCTXCORE.gs ]755 mov [edx + CPUMCPU.Guest.gs ], eax756 mov eax, [esp + 4 + CPUMCTXCORE.fs ]757 mov [edx + CPUMCPU.Guest.fs ], eax758 mov eax, [esp + 4 + CPUMCTXCORE.es ]759 mov [edx + CPUMCPU.Guest.es ], eax760 mov eax, [esp + 4 + CPUMCTXCORE.ds ]761 mov [edx + CPUMCPU.Guest.ds ], eax762 mov eax, [esp + 4 + CPUMCTXCORE.cs ]763 mov [edx + CPUMCPU.Guest.cs ], eax752 mov eax, [esp + 4 + CPUMCTXCORE.ss.Sel] 753 mov [edx + CPUMCPU.Guest.ss.Sel], eax 754 mov eax, [esp + 4 + CPUMCTXCORE.gs.Sel] 755 mov [edx + CPUMCPU.Guest.gs.Sel], eax 756 mov eax, [esp + 4 + CPUMCTXCORE.fs.Sel] 757 mov [edx + CPUMCPU.Guest.fs.Sel], eax 758 mov eax, [esp + 4 + CPUMCTXCORE.es.Sel] 759 mov [edx + CPUMCPU.Guest.es.Sel], eax 760 mov eax, [esp + 4 + CPUMCTXCORE.ds.Sel] 761 mov [edx + CPUMCPU.Guest.ds.Sel], eax 762 mov eax, [esp + 4 + CPUMCTXCORE.cs.Sel] 763 mov [edx + CPUMCPU.Guest.cs.Sel], eax 764 764 ; flags 765 765 mov eax, [esp + 4 + CPUMCTXCORE.eflags] … … 833 833 mov [edx + CPUMCPU.Hyper.esp], eax 834 834 ; selectors 835 mov eax, [ecx + CPUMCTXCORE.ss ]836 mov [edx + CPUMCPU.Hyper.ss ], eax837 mov eax, [ecx + CPUMCTXCORE.gs ]838 mov [edx + CPUMCPU.Hyper.gs ], eax839 mov eax, [ecx + CPUMCTXCORE.fs ]840 mov [edx + CPUMCPU.Hyper.fs ], eax841 mov eax, [ecx + CPUMCTXCORE.es ]842 mov [edx + CPUMCPU.Hyper.es ], eax843 mov eax, [ecx + CPUMCTXCORE.ds ]844 mov [edx + CPUMCPU.Hyper.ds ], eax845 mov eax, [ecx + CPUMCTXCORE.cs ]846 mov [edx + CPUMCPU.Hyper.cs ], eax835 mov eax, [ecx + CPUMCTXCORE.ss.Sel] 836 mov [edx + CPUMCPU.Hyper.ss.Sel], eax 837 mov eax, [ecx + CPUMCTXCORE.gs.Sel] 838 mov [edx + CPUMCPU.Hyper.gs.Sel], eax 839 mov eax, [ecx + CPUMCTXCORE.fs.Sel] 840 mov [edx + CPUMCPU.Hyper.fs.Sel], eax 841 mov eax, [ecx + CPUMCTXCORE.es.Sel] 842 mov [edx + CPUMCPU.Hyper.es.Sel], eax 843 mov eax, [ecx + CPUMCTXCORE.ds.Sel] 844 mov [edx + CPUMCPU.Hyper.ds.Sel], eax 845 mov eax, [ecx + CPUMCTXCORE.cs.Sel] 846 mov [edx + CPUMCPU.Hyper.cs.Sel], eax 847 847 ; flags 848 848 mov eax, [ecx + CPUMCTXCORE.eflags] … … 916 916 %endif 917 917 ; str [edx + CPUMCPU.Hyper.tr] - double fault only, and it won't be right then either. 918 sldt [edx + CPUMCPU.Hyper.ldtr ]918 sldt [edx + CPUMCPU.Hyper.ldtr.Sel] 919 919 920 920 ; No need to save CRx here. They are set dynamically according to Guest/Host requirements. -
trunk/src/VBox/VMM/include/CPUMInternal.mac
r41905 r41906 115 115 .Hyper.r14 resq 1 116 116 .Hyper.r15 resq 1 117 .Hyper.es resw 1 118 .Hyper.esPadding resw 3 119 .Hyper.esHid.u64Base resq 1 120 .Hyper.esHid.u32Limit resd 1 121 .Hyper.esHid.Attr resd 1 122 .Hyper.cs resw 1 123 .Hyper.csPadding resw 3 124 .Hyper.csHid.u64Base resq 1 125 .Hyper.csHid.u32Limit resd 1 126 .Hyper.csHid.Attr resd 1 127 .Hyper.ss resw 1 128 .Hyper.ssPadding resw 3 129 .Hyper.ssHid.u64Base resq 1 130 .Hyper.ssHid.u32Limit resd 1 131 .Hyper.ssHid.Attr resd 1 132 .Hyper.ds resw 1 133 .Hyper.dsPadding resw 3 134 .Hyper.dsHid.u64Base resq 1 135 .Hyper.dsHid.u32Limit resd 1 136 .Hyper.dsHid.Attr resd 1 137 .Hyper.fs resw 1 138 .Hyper.fsPadding resw 3 139 .Hyper.fsHid.u64Base resq 1 140 .Hyper.fsHid.u32Limit resd 1 141 .Hyper.fsHid.Attr resd 1 142 .Hyper.gs resw 1 143 .Hyper.gsPadding resw 3 144 .Hyper.gsHid.u64Base resq 1 145 .Hyper.gsHid.u32Limit resd 1 146 .Hyper.gsHid.Attr resd 1 117 .Hyper.es.Sel resw 1 118 .Hyper.es.PaddingSel resw 1 119 .Hyper.es.ValidSel resw 1 120 .Hyper.es.fFlags resw 1 121 .Hyper.es.u64Base resq 1 122 .Hyper.es.u32Limit resd 1 123 .Hyper.es.Attr resd 1 124 .Hyper.cs.Sel resw 1 125 .Hyper.cs.PaddingSel resw 1 126 .Hyper.cs.ValidSel resw 1 127 .Hyper.cs.fFlags resw 1 128 .Hyper.cs.u64Base resq 1 129 .Hyper.cs.u32Limit resd 1 130 .Hyper.cs.Attr resd 1 131 .Hyper.ss.Sel resw 1 132 .Hyper.ss.PaddingSel resw 1 133 .Hyper.ss.ValidSel resw 1 134 .Hyper.ss.fFlags resw 1 135 .Hyper.ss.u64Base resq 1 136 .Hyper.ss.u32Limit resd 1 137 .Hyper.ss.Attr resd 1 138 .Hyper.ds.Sel resw 1 139 .Hyper.ds.PaddingSel resw 1 140 .Hyper.ds.ValidSel resw 1 141 .Hyper.ds.fFlags resw 1 142 .Hyper.ds.u64Base resq 1 143 .Hyper.ds.u32Limit resd 1 144 .Hyper.ds.Attr resd 1 145 .Hyper.fs.Sel resw 1 146 .Hyper.fs.PaddingSel resw 1 147 .Hyper.fs.ValidSel resw 1 148 .Hyper.fs.fFlags resw 1 149 .Hyper.fs.u64Base resq 1 150 .Hyper.fs.u32Limit resd 1 151 .Hyper.fs.Attr resd 1 152 .Hyper.gs.Sel resw 1 153 .Hyper.gs.PaddingSel resw 1 154 .Hyper.gs.ValidSel resw 1 155 .Hyper.gs.fFlags resw 1 156 .Hyper.gs.u64Base resq 1 157 .Hyper.gs.u32Limit resd 1 158 .Hyper.gs.Attr resd 1 147 159 .Hyper.eip resq 1 148 160 .Hyper.eflags resq 1 … … 160 172 .Hyper.idtr.cbIdt resw 1 161 173 .Hyper.idtr.pIdt resq 1 162 .Hyper.ldtr resw 1 163 .Hyper.ldtrPadding resw 3 164 .Hyper.ldtrHid.u64Base resq 1 165 .Hyper.ldtrHid.u32Limit resd 1 166 .Hyper.ldtrHid.Attr resd 1 167 .Hyper.tr resw 1 168 .Hyper.trPadding resw 3 169 .Hyper.trHid.u64Base resq 1 170 .Hyper.trHid.u32Limit resd 1 171 .Hyper.trHid.Attr resd 1 174 .Hyper.ldtr.Sel resw 1 175 .Hyper.ldtr.PaddingSel resw 1 176 .Hyper.ldtr.ValidSel resw 1 177 .Hyper.ldtr.fFlags resw 1 178 .Hyper.ldtr.u64Base resq 1 179 .Hyper.ldtr.u32Limit resd 1 180 .Hyper.ldtr.Attr resd 1 181 .Hyper.tr.Sel resw 1 182 .Hyper.tr.PaddingSel resw 1 183 .Hyper.tr.ValidSel resw 1 184 .Hyper.tr.fFlags resw 1 185 .Hyper.tr.u64Base resq 1 186 .Hyper.tr.u32Limit resd 1 187 .Hyper.tr.Attr resd 1 172 188 .Hyper.SysEnter.cs resb 8 173 189 .Hyper.SysEnter.eip resb 8 … … 319 335 .Guest.r14 resq 1 320 336 .Guest.r15 resq 1 321 .Guest.es resw 1 322 .Guest.esPadding resw 3 323 .Guest.esHid.u64Base resq 1 324 .Guest.esHid.u32Limit resd 1 325 .Guest.esHid.Attr resd 1 326 .Guest.cs resw 1 327 .Guest.csPadding resw 3 328 .Guest.csHid.u64Base resq 1 329 .Guest.csHid.u32Limit resd 1 330 .Guest.csHid.Attr resd 1 331 .Guest.ss resw 1 332 .Guest.ssPadding resw 3 333 .Guest.ssHid.u64Base resq 1 334 .Guest.ssHid.u32Limit resd 1 335 .Guest.ssHid.Attr resd 1 336 .Guest.ds resw 1 337 .Guest.dsPadding resw 3 338 .Guest.dsHid.u64Base resq 1 339 .Guest.dsHid.u32Limit resd 1 340 .Guest.dsHid.Attr resd 1 341 .Guest.fs resw 1 342 .Guest.fsPadding resw 3 343 .Guest.fsHid.u64Base resq 1 344 .Guest.fsHid.u32Limit resd 1 345 .Guest.fsHid.Attr resd 1 346 .Guest.gs resw 1 347 .Guest.gsPadding resw 3 348 .Guest.gsHid.u64Base resq 1 349 .Guest.gsHid.u32Limit resd 1 350 .Guest.gsHid.Attr resd 1 337 .Guest.es.Sel resw 1 338 .Guest.es.PaddingSel resw 1 339 .Guest.es.ValidSel resw 1 340 .Guest.es.fFlags resw 1 341 .Guest.es.u64Base resq 1 342 .Guest.es.u32Limit resd 1 343 .Guest.es.Attr resd 1 344 .Guest.cs.Sel resw 1 345 .Guest.cs.PaddingSel resw 1 346 .Guest.cs.ValidSel resw 1 347 .Guest.cs.fFlags resw 1 348 .Guest.cs.u64Base resq 1 349 .Guest.cs.u32Limit resd 1 350 .Guest.cs.Attr resd 1 351 .Guest.ss.Sel resw 1 352 .Guest.ss.PaddingSel resw 1 353 .Guest.ss.ValidSel resw 1 354 .Guest.ss.fFlags resw 1 355 .Guest.ss.u64Base resq 1 356 .Guest.ss.u32Limit resd 1 357 .Guest.ss.Attr resd 1 358 .Guest.ds.Sel resw 1 359 .Guest.ds.PaddingSel resw 1 360 .Guest.ds.ValidSel resw 1 361 .Guest.ds.fFlags resw 1 362 .Guest.ds.u64Base resq 1 363 .Guest.ds.u32Limit resd 1 364 .Guest.ds.Attr resd 1 365 .Guest.fs.Sel resw 1 366 .Guest.fs.PaddingSel resw 1 367 .Guest.fs.ValidSel resw 1 368 .Guest.fs.fFlags resw 1 369 .Guest.fs.u64Base resq 1 370 .Guest.fs.u32Limit resd 1 371 .Guest.fs.Attr resd 1 372 .Guest.gs.Sel resw 1 373 .Guest.gs.PaddingSel resw 1 374 .Guest.gs.ValidSel resw 1 375 .Guest.gs.fFlags resw 1 376 .Guest.gs.u64Base resq 1 377 .Guest.gs.u32Limit resd 1 378 .Guest.gs.Attr resd 1 351 379 .Guest.eip resq 1 352 380 .Guest.eflags resq 1 … … 364 392 .Guest.idtr.cbIdt resw 1 365 393 .Guest.idtr.pIdt resq 1 366 .Guest.ldtr resw 1 367 .Guest.ldtrPadding resw 3 368 .Guest.ldtrHid.u64Base resq 1 369 .Guest.ldtrHid.u32Limit resd 1 370 .Guest.ldtrHid.Attr resd 1 371 .Guest.tr resw 1 372 .Guest.trPadding resw 3 373 .Guest.trHid.u64Base resq 1 374 .Guest.trHid.u32Limit resd 1 375 .Guest.trHid.Attr resd 1 394 .Guest.ldtr.Sel resw 1 395 .Guest.ldtr.PaddingSel resw 1 396 .Guest.ldtr.ValidSel resw 1 397 .Guest.ldtr.fFlags resw 1 398 .Guest.ldtr.u64Base resq 1 399 .Guest.ldtr.u32Limit resd 1 400 .Guest.ldtr.Attr resd 1 401 .Guest.tr.Sel resw 1 402 .Guest.tr.PaddingSel resw 1 403 .Guest.tr.ValidSel resw 1 404 .Guest.tr.fFlags resw 1 405 .Guest.tr.u64Base resq 1 406 .Guest.tr.u32Limit resd 1 407 .Guest.tr.Attr resd 1 376 408 .Guest.SysEnter.cs resb 8 377 409 .Guest.SysEnter.eip resb 8 -
trunk/src/VBox/VMM/include/EMHandleRCTmpl.h
r41804 r41906 112 112 case VINF_PATM_HC_MMIO_PATCH_READ: 113 113 rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, DISSELREG_CS, CPUMCTX2CORE(pCtx), pCtx->eip), 114 PATMFL_MMIO_ACCESS | ((SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs, &pCtx->csHid) == DISCPUMODE_32BIT) ? PATMFL_CODE32 : 0)); 114 PATMFL_MMIO_ACCESS 115 | ( SELMGetCpuModeFromSelector(pVCpu, pCtx->eflags, pCtx->cs.Sel, &pCtx->cs) 116 == DISCPUMODE_32BIT ? PATMFL_CODE32 : 0)); 115 117 if (RT_FAILURE(rc)) 116 118 rc = emR3ExecuteInstruction(pVM, pVCpu, "MMIO"); -
trunk/src/VBox/VMM/testcase/tstMicroRCA.asm
r41321 r41906 502 502 ;40 503 503 504 test byte [esp + CPUMCTXCORE.cs ], 3h ; check CPL of the cs selector504 test byte [esp + CPUMCTXCORE.cs.Sel], 3h ; check CPL of the cs selector 505 505 jmp short tstTrapHandler_Fault_Hyper ;; @todo 506 506 jz short tstTrapHandler_Fault_Hyper … … 516 516 lea ebx, [esp + 14h + 040h] ; calc esp at trap 517 517 mov [esp + CPUMCTXCORE.esp], ebx; update esp in register frame 518 mov [esp + CPUMCTXCORE.ss ], ss ; update ss in register frame518 mov [esp + CPUMCTXCORE.ss.Sel], ss ; update ss in register frame 519 519 520 520 mov ecx, esp -
trunk/src/VBox/VMM/testcase/tstVMStruct.h
r41905 r41906 148 148 GEN_CHECK_OFF(CPUMCTX, rcx); 149 149 GEN_CHECK_OFF(CPUMCTX, rsp); 150 GEN_CHECK_OFF(CPUMCTX, es); 151 #ifndef VBOX_FOR_DTRACE_LIB 152 GEN_CHECK_OFF(CPUMCTX, es.Sel); 153 GEN_CHECK_OFF(CPUMCTX, es.ValidSel); 154 GEN_CHECK_OFF(CPUMCTX, es.fFlags); 155 GEN_CHECK_OFF(CPUMCTX, es.u64Base); 156 GEN_CHECK_OFF(CPUMCTX, es.u32Limit); 157 GEN_CHECK_OFF(CPUMCTX, es.Attr); 158 #endif 159 GEN_CHECK_OFF(CPUMCTX, cs); 150 160 GEN_CHECK_OFF(CPUMCTX, ss); 161 GEN_CHECK_OFF(CPUMCTX, ds); 162 GEN_CHECK_OFF(CPUMCTX, fs); 151 163 GEN_CHECK_OFF(CPUMCTX, gs); 152 GEN_CHECK_OFF(CPUMCTX, fs);153 GEN_CHECK_OFF(CPUMCTX, es);154 GEN_CHECK_OFF(CPUMCTX, ds);155 GEN_CHECK_OFF(CPUMCTX, cs);156 164 GEN_CHECK_OFF(CPUMCTX, rflags); 157 165 GEN_CHECK_OFF(CPUMCTX, rip); … … 164 172 GEN_CHECK_OFF(CPUMCTX, r14); 165 173 GEN_CHECK_OFF(CPUMCTX, r15); 166 GEN_CHECK_OFF(CPUMCTX, esHid);167 GEN_CHECK_OFF(CPUMCTX, csHid);168 GEN_CHECK_OFF(CPUMCTX, ssHid);169 GEN_CHECK_OFF(CPUMCTX, dsHid);170 GEN_CHECK_OFF(CPUMCTX, fsHid);171 GEN_CHECK_OFF(CPUMCTX, gsHid);172 174 GEN_CHECK_OFF(CPUMCTX, cr0); 173 175 GEN_CHECK_OFF(CPUMCTX, cr2); … … 187 189 GEN_CHECK_OFF(CPUMCTX, msrSFMASK); 188 190 GEN_CHECK_OFF(CPUMCTX, msrKERNELGSBASE); 189 GEN_CHECK_OFF(CPUMCTX, ldtrHid); 190 GEN_CHECK_OFF(CPUMCTX, trHid); 191 GEN_CHECK_OFF(CPUMCTX, ldtr); 192 GEN_CHECK_OFF(CPUMCTX, tr); 193 #ifndef VBOX_FOR_DTRACE_LIB 194 GEN_CHECK_OFF(CPUMCTX, tr.Sel); 195 GEN_CHECK_OFF(CPUMCTX, tr.ValidSel); 196 GEN_CHECK_OFF(CPUMCTX, tr.fFlags); 197 GEN_CHECK_OFF(CPUMCTX, tr.u64Base); 198 GEN_CHECK_OFF(CPUMCTX, tr.u32Limit); 199 GEN_CHECK_OFF(CPUMCTX, tr.Attr); 200 #endif 191 201 192 202 GEN_CHECK_SIZE(CPUMCTXMSRS); -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r41905 r41906 295 295 CHECK_MEMBER_ALIGNMENT(CPUMCTX, SysEnter, 8); 296 296 CHECK_CPUMCTXCORE(rax); 297 CHECK_CPUMCTXCORE(rbx);298 297 CHECK_CPUMCTXCORE(rcx); 299 298 CHECK_CPUMCTXCORE(rdx); 299 CHECK_CPUMCTXCORE(rbx); 300 CHECK_CPUMCTXCORE(rsp); 300 301 CHECK_CPUMCTXCORE(rbp); 301 CHECK_CPUMCTXCORE(rs p);302 CHECK_CPUMCTXCORE(rsi); 302 303 CHECK_CPUMCTXCORE(rdi); 303 CHECK_CPUMCTXCORE(rsi);304 CHECK_CPUMCTXCORE(rip);305 CHECK_CPUMCTXCORE(rflags);306 CHECK_CPUMCTXCORE(cs);307 CHECK_CPUMCTXCORE(ds);308 CHECK_CPUMCTXCORE(es);309 CHECK_CPUMCTXCORE(fs);310 CHECK_CPUMCTXCORE(gs);311 CHECK_CPUMCTXCORE(ss);312 304 CHECK_CPUMCTXCORE(r8); 313 305 CHECK_CPUMCTXCORE(r9); … … 318 310 CHECK_CPUMCTXCORE(r14); 319 311 CHECK_CPUMCTXCORE(r15); 320 CHECK_CPUMCTXCORE(esHid); 321 CHECK_CPUMCTXCORE(csHid); 322 CHECK_CPUMCTXCORE(ssHid); 323 CHECK_CPUMCTXCORE(dsHid); 324 CHECK_CPUMCTXCORE(fsHid); 325 CHECK_CPUMCTXCORE(gsHid); 312 CHECK_CPUMCTXCORE(es); 313 CHECK_CPUMCTXCORE(ss); 314 CHECK_CPUMCTXCORE(cs); 315 CHECK_CPUMCTXCORE(ds); 316 CHECK_CPUMCTXCORE(fs); 317 CHECK_CPUMCTXCORE(gs); 318 CHECK_CPUMCTXCORE(rip); 319 CHECK_CPUMCTXCORE(rflags); 326 320 327 321 #if HC_ARCH_BITS == 32 -
trunk/src/recompiler/VBoxRecompiler.c
r41675 r41906 1441 1441 Ctx.cr4 = env->cr[4]; 1442 1442 1443 Ctx.tr = env->tr.selector; 1444 Ctx.trHid.u64Base = env->tr.base; 1445 Ctx.trHid.u32Limit = env->tr.limit; 1446 Ctx.trHid.Attr.u = (env->tr.flags >> 8) & 0xF0FF; 1447 1448 Ctx.ldtr = env->ldt.selector; 1449 Ctx.ldtrHid.u64Base = env->ldt.base; 1450 Ctx.ldtrHid.u32Limit = env->ldt.limit; 1451 Ctx.ldtrHid.Attr.u = (env->ldt.flags >> 8) & 0xF0FF; 1443 Ctx.tr.Sel = env->tr.selector; 1444 Ctx.tr.ValidSel = env->tr.selector; 1445 Ctx.tr.fFlags = CPUMSELREG_FLAGS_VALID; 1446 Ctx.tr.u64Base = env->tr.base; 1447 Ctx.tr.u32Limit = env->tr.limit; 1448 Ctx.tr.Attr.u = (env->tr.flags >> 8) & 0xF0FF; 1449 1450 Ctx.ldtr.Sel = env->ldt.selector; 1451 Ctx.ldtr.ValidSel = env->ldt.selector; 1452 Ctx.ldtr.fFlags = CPUMSELREG_FLAGS_VALID; 1453 Ctx.ldtr.u64Base = env->ldt.base; 1454 Ctx.ldtr.u32Limit = env->ldt.limit; 1455 Ctx.ldtr.Attr.u = (env->ldt.flags >> 8) & 0xF0FF; 1452 1456 1453 1457 Ctx.idtr.cbIdt = env->idt.limit; … … 1462 1466 Ctx.eflags.u32 = env->eflags; 1463 1467 1464 Ctx.cs = env->segs[R_CS].selector; 1465 Ctx.csHid.u64Base = env->segs[R_CS].base; 1466 Ctx.csHid.u32Limit = env->segs[R_CS].limit; 1467 Ctx.csHid.Attr.u = (env->segs[R_CS].flags >> 8) & 0xF0FF; 1468 1469 Ctx.ds = env->segs[R_DS].selector; 1470 Ctx.dsHid.u64Base = env->segs[R_DS].base; 1471 Ctx.dsHid.u32Limit = env->segs[R_DS].limit; 1472 Ctx.dsHid.Attr.u = (env->segs[R_DS].flags >> 8) & 0xF0FF; 1473 1474 Ctx.es = env->segs[R_ES].selector; 1475 Ctx.esHid.u64Base = env->segs[R_ES].base; 1476 Ctx.esHid.u32Limit = env->segs[R_ES].limit; 1477 Ctx.esHid.Attr.u = (env->segs[R_ES].flags >> 8) & 0xF0FF; 1478 1479 Ctx.fs = env->segs[R_FS].selector; 1480 Ctx.fsHid.u64Base = env->segs[R_FS].base; 1481 Ctx.fsHid.u32Limit = env->segs[R_FS].limit; 1482 Ctx.fsHid.Attr.u = (env->segs[R_FS].flags >> 8) & 0xF0FF; 1483 1484 Ctx.gs = env->segs[R_GS].selector; 1485 Ctx.gsHid.u64Base = env->segs[R_GS].base; 1486 Ctx.gsHid.u32Limit = env->segs[R_GS].limit; 1487 Ctx.gsHid.Attr.u = (env->segs[R_GS].flags >> 8) & 0xF0FF; 1488 1489 Ctx.ss = env->segs[R_SS].selector; 1490 Ctx.ssHid.u64Base = env->segs[R_SS].base; 1491 Ctx.ssHid.u32Limit = env->segs[R_SS].limit; 1492 Ctx.ssHid.Attr.u = (env->segs[R_SS].flags >> 8) & 0xF0FF; 1468 Ctx.cs.Sel = env->segs[R_CS].selector; 1469 Ctx.cs.ValidSel = env->segs[R_CS].selector; 1470 Ctx.cs.fFlags = CPUMSELREG_FLAGS_VALID; 1471 Ctx.cs.u64Base = env->segs[R_CS].base; 1472 Ctx.cs.u32Limit = env->segs[R_CS].limit; 1473 Ctx.cs.Attr.u = (env->segs[R_CS].flags >> 8) & 0xF0FF; 1474 1475 Ctx.ds.Sel = env->segs[R_DS].selector; 1476 Ctx.ds.ValidSel = env->segs[R_DS].selector; 1477 Ctx.ds.fFlags = CPUMSELREG_FLAGS_VALID; 1478 Ctx.ds.u64Base = env->segs[R_DS].base; 1479 Ctx.ds.u32Limit = env->segs[R_DS].limit; 1480 Ctx.ds.Attr.u = (env->segs[R_DS].flags >> 8) & 0xF0FF; 1481 1482 Ctx.es.Sel = env->segs[R_ES].selector; 1483 Ctx.es.ValidSel = env->segs[R_ES].selector; 1484 Ctx.es.fFlags = CPUMSELREG_FLAGS_VALID; 1485 Ctx.es.u64Base = env->segs[R_ES].base; 1486 Ctx.es.u32Limit = env->segs[R_ES].limit; 1487 Ctx.es.Attr.u = (env->segs[R_ES].flags >> 8) & 0xF0FF; 1488 1489 Ctx.fs.Sel = env->segs[R_FS].selector; 1490 Ctx.fs.ValidSel = env->segs[R_FS].selector; 1491 Ctx.fs.fFlags = CPUMSELREG_FLAGS_VALID; 1492 Ctx.fs.u64Base = env->segs[R_FS].base; 1493 Ctx.fs.u32Limit = env->segs[R_FS].limit; 1494 Ctx.fs.Attr.u = (env->segs[R_FS].flags >> 8) & 0xF0FF; 1495 1496 Ctx.gs.Sel = env->segs[R_GS].selector; 1497 Ctx.gs.ValidSel = env->segs[R_GS].selector; 1498 Ctx.gs.fFlags = CPUMSELREG_FLAGS_VALID; 1499 Ctx.gs.u64Base = env->segs[R_GS].base; 1500 Ctx.gs.u32Limit = env->segs[R_GS].limit; 1501 Ctx.gs.Attr.u = (env->segs[R_GS].flags >> 8) & 0xF0FF; 1502 1503 Ctx.ss.Sel = env->segs[R_SS].selector; 1504 Ctx.ss.ValidSel = env->segs[R_SS].selector; 1505 Ctx.ss.fFlags = CPUMSELREG_FLAGS_VALID; 1506 Ctx.ss.u64Base = env->segs[R_SS].base; 1507 Ctx.ss.u32Limit = env->segs[R_SS].limit; 1508 Ctx.ss.Attr.u = (env->segs[R_SS].flags >> 8) & 0xF0FF; 1493 1509 1494 1510 Ctx.msrEFER = env->efer; … … 2261 2277 if (fFlags & CPUM_CHANGED_LDTR) 2262 2278 { 2263 if (fHiddenSelRegsValid )2279 if (fHiddenSelRegsValid || (pCtx->ldtr.fFlags & CPUMSELREG_FLAGS_VALID)) 2264 2280 { 2265 pVM->rem.s.Env.ldt.selector = pCtx->ldtr ;2266 pVM->rem.s.Env.ldt.base = pCtx->ldtr Hid.u64Base;2267 pVM->rem.s.Env.ldt.limit = pCtx->ldtr Hid.u32Limit;2268 pVM->rem.s.Env.ldt.flags = (pCtx->ldtr Hid.Attr.u << 8) & 0xFFFFFF;2281 pVM->rem.s.Env.ldt.selector = pCtx->ldtr.Sel; 2282 pVM->rem.s.Env.ldt.base = pCtx->ldtr.u64Base; 2283 pVM->rem.s.Env.ldt.limit = pCtx->ldtr.u32Limit; 2284 pVM->rem.s.Env.ldt.flags = (pCtx->ldtr.Attr.u << 8) & 0xFFFFFF; 2269 2285 } 2270 2286 else 2271 sync_ldtr(&pVM->rem.s.Env, pCtx->ldtr );2287 sync_ldtr(&pVM->rem.s.Env, pCtx->ldtr.Sel); 2272 2288 } 2273 2289 … … 2291 2307 * Sync TR unconditionally to make life simpler. 2292 2308 */ 2293 pVM->rem.s.Env.tr.selector = pCtx->tr ;2294 pVM->rem.s.Env.tr.base = pCtx->tr Hid.u64Base;2295 pVM->rem.s.Env.tr.limit = pCtx->tr Hid.u32Limit;2296 pVM->rem.s.Env.tr.flags = (pCtx->tr Hid.Attr.u << 8) & 0xFFFFFF;2309 pVM->rem.s.Env.tr.selector = pCtx->tr.Sel; 2310 pVM->rem.s.Env.tr.base = pCtx->tr.u64Base; 2311 pVM->rem.s.Env.tr.limit = pCtx->tr.u32Limit; 2312 pVM->rem.s.Env.tr.flags = (pCtx->tr.Attr.u << 8) & 0xFFFFFF; 2297 2313 /* Note! do_interrupt will fault if the busy flag is still set... */ 2298 pVM->rem.s.Env.tr.flags &= ~DESC_TSS_BUSY_MASK;2314 pVM->rem.s.Env.tr.flags &= ~DESC_TSS_BUSY_MASK; 2299 2315 2300 2316 /* … … 2317 2333 cpu_x86_set_cpl(&pVM->rem.s.Env, uCpl); 2318 2334 2319 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_CS, pCtx->cs , pCtx->csHid.u64Base, pCtx->csHid.u32Limit, (pCtx->csHid.Attr.u << 8) & 0xFFFFFF);2320 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_SS, pCtx->ss , pCtx->ssHid.u64Base, pCtx->ssHid.u32Limit, (pCtx->ssHid.Attr.u << 8) & 0xFFFFFF);2321 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_DS, pCtx->ds , pCtx->dsHid.u64Base, pCtx->dsHid.u32Limit, (pCtx->dsHid.Attr.u << 8) & 0xFFFFFF);2322 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_ES, pCtx->es , pCtx->esHid.u64Base, pCtx->esHid.u32Limit, (pCtx->esHid.Attr.u << 8) & 0xFFFFFF);2323 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_FS, pCtx->fs , pCtx->fsHid.u64Base, pCtx->fsHid.u32Limit, (pCtx->fsHid.Attr.u << 8) & 0xFFFFFF);2324 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_GS, pCtx->gs , pCtx->gsHid.u64Base, pCtx->gsHid.u32Limit, (pCtx->gsHid.Attr.u << 8) & 0xFFFFFF);2335 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_CS, pCtx->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, (pCtx->cs.Attr.u << 8) & 0xFFFFFF); 2336 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_SS, pCtx->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, (pCtx->ss.Attr.u << 8) & 0xFFFFFF); 2337 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_DS, pCtx->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, (pCtx->ds.Attr.u << 8) & 0xFFFFFF); 2338 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_ES, pCtx->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, (pCtx->es.Attr.u << 8) & 0xFFFFFF); 2339 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_FS, pCtx->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, (pCtx->fs.Attr.u << 8) & 0xFFFFFF); 2340 cpu_x86_load_seg_cache(&pVM->rem.s.Env, R_GS, pCtx->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, (pCtx->gs.Attr.u << 8) & 0xFFFFFF); 2325 2341 } 2326 2342 else 2327 2343 { 2328 2344 /* In 'normal' raw mode we don't have access to the hidden selector registers. */ 2329 if (pVM->rem.s.Env.segs[R_SS].selector != pCtx->ss) 2345 /** @todo use hidden registers when possible and make CPUM/someone do the 2346 * reading of lazily maintained hidden registers. */ 2347 if (pVM->rem.s.Env.segs[R_SS].selector != pCtx->ss.Sel) 2330 2348 { 2331 Log2(("REMR3State: SS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_SS].selector, pCtx->ss ));2349 Log2(("REMR3State: SS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_SS].selector, pCtx->ss.Sel)); 2332 2350 2333 2351 cpu_x86_set_cpl(&pVM->rem.s.Env, uCpl); 2334 sync_seg(&pVM->rem.s.Env, R_SS, pCtx->ss );2352 sync_seg(&pVM->rem.s.Env, R_SS, pCtx->ss.Sel); 2335 2353 #ifdef VBOX_WITH_STATISTICS 2336 2354 if (pVM->rem.s.Env.segs[R_SS].newselector) … … 2343 2361 pVM->rem.s.Env.segs[R_SS].newselector = 0; 2344 2362 2345 if (pVM->rem.s.Env.segs[R_ES].selector != pCtx->es )2363 if (pVM->rem.s.Env.segs[R_ES].selector != pCtx->es.Sel) 2346 2364 { 2347 Log2(("REMR3State: ES changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_ES].selector, pCtx->es ));2348 sync_seg(&pVM->rem.s.Env, R_ES, pCtx->es );2365 Log2(("REMR3State: ES changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_ES].selector, pCtx->es.Sel)); 2366 sync_seg(&pVM->rem.s.Env, R_ES, pCtx->es.Sel); 2349 2367 #ifdef VBOX_WITH_STATISTICS 2350 2368 if (pVM->rem.s.Env.segs[R_ES].newselector) … … 2357 2375 pVM->rem.s.Env.segs[R_ES].newselector = 0; 2358 2376 2359 if (pVM->rem.s.Env.segs[R_CS].selector != pCtx->cs )2377 if (pVM->rem.s.Env.segs[R_CS].selector != pCtx->cs.Sel) 2360 2378 { 2361 Log2(("REMR3State: CS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_CS].selector, pCtx->cs ));2362 sync_seg(&pVM->rem.s.Env, R_CS, pCtx->cs );2379 Log2(("REMR3State: CS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_CS].selector, pCtx->cs.Sel)); 2380 sync_seg(&pVM->rem.s.Env, R_CS, pCtx->cs.Sel); 2363 2381 #ifdef VBOX_WITH_STATISTICS 2364 2382 if (pVM->rem.s.Env.segs[R_CS].newselector) … … 2371 2389 pVM->rem.s.Env.segs[R_CS].newselector = 0; 2372 2390 2373 if (pVM->rem.s.Env.segs[R_DS].selector != pCtx->ds )2391 if (pVM->rem.s.Env.segs[R_DS].selector != pCtx->ds.Sel) 2374 2392 { 2375 Log2(("REMR3State: DS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_DS].selector, pCtx->ds ));2376 sync_seg(&pVM->rem.s.Env, R_DS, pCtx->ds );2393 Log2(("REMR3State: DS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_DS].selector, pCtx->ds.Sel)); 2394 sync_seg(&pVM->rem.s.Env, R_DS, pCtx->ds.Sel); 2377 2395 #ifdef VBOX_WITH_STATISTICS 2378 2396 if (pVM->rem.s.Env.segs[R_DS].newselector) … … 2387 2405 /** @todo need to find a way to communicate potential GDT/LDT changes and thread switches. The selector might 2388 2406 * be the same but not the base/limit. */ 2389 if (pVM->rem.s.Env.segs[R_FS].selector != pCtx->fs )2407 if (pVM->rem.s.Env.segs[R_FS].selector != pCtx->fs.Sel) 2390 2408 { 2391 Log2(("REMR3State: FS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_FS].selector, pCtx->fs ));2392 sync_seg(&pVM->rem.s.Env, R_FS, pCtx->fs );2409 Log2(("REMR3State: FS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_FS].selector, pCtx->fs.Sel)); 2410 sync_seg(&pVM->rem.s.Env, R_FS, pCtx->fs.Sel); 2393 2411 #ifdef VBOX_WITH_STATISTICS 2394 2412 if (pVM->rem.s.Env.segs[R_FS].newselector) … … 2401 2419 pVM->rem.s.Env.segs[R_FS].newselector = 0; 2402 2420 2403 if (pVM->rem.s.Env.segs[R_GS].selector != pCtx->gs )2421 if (pVM->rem.s.Env.segs[R_GS].selector != pCtx->gs.Sel) 2404 2422 { 2405 Log2(("REMR3State: GS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_GS].selector, pCtx->gs ));2406 sync_seg(&pVM->rem.s.Env, R_GS, pCtx->gs );2423 Log2(("REMR3State: GS changed from %04x to %04x!\n", pVM->rem.s.Env.segs[R_GS].selector, pCtx->gs.Sel)); 2424 sync_seg(&pVM->rem.s.Env, R_GS, pCtx->gs.Sel); 2407 2425 #ifdef VBOX_WITH_STATISTICS 2408 2426 if (pVM->rem.s.Env.segs[R_GS].newselector) … … 2580 2598 #endif 2581 2599 2582 pCtx->ss = pVM->rem.s.Env.segs[R_SS].selector; 2583 2584 #ifdef VBOX_WITH_STATISTICS 2585 if (pVM->rem.s.Env.segs[R_SS].newselector) 2586 { 2587 STAM_COUNTER_INC(&gStatSelOutOfSyncStateBack[R_SS]); 2588 } 2589 if (pVM->rem.s.Env.segs[R_GS].newselector) 2590 { 2591 STAM_COUNTER_INC(&gStatSelOutOfSyncStateBack[R_GS]); 2592 } 2593 if (pVM->rem.s.Env.segs[R_FS].newselector) 2594 { 2595 STAM_COUNTER_INC(&gStatSelOutOfSyncStateBack[R_FS]); 2596 } 2597 if (pVM->rem.s.Env.segs[R_ES].newselector) 2598 { 2599 STAM_COUNTER_INC(&gStatSelOutOfSyncStateBack[R_ES]); 2600 } 2601 if (pVM->rem.s.Env.segs[R_DS].newselector) 2602 { 2603 STAM_COUNTER_INC(&gStatSelOutOfSyncStateBack[R_DS]); 2604 } 2605 if (pVM->rem.s.Env.segs[R_CS].newselector) 2606 { 2607 STAM_COUNTER_INC(&gStatSelOutOfSyncStateBack[R_CS]); 2608 } 2609 #endif 2610 pCtx->gs = pVM->rem.s.Env.segs[R_GS].selector; 2611 pCtx->fs = pVM->rem.s.Env.segs[R_FS].selector; 2612 pCtx->es = pVM->rem.s.Env.segs[R_ES].selector; 2613 pCtx->ds = pVM->rem.s.Env.segs[R_DS].selector; 2614 pCtx->cs = pVM->rem.s.Env.segs[R_CS].selector; 2600 #define SYNC_BACK_SREG(a_sreg, a_SREG) \ 2601 do \ 2602 { \ 2603 pCtx->a_sreg.Sel = pVM->rem.s.Env.segs[R_##a_SREG].selector; \ 2604 if (!pVM->rem.s.Env.segs[R_SS].newselector) \ 2605 { \ 2606 pCtx->a_sreg.ValidSel = pVM->rem.s.Env.segs[R_##a_SREG].selector; \ 2607 pCtx->a_sreg.fFlags = CPUMSELREG_FLAGS_VALID; \ 2608 pCtx->a_sreg.u64Base = pVM->rem.s.Env.segs[R_##a_SREG].base; \ 2609 pCtx->a_sreg.u32Limit = pVM->rem.s.Env.segs[R_##a_SREG].limit; \ 2610 /* Note! QEmu saves the 2nd dword of the descriptor; we should store the attribute word only! */ \ 2611 pCtx->a_sreg.Attr.u = (pVM->rem.s.Env.segs[R_##a_SREG].flags >> 8) & 0xF0FF; \ 2612 } \ 2613 else \ 2614 { \ 2615 pCtx->a_sreg.fFlags = 0; \ 2616 STAM_COUNTER_INC(&gStatSelOutOfSyncStateBack[R_##a_SREG]); \ 2617 } \ 2618 } while (0) 2619 2620 SYNC_BACK_SREG(es, ES); 2621 SYNC_BACK_SREG(cs, CS); 2622 SYNC_BACK_SREG(ss, SS); 2623 SYNC_BACK_SREG(ds, DS); 2624 SYNC_BACK_SREG(fs, FS); 2625 SYNC_BACK_SREG(gs, GS); 2615 2626 2616 2627 #ifdef TARGET_X86_64 … … 2648 2659 } 2649 2660 2650 if ( pCtx->ldtr != pVM->rem.s.Env.ldt.selector 2651 || pCtx->ldtrHid.u64Base != pVM->rem.s.Env.ldt.base 2652 || pCtx->ldtrHid.u32Limit != pVM->rem.s.Env.ldt.limit 2653 || pCtx->ldtrHid.Attr.u != ((pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF)) 2654 { 2655 pCtx->ldtr = pVM->rem.s.Env.ldt.selector; 2656 pCtx->ldtrHid.u64Base = pVM->rem.s.Env.ldt.base; 2657 pCtx->ldtrHid.u32Limit = pVM->rem.s.Env.ldt.limit; 2658 pCtx->ldtrHid.Attr.u = (pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF; 2661 if ( pCtx->ldtr.Sel != pVM->rem.s.Env.ldt.selector 2662 || pCtx->ldtr.ValidSel != pVM->rem.s.Env.ldt.selector 2663 || pCtx->ldtr.u64Base != pVM->rem.s.Env.ldt.base 2664 || pCtx->ldtr.u32Limit != pVM->rem.s.Env.ldt.limit 2665 || pCtx->ldtr.Attr.u != ((pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF) 2666 || !(pCtx->ldtr.fFlags & CPUMSELREG_FLAGS_VALID) 2667 ) 2668 { 2669 pCtx->ldtr.Sel = pVM->rem.s.Env.ldt.selector; 2670 pCtx->ldtr.ValidSel = pVM->rem.s.Env.ldt.selector; 2671 pCtx->ldtr.fFlags = CPUMSELREG_FLAGS_VALID; 2672 pCtx->ldtr.u64Base = pVM->rem.s.Env.ldt.base; 2673 pCtx->ldtr.u32Limit = pVM->rem.s.Env.ldt.limit; 2674 pCtx->ldtr.Attr.u = (pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF; 2659 2675 STAM_COUNTER_INC(&gStatREMLDTRChange); 2660 2676 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 2661 2677 } 2662 2678 2663 if ( pCtx->tr != pVM->rem.s.Env.tr.selector 2664 || pCtx->trHid.u64Base != pVM->rem.s.Env.tr.base 2665 || pCtx->trHid.u32Limit != pVM->rem.s.Env.tr.limit 2679 if ( pCtx->tr.Sel != pVM->rem.s.Env.tr.selector 2680 || pCtx->tr.ValidSel != pVM->rem.s.Env.tr.selector 2681 || pCtx->tr.u64Base != pVM->rem.s.Env.tr.base 2682 || pCtx->tr.u32Limit != pVM->rem.s.Env.tr.limit 2666 2683 /* Qemu and AMD/Intel have different ideas about the busy flag ... */ 2667 || pCtx->tr Hid.Attr.u != ( (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF2684 || pCtx->tr.Attr.u != ( (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF 2668 2685 ? (pVM->rem.s.Env.tr.flags | DESC_TSS_BUSY_MASK) >> 8 2669 : 0) ) 2686 : 0) 2687 || !(pCtx->tr.fFlags & CPUMSELREG_FLAGS_VALID) 2688 ) 2670 2689 { 2671 2690 Log(("REM: TR changed! %#x{%#llx,%#x,%#x} -> %#x{%llx,%#x,%#x}\n", 2672 pCtx->tr , pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,2691 pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u, 2673 2692 pVM->rem.s.Env.tr.selector, (uint64_t)pVM->rem.s.Env.tr.base, pVM->rem.s.Env.tr.limit, 2674 2693 (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF ? (pVM->rem.s.Env.tr.flags | DESC_TSS_BUSY_MASK) >> 8 : 0)); 2675 pCtx->tr = pVM->rem.s.Env.tr.selector; 2676 pCtx->trHid.u64Base = pVM->rem.s.Env.tr.base; 2677 pCtx->trHid.u32Limit = pVM->rem.s.Env.tr.limit; 2678 pCtx->trHid.Attr.u = (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF; 2679 if (pCtx->trHid.Attr.u) 2680 pCtx->trHid.Attr.u |= DESC_TSS_BUSY_MASK >> 8; 2694 pCtx->tr.Sel = pVM->rem.s.Env.tr.selector; 2695 pCtx->tr.ValidSel = pVM->rem.s.Env.tr.selector; 2696 pCtx->tr.fFlags = CPUMSELREG_FLAGS_VALID; 2697 pCtx->tr.u64Base = pVM->rem.s.Env.tr.base; 2698 pCtx->tr.u32Limit = pVM->rem.s.Env.tr.limit; 2699 pCtx->tr.Attr.u = (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF; 2700 if (pCtx->tr.Attr.u) 2701 pCtx->tr.Attr.u |= DESC_TSS_BUSY_MASK >> 8; 2681 2702 STAM_COUNTER_INC(&gStatREMTRChange); 2682 2703 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 2683 2704 } 2684 2685 /** @todo These values could still be out of sync! */2686 pCtx->csHid.u64Base = pVM->rem.s.Env.segs[R_CS].base;2687 pCtx->csHid.u32Limit = pVM->rem.s.Env.segs[R_CS].limit;2688 /* Note! QEmu saves the 2nd dword of the descriptor; we should store the attribute word only! */2689 pCtx->csHid.Attr.u = (pVM->rem.s.Env.segs[R_CS].flags >> 8) & 0xF0FF;2690 2691 pCtx->dsHid.u64Base = pVM->rem.s.Env.segs[R_DS].base;2692 pCtx->dsHid.u32Limit = pVM->rem.s.Env.segs[R_DS].limit;2693 pCtx->dsHid.Attr.u = (pVM->rem.s.Env.segs[R_DS].flags >> 8) & 0xF0FF;2694 2695 pCtx->esHid.u64Base = pVM->rem.s.Env.segs[R_ES].base;2696 pCtx->esHid.u32Limit = pVM->rem.s.Env.segs[R_ES].limit;2697 pCtx->esHid.Attr.u = (pVM->rem.s.Env.segs[R_ES].flags >> 8) & 0xF0FF;2698 2699 pCtx->fsHid.u64Base = pVM->rem.s.Env.segs[R_FS].base;2700 pCtx->fsHid.u32Limit = pVM->rem.s.Env.segs[R_FS].limit;2701 pCtx->fsHid.Attr.u = (pVM->rem.s.Env.segs[R_FS].flags >> 8) & 0xF0FF;2702 2703 pCtx->gsHid.u64Base = pVM->rem.s.Env.segs[R_GS].base;2704 pCtx->gsHid.u32Limit = pVM->rem.s.Env.segs[R_GS].limit;2705 pCtx->gsHid.Attr.u = (pVM->rem.s.Env.segs[R_GS].flags >> 8) & 0xF0FF;2706 2707 pCtx->ssHid.u64Base = pVM->rem.s.Env.segs[R_SS].base;2708 pCtx->ssHid.u32Limit = pVM->rem.s.Env.segs[R_SS].limit;2709 pCtx->ssHid.Attr.u = (pVM->rem.s.Env.segs[R_SS].flags >> 8) & 0xF0FF;2710 2705 2711 2706 /* Sysenter MSR */ … … 2845 2840 #endif 2846 2841 2847 pCtx->ss = pVM->rem.s.Env.segs[R_SS].selector; 2848 2849 pCtx->gs = pVM->rem.s.Env.segs[R_GS].selector; 2850 pCtx->fs = pVM->rem.s.Env.segs[R_FS].selector; 2851 pCtx->es = pVM->rem.s.Env.segs[R_ES].selector; 2852 pCtx->ds = pVM->rem.s.Env.segs[R_DS].selector; 2853 pCtx->cs = pVM->rem.s.Env.segs[R_CS].selector; 2842 SYNC_BACK_SREG(es, ES); 2843 SYNC_BACK_SREG(cs, CS); 2844 SYNC_BACK_SREG(ss, SS); 2845 SYNC_BACK_SREG(ds, DS); 2846 SYNC_BACK_SREG(fs, FS); 2847 SYNC_BACK_SREG(gs, GS); 2854 2848 2855 2849 #ifdef TARGET_X86_64 … … 2887 2881 } 2888 2882 2889 if ( pCtx->ldtr != pVM->rem.s.Env.ldt.selector 2890 || pCtx->ldtrHid.u64Base != pVM->rem.s.Env.ldt.base 2891 || pCtx->ldtrHid.u32Limit != pVM->rem.s.Env.ldt.limit 2892 || pCtx->ldtrHid.Attr.u != ((pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF)) 2893 { 2894 pCtx->ldtr = pVM->rem.s.Env.ldt.selector; 2895 pCtx->ldtrHid.u64Base = pVM->rem.s.Env.ldt.base; 2896 pCtx->ldtrHid.u32Limit = pVM->rem.s.Env.ldt.limit; 2897 pCtx->ldtrHid.Attr.u = (pVM->rem.s.Env.ldt.flags >> 8) & 0xFFFF; 2883 if ( pCtx->ldtr.Sel != pVM->rem.s.Env.ldt.selector 2884 || pCtx->ldtr.ValidSel != pVM->rem.s.Env.ldt.selector 2885 || pCtx->ldtr.u64Base != pVM->rem.s.Env.ldt.base 2886 || pCtx->ldtr.u32Limit != pVM->rem.s.Env.ldt.limit 2887 || pCtx->ldtr.Attr.u != ((pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF) 2888 || !(pCtx->ldtr.fFlags & CPUMSELREG_FLAGS_VALID) 2889 ) 2890 { 2891 pCtx->ldtr.Sel = pVM->rem.s.Env.ldt.selector; 2892 pCtx->ldtr.ValidSel = pVM->rem.s.Env.ldt.selector; 2893 pCtx->ldtr.fFlags = CPUMSELREG_FLAGS_VALID; 2894 pCtx->ldtr.u64Base = pVM->rem.s.Env.ldt.base; 2895 pCtx->ldtr.u32Limit = pVM->rem.s.Env.ldt.limit; 2896 pCtx->ldtr.Attr.u = (pVM->rem.s.Env.ldt.flags >> 8) & 0xF0FF; 2898 2897 STAM_COUNTER_INC(&gStatREMLDTRChange); 2899 2898 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 2900 2899 } 2901 2900 2902 if ( pCtx->tr != pVM->rem.s.Env.tr.selector 2903 || pCtx->trHid.u64Base != pVM->rem.s.Env.tr.base 2904 || pCtx->trHid.u32Limit != pVM->rem.s.Env.tr.limit 2901 if ( pCtx->tr.Sel != pVM->rem.s.Env.tr.selector 2902 || pCtx->tr.ValidSel != pVM->rem.s.Env.tr.selector 2903 || pCtx->tr.u64Base != pVM->rem.s.Env.tr.base 2904 || pCtx->tr.u32Limit != pVM->rem.s.Env.tr.limit 2905 2905 /* Qemu and AMD/Intel have different ideas about the busy flag ... */ 2906 || pCtx->tr Hid.Attr.u != ( (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF2906 || pCtx->tr.Attr.u != ( (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF 2907 2907 ? (pVM->rem.s.Env.tr.flags | DESC_TSS_BUSY_MASK) >> 8 2908 : 0) ) 2908 : 0) 2909 || !(pCtx->tr.fFlags & CPUMSELREG_FLAGS_VALID) 2910 ) 2909 2911 { 2910 2912 Log(("REM: TR changed! %#x{%#llx,%#x,%#x} -> %#x{%llx,%#x,%#x}\n", 2911 pCtx->tr , pCtx->trHid.u64Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,2913 pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u, 2912 2914 pVM->rem.s.Env.tr.selector, (uint64_t)pVM->rem.s.Env.tr.base, pVM->rem.s.Env.tr.limit, 2913 2915 (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF ? (pVM->rem.s.Env.tr.flags | DESC_TSS_BUSY_MASK) >> 8 : 0)); 2914 pCtx->tr = pVM->rem.s.Env.tr.selector; 2915 pCtx->trHid.u64Base = pVM->rem.s.Env.tr.base; 2916 pCtx->trHid.u32Limit = pVM->rem.s.Env.tr.limit; 2917 pCtx->trHid.Attr.u = (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF; 2918 if (pCtx->trHid.Attr.u) 2919 pCtx->trHid.Attr.u |= DESC_TSS_BUSY_MASK >> 8; 2916 pCtx->tr.Sel = pVM->rem.s.Env.tr.selector; 2917 pCtx->tr.ValidSel = pVM->rem.s.Env.tr.selector; 2918 pCtx->tr.fFlags = CPUMSELREG_FLAGS_VALID; 2919 pCtx->tr.u64Base = pVM->rem.s.Env.tr.base; 2920 pCtx->tr.u32Limit = pVM->rem.s.Env.tr.limit; 2921 pCtx->tr.Attr.u = (pVM->rem.s.Env.tr.flags >> 8) & 0xF0FF; 2922 if (pCtx->tr.Attr.u) 2923 pCtx->tr.Attr.u |= DESC_TSS_BUSY_MASK >> 8; 2920 2924 STAM_COUNTER_INC(&gStatREMTRChange); 2921 2925 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 2922 2926 } 2923 2924 /** @todo These values could still be out of sync! */2925 pCtx->csHid.u64Base = pVM->rem.s.Env.segs[R_CS].base;2926 pCtx->csHid.u32Limit = pVM->rem.s.Env.segs[R_CS].limit;2927 /** @note QEmu saves the 2nd dword of the descriptor; we should store the attribute word only! */2928 pCtx->csHid.Attr.u = (pVM->rem.s.Env.segs[R_CS].flags >> 8) & 0xFFFF;2929 2930 pCtx->dsHid.u64Base = pVM->rem.s.Env.segs[R_DS].base;2931 pCtx->dsHid.u32Limit = pVM->rem.s.Env.segs[R_DS].limit;2932 pCtx->dsHid.Attr.u = (pVM->rem.s.Env.segs[R_DS].flags >> 8) & 0xFFFF;2933 2934 pCtx->esHid.u64Base = pVM->rem.s.Env.segs[R_ES].base;2935 pCtx->esHid.u32Limit = pVM->rem.s.Env.segs[R_ES].limit;2936 pCtx->esHid.Attr.u = (pVM->rem.s.Env.segs[R_ES].flags >> 8) & 0xFFFF;2937 2938 pCtx->fsHid.u64Base = pVM->rem.s.Env.segs[R_FS].base;2939 pCtx->fsHid.u32Limit = pVM->rem.s.Env.segs[R_FS].limit;2940 pCtx->fsHid.Attr.u = (pVM->rem.s.Env.segs[R_FS].flags >> 8) & 0xFFFF;2941 2942 pCtx->gsHid.u64Base = pVM->rem.s.Env.segs[R_GS].base;2943 pCtx->gsHid.u32Limit = pVM->rem.s.Env.segs[R_GS].limit;2944 pCtx->gsHid.Attr.u = (pVM->rem.s.Env.segs[R_GS].flags >> 8) & 0xFFFF;2945 2946 pCtx->ssHid.u64Base = pVM->rem.s.Env.segs[R_SS].base;2947 pCtx->ssHid.u32Limit = pVM->rem.s.Env.segs[R_SS].limit;2948 pCtx->ssHid.Attr.u = (pVM->rem.s.Env.segs[R_SS].flags >> 8) & 0xFFFF;2949 2927 2950 2928 /* Sysenter MSR */
Note:
See TracChangeset
for help on using the changeset viewer.