1 ;------------------------------------------------------------------------------
3 ; Main routine of the pre-SEC code up through the jump into SEC
5 ; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
6 ; SPDX-License-Identifier: BSD-2-Clause-Patent
8 ;------------------------------------------------------------------------------
14 ; Modified: EBX, ECX, EDX, EBP
16 ; @param[in,out] RAX/EAX Initial value of the EAX register
17 ; (BIST: Built-in Self Test)
18 ; @param[in,out] DI 'BP': boot-strap processor, or
19 ; 'AP': application processor
20 ; @param[out] RBP/EBP Address of Boot Firmware Volume (BFV)
21 ; @param[out] DS Selector allowing flat access to all addresses
22 ; @param[out] ES Selector allowing flat access to all addresses
23 ; @param[out] FS Selector allowing flat access to all addresses
24 ; @param[out] GS Selector allowing flat access to all addresses
25 ; @param[out] SS Selector allowing flat access to all addresses
27 ; @return None This routine jumps to SEC and does not return
30 OneTimeCall EarlyInit16
33 ; Transition the processor from 16-bit real mode to 32-bit flat mode
35 OneTimeCall TransitionFromReal16To32BitFlat
40 ; Search for the Boot Firmware Volume (BFV)
42 OneTimeCall Flat32SearchForBfvBase
49 ; Search for the SEC entry point
51 OneTimeCall Flat32SearchForSecEntryPoint
54 ; ESI - SEC Core entry point
61 ; Restore initial EAX value into the EAX register
66 ; Jump to the 32-bit SEC entry point
73 ; Transition the processor from 32-bit flat mode to 64-bit flat mode
75 OneTimeCall Transition32FlatTo64Flat
80 ; Some values were calculated in 32-bit mode. Make sure the upper
81 ; 32-bits of 64-bit registers are zero for these values.
83 mov rax, 0x00000000ffffffff
89 ; RSI - SEC Core entry point
94 ; Restore initial EAX value into the RAX register
99 ; Jump to the 64-bit SEC entry point