1 #------------------------------------------------------------------------------
2 # IA32 assembly file for AP startup vector.
4 # Copyright (c) 2009 - 2010, 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]
64 .byte 0x2E,0xF,0x1,0x1C # lidt fword ptr cs:[si]
66 .byte 0x33,0xC0 # xor ax, ax
67 .byte 0x8E,0xD8 # mov ds, ax
68 .byte 0xF,0x20,0xC0 # mov eax, cr0 ; Get control register 0
69 .byte 0x66,0x83,0xC8,0x1 # or eax, 000000001h ; Set PE bit (bit #0)
70 .byte 0xF,0x22,0xC0 # mov cr0, eax
82 ProtectedModeStart: # protected mode entry point
94 movw %ax,%ss # Flat mode setup.
98 addl $LockLocation, %edi
99 movb $NotVacantFlag, %al
102 cmpb $NotVacantFlag, %al
107 addl $StackSize, %edi
110 addl $StackStart, %edi
116 movb $VacantFlag, %al
118 addl $LockLocation, %edi
125 addl $RendezvousProc, %edi
130 call *%ebx # Call C function
140 RendezvousFunnelProcEnd:
141 #-------------------------------------------------------------------------------------
142 # AsmGetAddressMap (&AddressMap);
143 #-------------------------------------------------------------------------------------
144 ASM_GLOBAL ASM_PFX(AsmGetAddressMap)
145 ASM_PFX(AsmGetAddressMap):
150 movl 0x24(%ebp), %ebx
151 movl $RendezvousFunnelProcStart, (%ebx)
152 movl $(ProtectedModeStart - RendezvousFunnelProcStart), 0x4(%ebx)
153 movl $(FLAT32_JUMP - RendezvousFunnelProcStart), 0x8(%ebx)
156 movl $(RendezvousFunnelProcEnd - RendezvousFunnelProcStart), 0x14(%ebx)