1 ;------------------------------------------------------------------------------
2 ; IA32 assembly file for AP startup vector.
4 ; Copyright (c) 2009, Intel Corporation
5 ; All rights reserved. This program and the accompanying materials
6 ; are licensed and made available under the terms and conditions of the BSD License
7 ; which accompanies this distribution. The full text of the license may be found at
8 ; http://opensource.org/licenses/bsd-license.php
10 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 ;------------------------------------------------------------------------------
19 include AsmInclude.inc
20 ;-------------------------------------------------------------------------------------
21 FJMP32 MACRO Selector, Offset
25 DD Offset ; 32-bit offset
26 DW Selector ; 16-bit selector
29 ;-------------------------------------------------------------------------------------
30 ;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
31 ;procedure serializes all the AP processors through an Init sequence. It must be
32 ;noted that APs arrive here very raw...ie: real mode, no stack.
33 ;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
35 ;-------------------------------------------------------------------------------------
36 ;RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
38 RendezvousFunnelProc PROC near C PUBLIC
39 RendezvousFunnelProcStart::
42 ; At this point CS = 0x(vv00) and ip= 0x0.
44 db 8ch, 0c8h ; mov ax, cs
45 db 8eh, 0d8h ; mov ds, ax
46 db 8eh, 0c0h ; mov es, ax
47 db 8eh, 0d0h ; mov ss, ax
48 db 33h, 0c0h ; xor ax, ax
49 db 8eh, 0e0h ; mov fs, ax
50 db 8eh, 0e8h ; mov gs, ax
52 ; Switch to flat mode.
55 dw BufferStart ; mov si, BufferStart
56 db 66h, 8Bh, 0Ch ; mov ecx,dword ptr [si] ; ECX is keeping the start address of wakeup buffer
60 dw GdtrProfile ; mov si, GdtrProfile
62 db 2Eh,0Fh, 01h, 14h ; lgdt fword ptr cs:[si]
64 db 33h, 0C0h ; xor ax, ax
65 db 8Eh, 0D8h ; mov ds, ax
66 db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Get control register 0
67 db 66h, 83h, 0C8h, 01h ; or eax, 000000001h ; Set PE bit (bit #0)
68 db 0Fh, 22h, 0C0h ; mov cr0, eax
72 FJMP32 010h,0h ; Far jmp using code segment descriptor
74 ProtectedModeStart:: ; protected mode entry point
81 mov ss, ax ; Flat mode setup.
88 xchg byte ptr [edi], al
96 mov eax, dword ptr [edi]
99 add eax, dword ptr [edi]
101 mov dword ptr [edi], eax
106 add edi, LockLocation
107 xchg byte ptr [edi], al
113 add edi, RendezvousProc
114 mov ebx, dword ptr [edi]
118 call ebx ; Call C function
126 RendezvousFunnelProc ENDP
127 RendezvousFunnelProcEnd::
128 ;-------------------------------------------------------------------------------------
129 ; AsmGetAddressMap (&AddressMap);
130 ;-------------------------------------------------------------------------------------
131 AsmGetAddressMap PROC near C PUBLIC
136 mov ebx, dword ptr [ebp+24h]
137 mov dword ptr [ebx], RendezvousFunnelProcStart
138 mov dword ptr [ebx+4h], ProtectedModeStart - RendezvousFunnelProcStart
139 mov dword ptr [ebx+8h], FLAT32_JUMP - RendezvousFunnelProcStart
140 mov dword ptr [ebx+0ch], 0
141 mov dword ptr [ebx+10h], 0
142 mov dword ptr [ebx+14h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
146 AsmGetAddressMap ENDP