Changeset 20538 in vbox for trunk/src/VBox
- Timestamp:
- Jun 13, 2009 9:15:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/CPUMR0A.asm
r20536 r20538 281 281 %endif 282 282 ENDPROC cpumR0RestoreHostFPUState 283 284 285 ;;286 ; Restores the guest's FPU/XMM state287 ;288 ; @param pCtx x86:[esp+4] GCC:rdi MSC:rcx CPUMCTX pointer289 ;290 ; @remarks Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.291 ;292 align 16293 BEGINPROC cpumR0LoadFPU294 %ifdef RT_ARCH_AMD64295 %ifdef RT_OS_WINDOWS296 mov xDX, rcx297 %else298 mov xDX, rdi299 %endif300 %else301 mov xDX, dword [esp + 4]302 %endif303 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL304 cmp byte [NAME(g_fCPUMIs64bitHost)], 0305 jz .legacy_mode306 db 0xea ; jmp far .sixtyfourbit_mode307 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)308 .legacy_mode:309 %endif ; VBOX_WITH_HYBRID_32BIT_KERNEL310 311 fxrstor [xDX + CPUMCTX.fpu]312 .done:313 ret314 315 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0316 ALIGNCODE(16)317 BITS 64318 .sixtyfourbit_mode:319 and edx, 0ffffffffh320 fxrstor [rdx + CPUMCTX.fpu]321 jmp far [.fpret wrt rip]322 .fpret: ; 16:32 Pointer to .the_end.323 dd .done, NAME(SUPR0AbsKernelCS)324 BITS 32325 %endif326 ENDPROC cpumR0LoadFPU327 328 329 ;;330 ; Restores the guest's FPU/XMM state331 ;332 ; @param pCtx x86:[esp+4] GCC:rdi MSC:rcx CPUMCTX pointer333 ;334 ; @remarks Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.335 ;336 align 16337 BEGINPROC cpumR0SaveFPU338 %ifdef RT_ARCH_AMD64339 %ifdef RT_OS_WINDOWS340 mov xDX, rcx341 %else342 mov xDX, rdi343 %endif344 %else345 mov xDX, dword [esp + 4]346 %endif347 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL348 cmp byte [NAME(g_fCPUMIs64bitHost)], 0349 jz .legacy_mode350 db 0xea ; jmp far .sixtyfourbit_mode351 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)352 .legacy_mode:353 %endif ; VBOX_WITH_HYBRID_32BIT_KERNEL354 fxsave [xDX + CPUMCTX.fpu]355 .done:356 ret357 358 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0359 ALIGNCODE(16)360 BITS 64361 .sixtyfourbit_mode:362 and edx, 0ffffffffh363 fxsave [rdx + CPUMCTX.fpu]364 jmp far [.fpret wrt rip]365 .fpret: ; 16:32 Pointer to .the_end.366 dd .done, NAME(SUPR0AbsKernelCS)367 BITS 32368 %endif369 ENDPROC cpumR0SaveFPU370 371 372 ;;373 ; Restores the guest's XMM state374 ;375 ; @param pCtx x86:[esp+4] GCC:rdi MSC:rcx CPUMCTX pointer376 ;377 ; @remarks Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.378 ;379 align 16380 BEGINPROC cpumR0LoadXMM381 %ifdef RT_ARCH_AMD64382 %ifdef RT_OS_WINDOWS383 mov xDX, rcx384 %else385 mov xDX, rdi386 %endif387 %else388 mov xDX, dword [esp + 4]389 %endif390 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL391 cmp byte [NAME(g_fCPUMIs64bitHost)], 0392 jz .legacy_mode393 db 0xea ; jmp far .sixtyfourbit_mode394 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)395 .legacy_mode:396 %endif ; VBOX_WITH_HYBRID_32BIT_KERNEL397 398 movdqa xmm0, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*0]399 movdqa xmm1, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*1]400 movdqa xmm2, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*2]401 movdqa xmm3, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*3]402 movdqa xmm4, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*4]403 movdqa xmm5, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*5]404 movdqa xmm6, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*6]405 movdqa xmm7, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*7]406 407 %ifdef RT_ARCH_AMD64408 test qword [xDX + CPUMCTX.msrEFER], MSR_K6_EFER_LMA409 jz .done410 411 movdqa xmm8, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*8]412 movdqa xmm9, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*9]413 movdqa xmm10, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*10]414 movdqa xmm11, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*11]415 movdqa xmm12, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*12]416 movdqa xmm13, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*13]417 movdqa xmm14, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*14]418 movdqa xmm15, [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*15]419 %endif420 .done:421 ret422 423 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0424 ALIGNCODE(16)425 BITS 64426 .sixtyfourbit_mode:427 and edx, 0ffffffffh428 429 movdqa xmm0, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*0]430 movdqa xmm1, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*1]431 movdqa xmm2, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*2]432 movdqa xmm3, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*3]433 movdqa xmm4, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*4]434 movdqa xmm5, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*5]435 movdqa xmm6, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*6]436 movdqa xmm7, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*7]437 438 test qword [rdx + CPUMCTX.msrEFER], MSR_K6_EFER_LMA439 jz .sixtyfourbit_done440 441 movdqa xmm8, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*8]442 movdqa xmm9, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*9]443 movdqa xmm10, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*10]444 movdqa xmm11, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*11]445 movdqa xmm12, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*12]446 movdqa xmm13, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*13]447 movdqa xmm14, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*14]448 movdqa xmm15, [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*15]449 .sixtyfourbit_done:450 jmp far [.fpret wrt rip]451 .fpret: ; 16:32 Pointer to .the_end.452 dd .done, NAME(SUPR0AbsKernelCS)453 BITS 32454 %endif455 ENDPROC cpumR0LoadXMM456 457 458 ;;459 ; Restores the guest's XMM state460 ;461 ; @param pCtx x86:[esp+4] GCC:rdi MSC:rcx CPUMCTX pointer462 ;463 ; @remarks Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.464 ;465 align 16466 BEGINPROC cpumR0SaveXMM467 %ifdef RT_ARCH_AMD64468 %ifdef RT_OS_WINDOWS469 mov xDX, rcx470 %else471 mov xDX, rdi472 %endif473 %else474 mov xDX, dword [esp + 4]475 %endif476 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL477 cmp byte [NAME(g_fCPUMIs64bitHost)], 0478 jz .legacy_mode479 db 0xea ; jmp far .sixtyfourbit_mode480 dd .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)481 .legacy_mode:482 %endif ; VBOX_WITH_HYBRID_32BIT_KERNEL483 484 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*0], xmm0485 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*1], xmm1486 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*2], xmm2487 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*3], xmm3488 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*4], xmm4489 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*5], xmm5490 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*6], xmm6491 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*7], xmm7492 493 %ifdef RT_ARCH_AMD64494 test qword [xDX + CPUMCTX.msrEFER], MSR_K6_EFER_LMA495 jz .done496 497 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*8], xmm8498 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*9], xmm9499 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*10], xmm10500 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*11], xmm11501 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*12], xmm12502 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*13], xmm13503 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*14], xmm14504 movdqa [xDX + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*15], xmm15505 506 %endif507 .done:508 ret509 510 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0511 ALIGNCODE(16)512 BITS 64513 .sixtyfourbit_mode:514 and edx, 0ffffffffh515 516 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*0], xmm0517 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*1], xmm1518 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*2], xmm2519 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*3], xmm3520 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*4], xmm4521 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*5], xmm5522 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*6], xmm6523 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*7], xmm7524 525 test qword [rdx + CPUMCTX.msrEFER], MSR_K6_EFER_LMA526 jz .sixtyfourbit_done527 528 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*8], xmm8529 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*9], xmm9530 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*10], xmm10531 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*11], xmm11532 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*12], xmm12533 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*13], xmm13534 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*14], xmm14535 movdqa [rdx + CPUMCTX.fpu + X86FXSTATE.aXMM + 16*15], xmm15536 537 .sixtyfourbit_done:538 jmp far [.fpret wrt rip]539 .fpret: ; 16:32 Pointer to .the_end.540 dd .done, NAME(SUPR0AbsKernelCS)541 BITS 32542 %endif543 ENDPROC cpumR0SaveXMM544 545 546 ;;547 ; Set the FPU control word; clearing exceptions first548 ;549 ; @param u16FCW x86:[esp+4] GCC:rdi MSC:rcx New FPU control word550 align 16551 BEGINPROC cpumR0SetFCW552 %ifdef RT_ARCH_AMD64553 %ifdef RT_OS_WINDOWS554 mov xAX, rcx555 %else556 mov xAX, rdi557 %endif558 %else559 mov xAX, dword [esp + 4]560 %endif561 fnclex562 push xAX563 fldcw [xSP]564 pop xAX565 ret566 ENDPROC cpumR0SetFCW567 568 569 ;;570 ; Get the FPU control word571 ;572 align 16573 BEGINPROC cpumR0GetFCW574 fnstcw [xSP - 8]575 mov ax, word [xSP - 8]576 ret577 ENDPROC cpumR0GetFCW578 579 580 ;;581 ; Set the MXCSR;582 ;583 ; @param u32MXCSR x86:[esp+4] GCC:rdi MSC:rcx New MXCSR584 align 16585 BEGINPROC cpumR0SetMXCSR586 %ifdef RT_ARCH_AMD64587 %ifdef RT_OS_WINDOWS588 mov xAX, rcx589 %else590 mov xAX, rdi591 %endif592 %else593 mov xAX, dword [esp + 4]594 %endif595 push xAX596 ldmxcsr [xSP]597 pop xAX598 ret599 ENDPROC cpumR0SetMXCSR600 601 602 ;;603 ; Get the MXCSR604 ;605 align 16606 BEGINPROC cpumR0GetMXCSR607 stmxcsr [xSP - 8]608 mov eax, dword [xSP - 8]609 ret610 ENDPROC cpumR0GetMXCSR611 283 612 284 … … 726 398 727 399 %endif ; VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0 400
Note:
See TracChangeset
for help on using the changeset viewer.