1 #------------------------------------------------------------------------------
3 # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php.
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 # This is the assembly code for Multi-processor S3 support
20 #------------------------------------------------------------------------------
23 .equ NotVacantFlag, 0xff
25 .equ LockLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart
26 .equ StackStart, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x04
27 .equ StackSize, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x08
28 .equ RendezvousProc, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x0C
29 .equ GdtrProfile, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x10
30 .equ IdtrProfile, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x16
31 .equ BufferStart, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x1C
33 #-------------------------------------------------------------------------------------
34 #RendezvousFunnelProc procedure follows. All APs execute their procedure. This
35 #procedure serializes all the AP processors through an Init sequence. It must be
36 #noted that APs arrive here very raw...ie: real mode, no stack.
37 #ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
39 #-------------------------------------------------------------------------------------
40 #RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
42 ASM_GLOBAL ASM_PFX(RendezvousFunnelProc)
43 ASM_PFX(RendezvousFunnelProc):
44 RendezvousFunnelProcStart:
46 # At this point CS = 0x(vv00) and ip= 0x0.
48 .byte 0x8c,0xc8 # mov ax, cs
49 .byte 0x8e,0xd8 # mov ds, ax
50 .byte 0x8e,0xc0 # mov es, ax
51 .byte 0x8e,0xd0 # mov ss, ax
52 .byte 0x33,0xc0 # xor ax, ax
53 .byte 0x8e,0xe0 # mov fs, ax
54 .byte 0x8e,0xe8 # mov gs, ax
60 .byte 0x66,0x8B,0x14 # mov edx,dword ptr [si] ; EDX is keeping the start address of wakeup buffer
65 .byte 0x2E,0xF,0x1,0x14 # lgdt fword ptr cs:[si]
70 .byte 0x2E,0xF,0x1,0x1C # lidt fword ptr cs:[si]
72 .byte 0x33,0xC0 # xor ax, ax
73 .byte 0x8E,0xD8 # mov ds, ax
75 .byte 0xF,0x20,0xC0 # mov eax, cr0 ; Get control register 0
76 .byte 0x66,0x83,0xC8,0x1 # or eax, 000000001h ; Set PE bit (bit #0)
77 .byte 0xF,0x22,0xC0 # mov cr0, eax
81 .byte 0x66,0x67,0xEA # far jump
82 .long 0x0 # 32-bit offset
83 .word 0x20 # 16-bit selector
85 PMODE_ENTRY: # protected mode entry point
97 movw %ax,%ss # Flat mode setup.
102 addl $LockLocation, %edi
103 movb $NotVacantFlag, %al
106 cmpb $NotVacantFlag, %al
112 addl $StackSize, %edi
115 addl $StackStart, %edi
122 movb $VacantFlag, %al
124 addl $LockLocation, %edi
128 # Call assembly function to initialize FPU.
130 lea ASM_PFX(InitializeFloatingPointUnits), %ebx
136 addl $RendezvousProc, %edi
141 call *%eax # Call C function
148 RendezvousFunnelProcEnd:
149 #-------------------------------------------------------------------------------------
150 # AsmGetAddressMap (&AddressMap);
151 #-------------------------------------------------------------------------------------
152 ASM_GLOBAL ASM_PFX(AsmGetAddressMap)
153 ASM_PFX(AsmGetAddressMap):
158 movl 0x24(%ebp), %ebx
159 movl $RendezvousFunnelProcStart, (%ebx)
160 movl $(PMODE_ENTRY - RendezvousFunnelProcStart), 0x4(%ebx)
161 movl $(FLAT32_JUMP - RendezvousFunnelProcStart), 0x8(%ebx)
162 movl $(RendezvousFunnelProcEnd - RendezvousFunnelProcStart), 0x0c(%ebx)