LegacyandAMD64.mac revision ee2aeb0cd5535f38ee098713a9cebb74dc1c2e30
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync; VMM - World Switchers, 32Bit to AMD64.
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync; Copyright (C) 2006-2007 Sun Microsystems, Inc.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; available from http://www.virtualbox.org. This file is free software;
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; Clara, CA 95054 USA or visit http://www.sun.com if you need
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; additional information or have any questions.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync;%define DEBUG_STUFF 1
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync;%define STRICT_IF 1
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync;*******************************************************************************
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync;* Defined Constants And Macros *
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync;*******************************************************************************
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync;*******************************************************************************
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync;* Header Files *
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync;*******************************************************************************
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync; Start the fixup records
4d939f327b6fe2b8201ab00e2d7e7d12b6d47d23vboxsync; We collect the fixups in the .data section as we go along
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]
pop dword [edx + CPUMCPU.Host.eflags]
mov esi, [edx + CPUMCPU.fUseFlags] ; esi == use flags.
and esi, ~CPUM_USED_FPU ; Clear CPUM_USED_* flags. ;;@todo FPU check can be optimized to use cr0 flags!
mov [edx + CPUMCPU.fUseFlags], esi
mov [edx + CPUMCPU.Host.cr0], eax
mov [edx + CPUMCPU.Host.cr3], eax
mov [edx + CPUMCPU.Host.cr4], eax
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 eax, [rdx + r8 + CPUM.Hyper.eip]
;; mov [rdx + CPUMCPU.u32RetCode], eax
mov esi, [edx + CPUMCPU.Host.cr3]
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]
push dword [edx + CPUMCPU.Host.eflags]
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