LegacyandAMD64.mac revision 2299cba575fbc73ad168cdc9ce18251897ef0297
a7e71c7a198965d270939f08bf05e961dc4e3270vboxsync; VMM - World Switchers, 32Bit to AMD64.
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; Clara, CA 95054 USA or visit http://www.sun.com if you need
%include "VBox/asmdefs.mac"
%include "VBox/x86.mac"
%include "VBox/cpum.mac"
%include "VBox/stam.mac"
%include "VBox/vm.mac"
%include "CPUMInternal.mac"
%include "VMMSwitcher/VMMSwitcher.mac"
FIXUP FIX_HC_VM_OFF, 1, VM.StatSwitcherToGC
FIXUP FIX_HC_VM_OFF, 1, VM.StatSwitcherToHC
mov [edx + CPUMCPU.Host.ebx], ebx
mov [edx + CPUMCPU.Host.edi], edi
mov [edx + CPUMCPU.Host.esi], esi
mov [edx + CPUMCPU.Host.esp], esp
mov [edx + CPUMCPU.Host.ebp], ebp
mov [edx + CPUMCPU.Host.ds], ds
mov [edx + CPUMCPU.Host.es], es
mov [edx + CPUMCPU.Host.fs], fs
mov [edx + CPUMCPU.Host.gs], gs
mov [edx + CPUMCPU.Host.ss], ss
sldt [edx + CPUMCPU.Host.ldtr]
sidt [edx + CPUMCPU.Host.idtr]
sgdt [edx + CPUMCPU.Host.gdtr]
str [edx + CPUMCPU.Host.tr]
mov [edx + CPUMCPU.Host.cr0], eax
mov [edx + CPUMCPU.Host.cr3], eax
mov [edx + CPUMCPU.Host.cr4], eax
mov [ebx + CPUMCPU.Host.efer], eax
mov [ebx + CPUMCPU.Host.efer + 4], edx
lgdt [edx + CPUM.Hyper.gdtr]
mov eax, [rdx + CPUM.Hyper.esp]
mov [rdx + CPUM.Hyper.lss_esp], eax
lss esp, [rdx + CPUM.Hyper.lss_esp]
mov r9, [rdx + CPUM.Hyper.eip]
mov esi, [rdx + CPUMCPU.fUseFlags] ; esi == use flags.
fxrstor [rdx + CPUMCPU.Guest.fpu]
and dword [rdx + CPUMCPU.fUseFlags], ~CPUM_SYNC_FPU_STATE
mov rax, qword [rdx + CPUMCPU.Guest.dr + 0*8]
mov rax, qword [rdx + CPUMCPU.Guest.dr + 1*8]
mov rax, qword [rdx + CPUMCPU.Guest.dr + 2*8]
mov rax, qword [rdx + CPUMCPU.Guest.dr + 3*8]
mov rax, qword [rdx + CPUMCPU.Guest.dr + 6*8]
and dword [rdx + CPUMCPU.fUseFlags], ~CPUM_SYNC_DEBUG_STATE
lea rsi, [rdx + CPUMCPU.Guest.fpu]
mov [rdx + CPUMCPU.u32RetCode], eax
mov esi, [edx + CPUMCPU.Host.cr3]
mov eax, [ebx + CPUMCPU.Host.efer]
mov edx, [ebx + CPUMCPU.Host.efer + 4]
lgdt [edx + CPUMCPU.Host.gdtr]
lidt [edx + CPUMCPU.Host.idtr]
movzx eax, word [edx + CPUMCPU.Host.tr] ; eax <- TR
ltr word [edx + CPUMCPU.Host.tr]
lldt [edx + CPUMCPU.Host.ldtr]
mov eax, [edx + CPUMCPU.Host.ds]
mov eax, [edx + CPUMCPU.Host.es]
mov eax, [edx + CPUMCPU.Host.fs]
mov eax, [edx + CPUMCPU.Host.gs]
lss esp, [edx + CPUMCPU.Host.esp]
mov ecx, [edx + CPUMCPU.Host.cr4]
mov ecx, [edx + CPUMCPU.Host.cr0]
;mov ecx, [edx + CPUMCPU.Host.cr2] ; assumes this is waste of time.
mov edi, [edx + CPUMCPU.Host.edi]
mov esi, [edx + CPUMCPU.Host.esi]
mov ebx, [edx + CPUMCPU.Host.ebx]
mov ebp, [edx + CPUMCPU.Host.ebp]
mov eax, [edx + CPUMCPU.u32RetCode]
at VMMSWITCHERDEF.pvCode, RTCCPTR_DEF NAME(Start)
at VMMSWITCHERDEF.pvFixups, RTCCPTR_DEF NAME(Fixups)
at VMMSWITCHERDEF.pszDesc, RTCCPTR_DEF NAME(Description)
at VMMSWITCHERDEF.pfnRelocate, RTCCPTR_DEF NAME(Relocate)
at VMMSWITCHERDEF.enmType, dd SWITCHER_TYPE
at VMMSWITCHERDEF.cbCode, dd NAME(End) - NAME(Start)
at VMMSWITCHERDEF.offR0HostToGuest, dd NAME(vmmR0HostToGuest) - NAME(Start)
at VMMSWITCHERDEF.offGCGuestToHost, dd NAME(vmmGCGuestToHost) - NAME(Start)
at VMMSWITCHERDEF.offGCCallTrampoline, dd NAME(vmmGCCallTrampoline) - NAME(Start)
at VMMSWITCHERDEF.offGCGuestToHostAsm, dd NAME(VMMGCGuestToHostAsm) - NAME(Start)
at VMMSWITCHERDEF.offGCGuestToHostAsmHyperCtx, dd NAME(VMMGCGuestToHostAsmHyperCtx)- NAME(Start)
at VMMSWITCHERDEF.offGCGuestToHostAsmGuestCtx, dd NAME(VMMGCGuestToHostAsmGuestCtx)- NAME(Start)
at VMMSWITCHERDEF.offHCCode0, dd 0
at VMMSWITCHERDEF.cbHCCode0, dd NAME(IDEnterTarget) - NAME(Start)
at VMMSWITCHERDEF.offHCCode1, dd NAME(ICExitTarget) - NAME(Start)
at VMMSWITCHERDEF.cbHCCode1, dd NAME(End) - NAME(ICExitTarget)
at VMMSWITCHERDEF.offIDCode0, dd NAME(IDEnterTarget) - NAME(Start)
at VMMSWITCHERDEF.cbIDCode0, dd NAME(ICEnterTarget) - NAME(IDEnterTarget)
at VMMSWITCHERDEF.offIDCode1, dd NAME(IDExitTarget) - NAME(Start)
at VMMSWITCHERDEF.cbIDCode1, dd NAME(ICExitTarget) - NAME(Start)
at VMMSWITCHERDEF.offGCCode, dd 0
at VMMSWITCHERDEF.cbGCCode, dd 0