1 #------------------------------------------------------------------------------
2 # IA32 assembly file for AP startup vector.
4 # Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
5 # 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 #------------------------------------------------------------------------------
16 .equ NotVacantFlag, 0xff
18 .equ LockLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart
19 .equ StackStart, LockLocation + 0x04
20 .equ StackSize, LockLocation + 0x08
21 .equ RendezvousProc, LockLocation + 0x0C
22 .equ GdtrProfile, LockLocation + 0x10
23 .equ BufferStart, LockLocation + 0x18
25 #-------------------------------------------------------------------------------------
26 #RendezvousFunnelProc procedure follows. All APs execute their procedure. This
27 #procedure serializes all the AP processors through an Init sequence. It must be
28 #noted that APs arrive here very raw...ie: real mode, no stack.
29 #ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
31 #-------------------------------------------------------------------------------------
32 #RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
34 ASM_GLOBAL ASM_PFX(RendezvousFunnelProc)
35 ASM_PFX(RendezvousFunnelProc):
36 RendezvousFunnelProcStart:
39 # At this point CS = 0x(vv00) and ip= 0x0.
41 .byte 0x8c,0xc8 # mov ax, cs
42 .byte 0x8e,0xd8 # mov ds, ax
43 .byte 0x8e,0xc0 # mov es, ax
44 .byte 0x8e,0xd0 # mov ss, ax
45 .byte 0x33,0xc0 # xor ax, ax
46 .byte 0x8e,0xe0 # mov fs, ax
47 .byte 0x8e,0xe8 # mov gs, ax
49 # Switch to flat mode.
53 .byte 0x66,0x8B,0xC # mov ecx,dword ptr [si] ; ECX is keeping the start address of wakeup buffer
59 .byte 0x2E,0xF,0x1,0x14 # lgdt fword ptr cs:[si]
61 .byte 0x33,0xC0 # xor ax, ax
62 .byte 0x8E,0xD8 # mov ds, ax
63 .byte 0xF,0x20,0xC0 # mov eax, cr0 ; Get control register 0
64 .byte 0x66,0x83,0xC8,0x1 # or eax, 000000001h ; Set PE bit (bit #0)
65 .byte 0xF,0x22,0xC0 # mov cr0, eax
77 ProtectedModeStart: # protected mode entry point
89 movw %ax,%ss # Flat mode setup.
93 addl $LockLocation, %edi
94 movb $NotVacantFlag, %al
97 cmpb $NotVacantFlag, %al
102 addl $StackSize, %edi
105 addl $StackStart, %edi
111 movb $VacantFlag, %al
113 addl $LockLocation, %edi
120 addl $RendezvousProc, %edi
125 call *%ebx # Call C function
135 RendezvousFunnelProcEnd:
136 #-------------------------------------------------------------------------------------
137 # AsmGetAddressMap (&AddressMap);
138 #-------------------------------------------------------------------------------------
139 ASM_GLOBAL ASM_PFX(AsmGetAddressMap)
140 ASM_PFX(AsmGetAddressMap):
145 movl 0x24(%ebp), %ebx
146 movl $RendezvousFunnelProcStart, (%ebx)
147 movl $(ProtectedModeStart - RendezvousFunnelProcStart), 0x4(%ebx)
148 movl $(FLAT32_JUMP - RendezvousFunnelProcStart), 0x8(%ebx)
151 movl $(RendezvousFunnelProcEnd - RendezvousFunnelProcStart), 0x14(%ebx)