1 #------------------------------------------------------------------------------
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.
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.
14 # This is the code that goes from real-mode to protected mode.
15 # It consumes the reset vector, configures the stack.
17 #------------------------------------------------------------------------------
21 # Contrary to the name, this file contains 16 bit code as well.
25 ASM_GLOBAL ASM_PFX(SecPlatformInit)
26 ASM_PFX(SecPlatformInit):
27 movd %mm7, %esi # restore ESP from MM7
30 #----------------------------------------------------------------------------
32 # Procedure: ProtectedModeEntryPoint
34 # Input: Executing in 32 Bit Protected (flat) mode
42 # Output: This function never returns
51 # Perform any essential early platform initilaisation
54 #----------------------------------------------------------------------------
55 ProtectedModeEntryPoint:
57 # Dummy function. Consume 2 API to make sure they can be linked.
59 movl ASM_PFX(TempRamInitApi), %eax
66 # ROM-based Global-Descriptor Table for the PEI Phase
70 # GDT[0]: 000h: Null entry, never used.
72 .equ NULL_SEL, . - GDT_BASE # Selector [0]
78 # Linear code segment descriptor
80 .equ LINEAR_CODE_SEL, . - GDT_BASE # Selector [08h]
81 .word 0xFFFF # limit 0FFFFh
84 .byte 0x9B # present, ring 0, data, expand-up, not-writable
85 .byte 0xCF # page-granular, 32-bit
88 # System data segment descriptor
90 .equ SYS_DATA_SEL, . - GDT_BASE # Selector [010h]
91 .word 0xFFFF # limit 0FFFFh
94 .byte 0x93 # present, ring 0, data, expand-up, not-writable
95 .byte 0xCF # page-granular, 32-bit
98 .equ GDT_SIZE, . - BootGdtTable # Size, in bytes
103 GdtDesc: # GDT descriptor
107 ProtectedModeEntryLinearAddress:
108 ProtectedModeEntryLinearOffset:
109 .long ProtectedModeEntryPoint
110 .word LINEAR_CODE_SEL