]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s
d46d7924770e5bec2d15f4ca023cc0b483cc10c4
[mirror_edk2.git] / IntelFsp2Pkg / Library / SecFspSecPlatformLibNull / Ia32 / Flat32.s
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
4 # 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 # Abstract:
13 #
14 # This is the code that goes from real-mode to protected mode.
15 # It consumes the reset vector, configures the stack.
16 #
17 #------------------------------------------------------------------------------
18
19
20 #
21 # Contrary to the name, this file contains 16 bit code as well.
22 #
23 .text
24
25 ASM_GLOBAL ASM_PFX(SecPlatformInit)
26 ASM_PFX(SecPlatformInit):
27 movd %mm7, %esi # restore ESP from MM7
28 jmp *%esi
29
30 #----------------------------------------------------------------------------
31 #
32 # Procedure: ProtectedModeEntryPoint
33 #
34 # Input: Executing in 32 Bit Protected (flat) mode
35 # cs: 0-4GB
36 # ds: 0-4GB
37 # es: 0-4GB
38 # fs: 0-4GB
39 # gs: 0-4GB
40 # ss: 0-4GB
41 #
42 # Output: This function never returns
43 #
44 # Destroys:
45 # ecx
46 # edi
47 # esi
48 # esp
49 #
50 # Description:
51 # Perform any essential early platform initilaisation
52 # Setup a stack
53 #
54 #----------------------------------------------------------------------------
55 ProtectedModeEntryPoint:
56 #
57 # Dummy function. Consume 2 API to make sure they can be linked.
58 #
59 movl ASM_PFX(TempRamInitApi), %eax
60 #
61 # Should never return
62 #
63 jmp . #'$'
64
65 #
66 # ROM-based Global-Descriptor Table for the PEI Phase
67 #
68 .align 16
69 #
70 # GDT[0]: 000h: Null entry, never used.
71 #
72 .equ NULL_SEL, . - GDT_BASE # Selector [0]
73 GDT_BASE:
74 BootGdtTable:
75 .long 0
76 .long 0
77 #
78 # Linear code segment descriptor
79 #
80 .equ LINEAR_CODE_SEL, . - GDT_BASE # Selector [08h]
81 .word 0xFFFF # limit 0FFFFh
82 .word 0 # base 0
83 .byte 0
84 .byte 0x9B # present, ring 0, data, expand-up, not-writable
85 .byte 0xCF # page-granular, 32-bit
86 .byte 0
87 #
88 # System data segment descriptor
89 #
90 .equ SYS_DATA_SEL, . - GDT_BASE # Selector [010h]
91 .word 0xFFFF # limit 0FFFFh
92 .word 0 # base 0
93 .byte 0
94 .byte 0x93 # present, ring 0, data, expand-up, not-writable
95 .byte 0xCF # page-granular, 32-bit
96 .byte 0
97
98 .equ GDT_SIZE, . - BootGdtTable # Size, in bytes
99
100 #
101 # GDT Descriptor
102 #
103 GdtDesc: # GDT descriptor
104 .word GDT_SIZE - 1
105 .long BootGdtTable
106
107 ProtectedModeEntryLinearAddress:
108 ProtectedModeEntryLinearOffset:
109 .long ProtectedModeEntryPoint
110 .word LINEAR_CODE_SEL