]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/ResetVector/Ia32/32FlatTo64Flat.asm
Add initial version of Open Virtual Machine Firmware (OVMF) platform.
[mirror_edk2.git] / OvmfPkg / ResetVector / Ia32 / 32FlatTo64Flat.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2008, Intel Corporation
4 ; All rights reserved. This program and the accompanying materials
5 ; are licensed and made available under the terms and conditions of the BSD License
6 ; which accompanies this distribution. The full text of the license may be found at
7 ; http://opensource.org/licenses/bsd-license.php
8 ;
9 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 ;
12 ; Module Name:
13 ;
14 ; 32FlatTo64Flat.asm
15 ;
16 ; Abstract:
17 ;
18 ; Transition from 32 bit flat protected mode into 64 bit flat protected mode
19 ;
20 ;------------------------------------------------------------------------------
21
22 BITS 32
23
24 Transition32FlatTo64Flat:
25
26 mov eax, ((ADDR_OF_START_OF_RESET_CODE & ~0xfff) - 0x1000)
27 mov cr3, eax
28
29 mov eax, cr4
30 bts eax, 5 ; enable PAE
31 mov cr4, eax
32
33 mov ecx, 0xc0000080
34 rdmsr
35 bts eax, 8 ; set LME
36 wrmsr
37
38 mov eax, cr0
39 bts eax, 31 ; set PG
40 mov cr0, eax ; enable paging
41
42 jmp LINEAR_CODE64_SEL:ADDR_OF(jumpTo64BitAndLandHere)
43 BITS 64
44 jumpTo64BitAndLandHere:
45
46 writeToSerialPort '6'
47 writeToSerialPort '4'
48 writeToSerialPort ' '
49
50 OneTimeCallRet Transition32FlatTo64Flat
51