Fix the risk of AP stack conflict.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10714 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -22,5 +22,5 @@ RendezvousProc equ LockLocation + 0Ch
|
||||
GdtrProfile equ LockLocation + 10h
|
||||
IdtrProfile equ LockLocation + 16h
|
||||
BufferStart equ LockLocation + 1Ch
|
||||
|
||||
ProcessorNumber equ LockLocation + 20h
|
||||
;-------------------------------------------------------------------------------
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#define GdtrProfile RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x10
|
||||
#define IdtrProfile RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x16
|
||||
#define BufferStart RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x1C
|
||||
#define ProcessorNumber, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x20
|
||||
|
||||
#-------------------------------------------------------------------------------------
|
||||
#RendezvousFunnelProc procedure follows. All APs execute their procedure. This
|
||||
@@ -94,30 +95,33 @@ ProtectedModeStart: # protected mode entry point
|
||||
.byte 0x66
|
||||
movw %ax,%ss # Flat mode setup.
|
||||
|
||||
|
||||
#
|
||||
# ProgramStack
|
||||
#
|
||||
movl $0x1b, %ecx
|
||||
rdmsr
|
||||
andl $0xfffff000, %eax
|
||||
addl $0x20, %eax
|
||||
movl (%eax), %ebx
|
||||
shrl $24, %ebx
|
||||
|
||||
xorl %ecx, %ecx
|
||||
movl %esi,%edi
|
||||
addl $LockLocation, %edi
|
||||
movb $NotVacantFlag, %al
|
||||
TestLock:
|
||||
xchgb (%edi), %al
|
||||
cmpb $NotVacantFlag, %al
|
||||
jz TestLock
|
||||
addl $ProcessorNumber, %edi
|
||||
movl (%edi, %ebx, 4), %ecx
|
||||
|
||||
ProgramStack:
|
||||
movl %esi,%edi
|
||||
addl $StackSize, %edi
|
||||
movl (%edi), %eax
|
||||
incl %ecx
|
||||
mull %ecx
|
||||
|
||||
movl %esi,%edi
|
||||
addl $StackStart, %edi
|
||||
addl (%edi), %eax
|
||||
movl %eax,%esp
|
||||
movl %eax, (%edi)
|
||||
movl (%edi), %ebx
|
||||
addl %ebx, %eax
|
||||
|
||||
Releaselock:
|
||||
movb $VacantFlag, %al
|
||||
movl %esi,%edi
|
||||
addl $LockLocation, %edi
|
||||
xchgb (%edi), %al
|
||||
movl %eax, %esp
|
||||
|
||||
#
|
||||
# Call C Function
|
||||
|
@@ -85,31 +85,33 @@ ProtectedModeStart:: ; protected mode entry point
|
||||
mov gs, ax
|
||||
mov ss, ax ; Flat mode setup.
|
||||
|
||||
|
||||
;
|
||||
; ProgramStack
|
||||
;
|
||||
mov ecx, 1bh ; Read IA32_APIC_BASE MSR
|
||||
rdmsr
|
||||
and eax, 0fffff000h
|
||||
add eax, 20h
|
||||
mov ebx, dword ptr [eax]
|
||||
shr ebx, 24
|
||||
|
||||
xor ecx, ecx
|
||||
mov edi, esi
|
||||
add edi, LockLocation
|
||||
mov al, NotVacantFlag
|
||||
TestLock::
|
||||
xchg byte ptr [edi], al
|
||||
cmp al, NotVacantFlag
|
||||
jz TestLock
|
||||
|
||||
ProgramStack::
|
||||
add edi, ProcessorNumber
|
||||
mov ecx, dword ptr [edi + 4 * ebx] ; ECX = CpuNumber
|
||||
|
||||
mov edi, esi
|
||||
add edi, StackSize
|
||||
mov eax, dword ptr [edi]
|
||||
inc ecx
|
||||
mul ecx ; EAX = StackSize * (CpuNumber + 1)
|
||||
|
||||
mov edi, esi
|
||||
add edi, StackStart
|
||||
add eax, dword ptr [edi]
|
||||
mov esp, eax
|
||||
mov dword ptr [edi], eax
|
||||
mov ebx, dword ptr [edi]
|
||||
add eax, ebx ; EAX = StackStart + StackSize * (CpuNumber + 1)
|
||||
|
||||
Releaselock::
|
||||
mov al, VacantFlag
|
||||
mov edi, esi
|
||||
add edi, LockLocation
|
||||
xchg byte ptr [edi], al
|
||||
mov esp, eax
|
||||
|
||||
;
|
||||
; Call C Function
|
||||
|
Reference in New Issue
Block a user