]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/ResetVector/Vtf0/Ia32/32FlatTo64Flat.asm
Adding files from OvmfPkg to common location. This is so multiple packages can use...
[mirror_edk2.git] / UefiCpuPkg / ResetVector / Vtf0 / Ia32 / 32FlatTo64Flat.asm
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/32FlatTo64Flat.asm b/UefiCpuPkg/ResetVector/Vtf0/Ia32/32FlatTo64Flat.asm
new file mode 100644 (file)
index 0000000..a97f9cc
--- /dev/null
@@ -0,0 +1,46 @@
+;------------------------------------------------------------------------------\r
+; @file\r
+; Transition from 32 bit flat protected mode into 64 bit flat protected mode\r
+;\r
+; Copyright (c) 2008 - 2009, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+BITS    32\r
+\r
+;\r
+; Modified:  EAX\r
+;\r
+Transition32FlatTo64Flat:\r
+\r
+    mov     eax, ((ADDR_OF_START_OF_RESET_CODE & ~0xfff) - 0x1000)\r
+    mov     cr3, eax\r
+\r
+    mov     eax, cr4\r
+    bts     eax, 5                      ; enable PAE\r
+    mov     cr4, eax                    \r
+\r
+    mov     ecx, 0xc0000080\r
+    rdmsr\r
+    bts     eax, 8                      ; set LME\r
+    wrmsr\r
+\r
+    mov     eax, cr0\r
+    bts     eax, 31                     ; set PG\r
+    mov     cr0, eax                    ; enable paging\r
+\r
+    jmp     LINEAR_CODE64_SEL:ADDR_OF(jumpTo64BitAndLandHere)\r
+BITS    64\r
+jumpTo64BitAndLandHere:\r
+\r
+    debugShowPostCode POSTCODE_64BIT_MODE\r
+\r
+    OneTimeCallRet Transition32FlatTo64Flat\r
+\r