VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/MpFuncs.nasm@ 86173

Last change on this file since 86173 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1;------------------------------------------------------------------------------ ;
2; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
3; SPDX-License-Identifier: BSD-2-Clause-Patent
4;
5; Module Name:
6;
7; MpFuncs.nasm
8;
9; Abstract:
10;
11; This is the assembly code for Multi-processor S3 support
12;
13;-------------------------------------------------------------------------------
14
15SECTION .text
16
17extern ASM_PFX(InitializeFloatingPointUnits)
18
19%define VacantFlag 0x0
20%define NotVacantFlag 0xff
21
22%define LockLocation RendezvousFunnelProcEnd - RendezvousFunnelProcStart
23%define StackStart LockLocation + 0x4
24%define StackSize LockLocation + 0x8
25%define RendezvousProc LockLocation + 0xC
26%define GdtrProfile LockLocation + 0x10
27%define IdtrProfile LockLocation + 0x16
28%define BufferStart LockLocation + 0x1C
29
30;-------------------------------------------------------------------------------------
31;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
32;procedure serializes all the AP processors through an Init sequence. It must be
33;noted that APs arrive here very raw...ie: real mode, no stack.
34;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
35;IS IN MACHINE CODE.
36;-------------------------------------------------------------------------------------
37;RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
38
39BITS 16
40global ASM_PFX(RendezvousFunnelProc)
41ASM_PFX(RendezvousFunnelProc):
42RendezvousFunnelProcStart:
43
44; At this point CS = 0x(vv00) and ip= 0x0.
45
46 mov ax, cs
47 mov ds, ax
48 mov es, ax
49 mov ss, ax
50 xor ax, ax
51 mov fs, ax
52 mov gs, ax
53
54flat32Start:
55
56 mov si, BufferStart
57 mov edx,dword [si] ; EDX is keeping the start address of wakeup buffer
58
59 mov si, GdtrProfile
60o32 lgdt [cs:si]
61
62 mov si, IdtrProfile
63o32 lidt [cs:si]
64
65 xor ax, ax
66 mov ds, ax
67
68 mov eax, cr0 ; Get control register 0
69 or eax, 0x000000001 ; Set PE bit (bit #0)
70 mov cr0, eax
71
72FLAT32_JUMP:
73
74a32 jmp dword 0x20:0x0
75
76BITS 32
77PMODE_ENTRY: ; protected mode entry point
78
79 mov ax, 0x8
80o16 mov ds, ax
81o16 mov es, ax
82o16 mov fs, ax
83o16 mov gs, ax
84o16 mov ss, ax ; Flat mode setup.
85
86 mov esi, edx
87
88 mov edi, esi
89 add edi, LockLocation
90 mov al, NotVacantFlag
91TestLock:
92 xchg byte [edi], al
93 cmp al, NotVacantFlag
94 jz TestLock
95
96ProgramStack:
97
98 mov edi, esi
99 add edi, StackSize
100 mov eax, dword [edi]
101 mov edi, esi
102 add edi, StackStart
103 add eax, dword [edi]
104 mov esp, eax
105 mov dword [edi], eax
106
107Releaselock:
108
109 mov al, VacantFlag
110 mov edi, esi
111 add edi, LockLocation
112 xchg byte [edi], al
113
114 ;
115 ; Call assembly function to initialize FPU.
116 ;
117 mov ebx, ASM_PFX(InitializeFloatingPointUnits)
118 call ebx
119 ;
120 ; Call C Function
121 ;
122 mov edi, esi
123 add edi, RendezvousProc
124 mov eax, dword [edi]
125
126 test eax, eax
127 jz GoToSleep
128 call eax ; Call C function
129
130GoToSleep:
131 cli
132 hlt
133 jmp $-2
134
135RendezvousFunnelProcEnd:
136;-------------------------------------------------------------------------------------
137; AsmGetAddressMap (&AddressMap);
138;-------------------------------------------------------------------------------------
139global ASM_PFX(AsmGetAddressMap)
140ASM_PFX(AsmGetAddressMap):
141
142 pushad
143 mov ebp,esp
144
145 mov ebx, dword [ebp+0x24]
146 mov dword [ebx], RendezvousFunnelProcStart
147 mov dword [ebx+0x4], PMODE_ENTRY - RendezvousFunnelProcStart
148 mov dword [ebx+0x8], FLAT32_JUMP - RendezvousFunnelProcStart
149 mov dword [ebx+0xc], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
150
151 popad
152 ret
153
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette