Changeset 61348 in vbox for trunk/src/VBox/VMM/VMMRZ
- Timestamp:
- May 31, 2016 5:59:34 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107643
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMRZ/CPUMRZA.asm
r61317 r61348 72 72 cli ; interrupt occurs while we're doing fxsave/fxrstor/cr0. 73 73 74 %ifndef CPUM_CAN_USE_FPU_IN_R0 75 ; 76 ; In raw-mode context and on systems where the kernel doesn't necessarily 77 ; allow us to use the FPU in ring-0 context, we have to disable FPU traps 78 ; before doing fxsave/xsave here. (xCX is 0 if no CR0 was necessary.) We 79 ; leave it like that so IEM can use the FPU/SSE/AVX host CPU features directly. 80 ; 81 SAVE_CR0_CLEAR_FPU_TRAPS xCX, xAX ; xCX must be preserved! 82 ;; @todo What about XCR0? 83 %ifdef IN_RING0 84 mov [pCpumCpu + CPUMCPU.Host.cr0Fpu], xCX 85 %endif 86 %endif 74 ; 75 ; We may have to update CR0, indirectly or directly. We must report any 76 ; changes to the VT-x code. 77 ; 78 CPUMRZ_TOUCH_FPU_CLEAR_CR0_FPU_TRAPS_SET_RC xCX, xAX, pCpumCpu ; xCX is the return value (xAX scratch) 79 87 80 ; 88 81 ; Save the host state (xsave/fxsave will cause thread FPU state to be … … 94 87 popf 95 88 96 %ifndef CPUM_CAN_USE_FPU_IN_R0 97 ; Figure the return code. 98 test ecx, ecx 99 jnz .modified_cr0 100 %endif 101 xor eax, eax 102 .return: 103 89 mov eax, ecx ; The return value from above. 104 90 %ifdef RT_ARCH_X86 105 91 pop esi … … 108 94 leave 109 95 ret 110 111 %ifndef CPUM_CAN_USE_FPU_IN_R0112 .modified_cr0:113 mov eax, VINF_CPUM_HOST_CR0_MODIFIED114 jmp .return115 %endif116 96 %undef pCpumCpu 117 97 %undef pXState … … 156 136 157 137 %ifdef IN_RC 158 SAVE_CR0_CLEAR_FPU_TRAPS xCX, xAX ; xCX must be preserved until CR0 is restored! 138 mov ecx, cr0 ; ecx = saved cr0 139 test ecx, X86_CR0_TS | X86_CR0_EM 140 jz .skip_cr0_write 141 mov eax, ecx 142 and eax, ~(X86_CR0_TS | X86_CR0_EM) 143 mov cr0, ecx 144 .skip_cr0_write: 159 145 %endif 160 146 … … 221 207 test byte [ebp + 0ch], 1 ; fLeaveFpuAccessible 222 208 jz .no_cr0_restore 223 RESTORE_CR0 xCX209 CPUMRZ_RESTORE_CR0_IF_TS_OR_EM_SET ecx 224 210 .no_cr0_restore: 225 211 %endif … … 272 258 %ifdef IN_RC 273 259 ; Temporarily grant access to the SSE state. xDX must be preserved until CR0 is restored! 274 SAVE_CR0_CLEAR_FPU_TRAPS xDX, xAX 260 mov edx, cr0 261 jz .skip_cr0_write 262 mov eax, edx 263 and eax, ~(X86_CR0_TS | X86_CR0_EM) 264 mov cr0, ecx 265 .skip_cr0_write: 275 266 %endif 276 267 … … 298 289 299 290 %ifdef IN_RC 300 RESTORE_CR0 xDX; Restore CR0 if we changed it above.291 CPUMRZ_RESTORE_CR0_IF_TS_OR_EM_SET edx ; Restore CR0 if we changed it above. 301 292 %endif 302 293
Note:
See TracChangeset
for help on using the changeset viewer.