]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspWrapperPkg/Library/SecPeiFspPlatformSecLibSample/Ia32/PeiCoreEntry.asm
e322b02e0a225d8e66d4d430ca47a42112e69da5
[mirror_edk2.git] / IntelFspWrapperPkg / Library / SecPeiFspPlatformSecLibSample / Ia32 / PeiCoreEntry.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
5 ;
6 ; Module Name:
7 ;
8 ; PeiCoreEntry.asm
9 ;
10 ; Abstract:
11 ;
12 ; Find and call SecStartup
13 ;
14 ;------------------------------------------------------------------------------
15
16 .686p
17 .xmm
18 .model flat, c
19 .code
20
21 EXTRN SecStartup:NEAR
22 EXTRN PlatformInit:NEAR
23
24 CallPeiCoreEntryPoint PROC PUBLIC
25 ;
26 ; Obtain the hob list pointer
27 ;
28 mov eax, [esp+4]
29 ;
30 ; Obtain the stack information
31 ; ECX: start of range
32 ; EDX: end of range
33 ;
34 mov ecx, [esp+8]
35 mov edx, [esp+0Ch]
36
37 ;
38 ; Platform init
39 ;
40 pushad
41 push edx
42 push ecx
43 push eax
44 call PlatformInit
45 pop eax
46 pop eax
47 pop eax
48 popad
49
50 ;
51 ; Set stack top pointer
52 ;
53 mov esp, edx
54
55 ;
56 ; Push the hob list pointer
57 ;
58 push eax
59
60 ;
61 ; Save the value
62 ; ECX: start of range
63 ; EDX: end of range
64 ;
65 mov ebp, esp
66 push ecx
67 push edx
68
69 ;
70 ; Push processor count to stack first, then BIST status (AP then BSP)
71 ;
72 mov eax, 1
73 cpuid
74 shr ebx, 16
75 and ebx, 0000000FFh
76 cmp bl, 1
77 jae PushProcessorCount
78
79 ;
80 ; Some processors report 0 logical processors. Effectively 0 = 1.
81 ; So we fix up the processor count
82 ;
83 inc ebx
84
85 PushProcessorCount:
86 push ebx
87
88 ;
89 ; We need to implement a long-term solution for BIST capture. For now, we just copy BSP BIST
90 ; for all processor threads
91 ;
92 xor ecx, ecx
93 mov cl, bl
94 PushBist:
95 movd eax, mm0
96 push eax
97 loop PushBist
98
99 ; Save Time-Stamp Counter
100 movd eax, mm5
101 push eax
102
103 movd eax, mm6
104 push eax
105
106 ;
107 ; Pass entry point of the PEI core
108 ;
109 mov edi, 0FFFFFFE0h
110 push DWORD PTR ds:[edi]
111
112 ;
113 ; Pass BFV into the PEI Core
114 ;
115 mov edi, 0FFFFFFFCh
116 push DWORD PTR ds:[edi]
117
118 ;
119 ; Pass stack size into the PEI Core
120 ;
121 mov ecx, [ebp - 4]
122 mov edx, [ebp - 8]
123 push ecx ; RamBase
124
125 sub edx, ecx
126 push edx ; RamSize
127
128 ;
129 ; Pass Control into the PEI Core
130 ;
131 call SecStartup
132 CallPeiCoreEntryPoint ENDP
133
134 END