VirtualBox

Changeset 14993 in vbox for trunk/src/VBox/VMM/VMMSwitcher


Ignore:
Timestamp:
Dec 4, 2008 3:39:41 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
40364
Message:

Switcher updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac

    r14988 r14993  
    136136    pop     dword [edx + CPUMCPU.Host.eflags]
    137137
    138     ;; handle use flags.
    139     mov     esi, [edx + CPUMCPU.fUseFlags] ; esi == use flags.
    140     and     esi, ~CPUM_USED_FPU         ; Clear CPUM_USED_* flags. ;;@todo FPU check can be optimized to use cr0 flags!
    141     mov     [edx + CPUMCPU.fUseFlags], esi
    142 
    143138    ; control registers.
    144139    mov     eax, cr0
     
    240235    mov     ds, rax
    241236    mov     es, rax
    242    
     237
    243238    ; Setup stack; use the lss_esp, ss pair for lss
    244239    DEBUG_CHAR('7')
     
    248243    lss     esp, [rdx + CPUM.Hyper.lss_esp]
    249244
    250     ; call the hypervisor function with rdx=pCpumCpu
    251     mov     eax, [rdx + CPUM.Hyper.eip]
     245    ; load the hypervisor function address
     246    mov     r9, [rdx + CPUM.Hyper.eip]
     247
    252248    CPUMCPU_FROM_CPUM(edx)
     249   
     250    ; Check if we need to restore the guest FPU state
     251    mov     esi, [rdx + CPUMCPU.fUseFlags] ; esi == use flags.
     252    test    esi, CPUM_SYNC_FPU_STATE
     253    jz      near gth_fpu_no 
     254
     255    mov     rax, cr0
     256    mov     rcx, rax                    ; save old CR0
     257    and     rax, ~(X86_CR0_TS | X86_CR0_EM)
     258    mov     cr0, rax
     259    fxrstor [rdx + CPUMCPU.Guest.fpu]
     260    mov     cr0, rcx                    ; and restore old CR0 again
     261
     262gth_fpu_no:
     263    ; Check if we need to restore the guest debug state
     264    test    esi, CPUM_SYNC_DEBUG_STATE
     265    jz      near gth_debug_no
     266   
     267    mov rax, qword [rdx + CPUMCPU.Guest.dr + 0*8]
     268    mov dr0, rax
     269    mov rax, qword [rdx + CPUMCPU.Guest.dr + 1*8]
     270    mov dr1, rax
     271    mov rax, qword [rdx + CPUMCPU.Guest.dr + 2*8]
     272    mov dr2, rax
     273    mov rax, qword [rdx + CPUMCPU.Guest.dr + 3*8]
     274    mov dr3, rax
     275    mov rax, qword [rdx + CPUMCPU.Guest.dr + 6*8]
     276    mov dr6, rax    ; not required for AMD-V
     277
     278gth_debug_no:
    253279
    254280    ; parameter for all helper functions (pCtx)   
    255281    lea     rsi, [rdx + CPUMCPU.Guest.fpu]
    256     call    rax
     282    call    r9
    257283   
    258284    ; Load CPUM pointer into rdx
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette