Changeset 9484 in vbox
- Timestamp:
- Jun 6, 2008 2:02:24 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 31744
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWACCMR0A.asm
r9475 r9484 65 65 66 66 %ifdef RT_ARCH_AMD64 67 ; Save a host and load the corresponding guest MSR (trashes rdx & rcx) 68 %macro LOADGUESTMSR 2 69 mov rcx, %1 70 rdmsr 71 push rdx 72 push rax 73 xor rdx, rdx 74 mov rax, qword [xSI + %2] 75 wrmsr 76 %endmacro 77 78 ; Save a guest and load the corresponding host MSR (trashes rdx & rcx) 79 %macro LOADHOSTMSR 2 80 mov rcx, %1 81 rdmsr 82 mov qword [xSI + %2], rax 83 pop rax 84 pop rdx 85 wrmsr 86 %endmacro 87 67 88 %ifdef ASM_CALL64_GCC 68 89 %macro MYPUSHAD 0 … … 102 123 %endif 103 124 125 ; trashes, rax, rdx & rcx 104 126 %macro MYPUSHSEGS 2 105 127 mov %2, es … … 109 131 110 132 ; Special case for FS; Windows and Linux either don't use it or restore it when leaving kernel mode, Solaris OTOH doesn't and we must save it. 111 push rcx112 133 mov ecx, MSR_K8_FS_BASE 113 134 rdmsr 114 pop rcx115 135 push rdx 116 136 push rax … … 118 138 119 139 ; Special case for GS; OSes typically use swapgs to reset the hidden base register for GS on entry into the kernel. The same happens on exit 120 push rcx121 140 mov ecx, MSR_K8_GS_BASE 122 141 rdmsr 123 pop rcx124 142 push rdx 125 143 push rax … … 127 145 %endmacro 128 146 147 ; trashes, rax, rdx & rcx 129 148 %macro MYPOPSEGS 2 130 149 ; Note: do not step through this code with a debugger! … … 132 151 pop rax 133 152 pop rdx 134 push rcx135 153 mov ecx, MSR_K8_GS_BASE 136 154 wrmsr 137 pop rcx138 155 139 156 pop fs 140 157 pop rax 141 158 pop rdx 142 push rcx143 159 mov ecx, MSR_K8_FS_BASE 144 160 wrmsr 145 pop rcx146 161 ; Now it's safe to step again 147 162 … … 233 248 234 249 ;/* Save segment registers */ 235 ; Note: MYPUSHSEGS trashes rdx (among others), so we moved it here (msvc amd64 case)250 ; Note: MYPUSHSEGS trashes rdx & rcx, so we moved it here (msvc amd64 case) 236 251 MYPUSHSEGS xAX, ax 237 252 … … 434 449 435 450 ;/* Save segment registers */ 436 ; Note: MYPUSHSEGS trashes rdx (among others), so we moved it here (msvc amd64 case)451 ; Note: MYPUSHSEGS trashes rdx & rcx, so we moved it here (msvc amd64 case) 437 452 MYPUSHSEGS xAX, ax 453 454 ; Save the host LSTAR, CSTAR, SFMASK & KERNEL_GSBASE MSRs and restore the guest MSRs 455 ; @todo use the automatic load feature for MSRs 456 LOADGUESTMSR MSR_K8_LSTAR, CPUMCTX.msrLSTAR 457 LOADGUESTMSR MSR_K8_CSTAR, CPUMCTX.msrCSTAR 458 LOADGUESTMSR MSR_K8_SF_MASK, CPUMCTX.msrSFMASK 459 LOADGUESTMSR MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE 438 460 439 461 ; Save the pCtx pointer … … 544 566 add xSP, xS ; pCtx 545 567 568 ; Save the guest LSTAR, CSTAR, SFMASK & KERNEL_GSBASE MSRs and restore the host MSRs 569 ; @todo use the automatic load feature for MSRs 570 LOADHOSTMSR MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE 571 LOADHOSTMSR MSR_K8_SF_MASK, CPUMCTX.msrSFMASK 572 LOADHOSTMSR MSR_K8_CSTAR, CPUMCTX.msrCSTAR 573 LOADHOSTMSR MSR_K8_LSTAR, CPUMCTX.msrLSTAR 574 546 575 ; Restore segment registers 547 576 MYPOPSEGS xAX, ax … … 569 598 570 599 add xSP, xS ; pCtx 600 601 ; Save the guest LSTAR, CSTAR, SFMASK & KERNEL_GSBASE MSRs and restore the host MSRs 602 ; @todo use the automatic load feature for MSRs 603 LOADHOSTMSR MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE 604 LOADHOSTMSR MSR_K8_SF_MASK, CPUMCTX.msrSFMASK 605 LOADHOSTMSR MSR_K8_CSTAR, CPUMCTX.msrCSTAR 606 LOADHOSTMSR MSR_K8_LSTAR, CPUMCTX.msrLSTAR 571 607 572 608 ; Restore segment registers … … 589 625 590 626 add xSP, xS ; pCtx 627 628 ; Save the guest LSTAR, CSTAR, SFMASK & KERNEL_GSBASE MSRs and restore the host MSRs 629 ; @todo use the automatic load feature for MSRs 630 LOADHOSTMSR MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE 631 LOADHOSTMSR MSR_K8_SF_MASK, CPUMCTX.msrSFMASK 632 LOADHOSTMSR MSR_K8_CSTAR, CPUMCTX.msrCSTAR 633 LOADHOSTMSR MSR_K8_LSTAR, CPUMCTX.msrLSTAR 591 634 592 635 ; Restore segment registers -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r9475 r9484 951 951 */ 952 952 val = (pVM->hwaccm.s.vmx.msr.vmx_entry & 0xFFFFFFFF); 953 954 /* Mask away the bits that the CPU doesn't support */955 /** @todo make sure they don't conflict with the above requirements. */956 val &= (pVM->hwaccm.s.vmx.msr.vmx_entry >> 32ULL);957 /* else Must be zero when AMD64 is not available. */958 rc = VMXWriteVMCS(VMX_VMCS_CTRL_ENTRY_CONTROLS, val);959 AssertRC(rc);960 961 953 /* 64 bits guest mode? */ 962 954 if (pCtx->msrEFER & MSR_K6_EFER_LMA) 963 {964 955 val |= VMX_VMCS_CTRL_ENTRY_CONTROLS_IA64_MODE; 956 /* else Must be zero when AMD64 is not available. */ 957 958 /* Mask away the bits that the CPU doesn't support */ 959 val &= (pVM->hwaccm.s.vmx.msr.vmx_entry >> 32ULL); 960 rc = VMXWriteVMCS(VMX_VMCS_CTRL_ENTRY_CONTROLS, val); 961 AssertRC(rc); 962 963 /* 64 bits guest mode? */ 964 if (pCtx->msrEFER & MSR_K6_EFER_LMA) 965 { 965 966 #ifndef VBOX_WITH_64_BITS_GUESTS 966 967 return VERR_PGM_UNSUPPORTED_SHADOW_PAGING_MODE;
Note:
See TracChangeset
for help on using the changeset viewer.