]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/ResetVector/Ia16/16RealTo32Flat.asm
Add missing EFIAPI instances on several functions.
[mirror_edk2.git] / OvmfPkg / ResetVector / Ia16 / 16RealTo32Flat.asm
CommitLineData
49ba9447 1;------------------------------------------------------------------------------\r
2;\r
3; Copyright (c) 2008, Intel Corporation\r
4; All rights reserved. This program and the accompanying materials\r
5; are licensed and made available under the terms and conditions of the BSD License\r
6; which accompanies this distribution. The full text of the license may be found at\r
7; http://opensource.org/licenses/bsd-license.php\r
8;\r
9; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11;\r
12; Module Name:\r
13;\r
14; 16RealTo32Flat.asm\r
15;\r
16; Abstract:\r
17;\r
18; Transition from 16 bit real mode into 32 bit flat protected mode\r
19;\r
20;------------------------------------------------------------------------------\r
21\r
22%define SEC_DEFAULT_CR0 0x40000023\r
23%define SEC_DEFAULT_CR4 0x640\r
24\r
25BITS 16\r
26\r
27to32BitFlat:\r
28\r
29 writeToSerialPort '1'\r
30 writeToSerialPort '6'\r
31 writeToSerialPort ' '\r
32\r
33 cli\r
34\r
35 mov bx, 0xf000\r
36 mov ds, bx\r
37\r
38 mov bx, ADDR16_OF(gdtr)\r
39\r
40o32 lgdt [bx]\r
41\r
42 mov eax, SEC_DEFAULT_CR0\r
43 mov cr0, eax\r
44\r
45; mov eax, cr0\r
46; or al, 1\r
47; mov cr0, eax\r
48\r
49 jmp LINEAR_CODE_SEL:dword ADDR_OF(jumpTo32BitAndLandHere)\r
50BITS 32\r
51jumpTo32BitAndLandHere:\r
52\r
53 mov eax, SEC_DEFAULT_CR4\r
54 mov cr4, eax\r
55\r
56 writeToSerialPort '3'\r
57 writeToSerialPort '2'\r
58 writeToSerialPort ' '\r
59\r
60 mov ax, LINEAR_SEL\r
61 mov ds, ax\r
62 mov es, ax\r
63 mov fs, ax\r
64 mov gs, ax\r
65 mov ss, ax\r
66\r
67 jmp TransitionFrom16RealTo32FlatComplete\r
68\r
69ALIGN 2\r
70\r
71gdtr:\r
72 dw GDT_END - GDT_BASE - 1 ; GDT limit\r
73 dd ADDR_OF(GDT_BASE)\r
74\r
75ALIGN 16\r
76\r
77GDT_BASE:\r
78; null descriptor\r
79NULL_SEL equ $-GDT_BASE\r
80 dw 0 ; limit 15:0\r
81 dw 0 ; base 15:0\r
82 db 0 ; base 23:16\r
83 db 0 ; type\r
84 db 0 ; limit 19:16, flags\r
85 db 0 ; base 31:24\r
86\r
87; linear data segment descriptor\r
88LINEAR_SEL equ $-GDT_BASE\r
89 dw 0FFFFh ; limit 0xFFFFF\r
90 dw 0 ; base 0\r
91 db 0\r
92 db 092h ; present, ring 0, data, expand-up, writable\r
93 db 0CFh ; page-granular, 32-bit\r
94 db 0\r
95\r
96; linear code segment descriptor\r
97LINEAR_CODE_SEL equ $-GDT_BASE\r
98 dw 0FFFFh ; limit 0xFFFFF\r
99 dw 0 ; base 0\r
100 db 0\r
101 db 09Ah ; present, ring 0, data, expand-up, writable\r
102 db 0CFh ; page-granular, 32-bit\r
103 db 0\r
104\r
105; system data segment descriptor\r
106SYS_DATA_SEL equ $-GDT_BASE\r
107 dw 0FFFFh ; limit 0xFFFFF\r
108 dw 0 ; base 0\r
109 db 0\r
110 db 092h ; present, ring 0, data, expand-up, writable\r
111 db 0CFh ; page-granular, 32-bit\r
112 db 0\r
113\r
114; system code segment descriptor\r
115SYS_CODE_SEL equ $-GDT_BASE\r
116 dw 0FFFFh ; limit 0xFFFFF\r
117 dw 0 ; base 0\r
118 db 0\r
119 db 09Ah ; present, ring 0, data, expand-up, writable\r
120 db 0CFh ; page-granular, 32-bit\r
121 db 0\r
122\r
123; spare segment descriptor\r
124LINEAR_CODE64_SEL equ $-GDT_BASE\r
125 DW -1 ; LimitLow\r
126 DW 0 ; BaseLow\r
127 DB 0 ; BaseMid\r
128 DB 9bh\r
129 DB 0afh ; LimitHigh (CS.L=1, CS.D=0)\r
130 DB 0 ; BaseHigh\r
131\r
132; spare segment descriptor\r
133SPARE4_SEL equ $-GDT_BASE\r
134 dw 0 ; limit 0xFFFFF\r
135 dw 0 ; base 0\r
136 db 0\r
137 db 0 ; present, ring 0, data, expand-up, writable\r
138 db 0 ; page-granular, 32-bit\r
139 db 0\r
140\r
141; spare segment descriptor\r
142SPARE5_SEL equ $-GDT_BASE\r
143 dw 0 ; limit 0xFFFFF\r
144 dw 0 ; base 0\r
145 db 0\r
146 db 0 ; present, ring 0, data, expand-up, writable\r
147 db 0 ; page-granular, 32-bit\r
148 db 0\r
149\r
150GDT_END:\r
151\r