VirtualBox

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


Ignore:
Timestamp:
Nov 28, 2008 9:38:27 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
40080
Message:

Switcher updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMSwitcher/32BitToAMD64.asm

    r14653 r14764  
    138138    pop     dword [edx + CPUMCPU.Host.eflags]
    139139
    140     FIXUP FIX_NO_SYSENTER_JMP, 0, htg_no_sysenter - NAME(Start) ; this will insert a jmp htg_no_sysenter if host doesn't use sysenter.
    141     ; save MSR_IA32_SYSENTER_CS register.
    142     mov     ecx, MSR_IA32_SYSENTER_CS
    143     mov     ebx, edx                    ; save edx
    144     rdmsr                               ; edx:eax <- MSR[ecx]
    145     mov     [ebx + CPUMCPU.Host.SysEnter.cs], eax
    146     mov     [ebx + CPUMCPU.Host.SysEnter.cs + 4], edx
    147     xor     eax, eax                    ; load 0:0 to cause #GP upon sysenter
    148     xor     edx, edx
    149     wrmsr
    150     xchg    ebx, edx                    ; restore edx
    151     jmp short htg_no_sysenter
    152 
    153 ALIGNCODE(16)
    154 htg_no_sysenter:
    155 
    156140    ;; handle use flags.
    157141    mov     esi, [edx + CPUMCPU.fUseFlags] ; esi == use flags.
     
    173157    mov     eax, cr4
    174158    mov     [edx + CPUMCPU.Host.cr4], eax
     159
     160    CPUM_FROM_CPUMCPU(edx)
     161    ; Load new gdt so we can do far jump after going into 64 bits mode
     162    lgdt    [edx + CPUM.Hyper.gdtr]
    175163
    176164    ;;
     
    438426    lss     esp, [edx + CPUMCPU.Host.esp]
    439427
    440     FIXUP FIX_NO_SYSENTER_JMP, 0, gth_sysenter_no - NAME(Start) ; this will insert a jmp gth_sysenter_no if host doesn't use sysenter.
    441    
    442     ; restore MSR_IA32_SYSENTER_CS register.
    443     mov     ecx, MSR_IA32_SYSENTER_CS
    444     mov     eax, [edx + CPUMCPU.Host.SysEnter.cs]
    445     mov     ebx, [edx + CPUMCPU.Host.SysEnter.cs + 4]
    446     xchg    edx, ebx                    ; save/load edx
    447     wrmsr                               ; MSR[ecx] <- edx:eax
    448     xchg    edx, ebx                    ; restore edx
    449     jmp short gth_sysenter_no
    450 
    451 ALIGNCODE(16)
    452 gth_sysenter_no:
    453 
    454     ;; @todo AMD syscall
    455 
    456428    ; Restore FPU if guest has used it.
    457429    ; Using fxrstor should ensure that we're not causing unwanted exception on the host.
     
    487459
    488460    ; Control registers.
    489     ; Would've liked to have these highere up in case of crashes, but
     461    ; Would've liked to have these higher up in case of crashes, but
    490462    ; the fpu stuff must be done before we restore cr0.
    491463    mov     ecx, [edx + CPUMCPU.Host.cr4]
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