1 ;------------------------------------------------------------------------------ ;
2 ; Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
3 ; This program and the accompanying materials
4 ; are licensed and made available under the terms and conditions of the BSD License
5 ; which accompanies this distribution. The full text of the license may be found at
6 ; http://opensource.org/licenses/bsd-license.php.
8 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 ; This is the assembly code for MP support
19 ;-------------------------------------------------------------------------------
28 ;-------------------------------------------------------------------------------------
29 ;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
30 ;procedure serializes all the AP processors through an Init sequence. It must be
31 ;noted that APs arrive here very raw...ie: real mode, no stack.
32 ;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
34 ;-------------------------------------------------------------------------------------
35 RendezvousFunnelProc PROC PUBLIC
36 RendezvousFunnelProcStart::
37 ; At this point CS = 0x(vv00) and ip= 0x0.
38 ; Save BIST information to ebp firstly
39 db 66h, 08bh, 0e8h ; mov ebp, eax ; save BIST information
41 db 8ch,0c8h ; mov ax,cs
42 db 8eh,0d8h ; mov ds,ax
43 db 8eh,0c0h ; mov es,ax
44 db 8eh,0d0h ; mov ss,ax
45 db 33h,0c0h ; xor ax,ax
46 db 8eh,0e0h ; mov fs,ax
47 db 8eh,0e8h ; mov gs,ax
49 db 0BEh ; opcode of mov si, mem16
50 dw BufferStartLocation ; mov si, BufferStartLocation
51 db 66h, 8Bh, 1Ch ; mov ebx,dword ptr [si]
53 db 0BFh ; opcode of mov di, mem16
54 dw PmodeOffsetLocation ; mov di, PmodeOffsetLocation
55 db 66h, 8Bh, 05h ; mov eax,dword ptr [di]
56 db 8Bh, 0F8h ; mov di, ax
57 db 83h, 0EFh,06h ; sub di, 06h
58 db 66h, 03h, 0C3h ; add eax, ebx
59 db 66h, 89h, 05h ; mov dword ptr [di],eax
61 db 0BEh ; opcode of mov si, mem16
62 dw GdtrLocation ; mov si, GdtrLocation
64 db 2Eh, 0Fh, 01h, 14h ; lgdt fword ptr cs:[si]
67 dw IdtrLocation ; mov si, IdtrLocation
69 db 2Eh,0Fh, 01h, 1Ch ; lidt fword ptr cs:[si]
71 db 33h, 0C0h ; xor ax, ax
72 db 8Eh, 0D8h ; mov ds, ax
74 db 0Fh, 20h, 0C0h ; mov eax, cr0 ;Get control register 0
75 db 66h, 83h, 0C8h, 03h ; or eax, 000000003h ;Set PE bit (bit #0) & MP
76 db 0Fh, 22h, 0C0h ; mov cr0, eax
78 db 66h, 67h, 0EAh ; far jump
80 dw PROTECT_MODE_CS ; 16-bit selector
82 Flat32Start:: ; protected mode entry point
83 mov ax, PROTECT_MODE_DS
93 mov eax, NotVacantFlag
96 xchg dword ptr [edi], eax
97 cmp eax, NotVacantFlag
101 add edi, NumApsExecutingLoction
103 mov ebx, dword ptr [edi]
107 add edi, StackSizeLocation
108 mov eax, dword ptr [edi]
110 add edi, StackStartAddressLocation
111 add eax, dword ptr [edi]
113 mov dword ptr [edi], eax
118 add edi, LockLocation
119 xchg dword ptr [edi], eax
122 push ebp ; push BIST data at top of AP stack
123 xor ebp, ebp ; clear ebp for call stack trace
128 push ebx ; Push NumApsExecuting
130 add eax, LockLocation
131 push eax ; push address of exchange info data buffer
134 add edi, ApProcedureLocation
135 mov eax, dword ptr [edi]
137 call eax ; invoke C function
139 jmp $ ; never reach here
141 RendezvousFunnelProc ENDP
142 RendezvousFunnelProcEnd::
145 AsmInitializeGdt PROC near C PUBLIC
149 mov edi, [ebp + 8] ; Load GDT register
151 mov ax,cs ; Get the selector data from our code image
153 lgdt FWORD PTR es:[edi] ; and update the GDTR
156 lea eax, SetCodeSelectorFarJump
159 SetCodeSelectorFarJump:
160 mov ax, PROTECT_MODE_DS ; Update the Base for the new selectors, too
170 AsmInitializeGdt ENDP