UINTN RendezvousFunnelSize;\r
UINT8 *RelocateApLoopFuncAddressGeneric;\r
UINTN RelocateApLoopFuncSizeGeneric;\r
- UINT8 *RelocateApLoopFuncAddress;\r
- UINTN RelocateApLoopFuncSize;\r
+ UINT8 *RelocateApLoopFuncAddressAmdSev;\r
+ UINTN RelocateApLoopFuncSizeAmdSev;\r
UINTN ModeTransitionOffset;\r
UINTN SwitchToRealNoNxOffset;\r
UINTN SwitchToRealPM16ModeOffset;\r
**/\r
typedef\r
VOID\r
-(EFIAPI *ASM_RELOCATE_AP_LOOP)(\r
+(EFIAPI *ASM_RELOCATE_AP_LOOP_AMDSEV)(\r
IN BOOLEAN MwaitSupport,\r
IN UINTN ApTargetCState,\r
IN UINTN PmCodeSegment,\r
\r
typedef union {\r
VOID *Data;\r
- ASM_RELOCATE_AP_LOOP AmdSevEntry; // 64-bit AMD Sev processors\r
+ ASM_RELOCATE_AP_LOOP_AMDSEV AmdSevEntry; // 64-bit AMD Sev processors\r
ASM_RELOCATE_AP_LOOP_GENERIC GenericEntry; // Intel processors (32-bit or 64-bit), 32-bit AMD processors, or AMD non-Sev processors\r
} RELOCATE_AP_LOOP_ENTRY;\r
\r
%include "AmdSev.nasm"\r
\r
RendezvousFunnelProcEnd:\r
-\r
;-------------------------------------------------------------------------------------\r
-; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);\r
+; AsmRelocateApLoopAmdSev (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);\r
;-------------------------------------------------------------------------------------\r
-AsmRelocateApLoopStart:\r
+\r
+AsmRelocateApLoopAmdSevStart:\r
BITS 64\r
cmp qword [rsp + 56], 0 ; SevEsAPJumpTable\r
- je NoSevEs\r
+ je NoSevEsAmdSev\r
\r
;\r
; Perform some SEV-ES related setup before leaving 64-bit mode\r
pop rdx\r
pop rcx\r
\r
-NoSevEs:\r
+NoSevEsAmdSev:\r
cli ; Disable interrupt before switching to 32-bit mode\r
mov rax, [rsp + 40] ; CountTofinish\r
lock dec dword [rax] ; (*CountTofinish)--\r
push rcx ; Save MwaitSupport\r
push rdx ; Save ApTargetCState\r
\r
- lea rax, [PmEntry] ; rax <- The start address of transition code\r
+ lea rax, [PmEntryAmdSev] ; rax <- The start address of transition code\r
\r
push r8\r
push rax\r
;\r
; Far return into 32-bit mode\r
;\r
- retfq\r
+o64 retf\r
\r
BITS 32\r
-PmEntry:\r
+PmEntryAmdSev:\r
mov eax, cr0\r
btr eax, 31 ; Clear CR0.PG\r
mov cr0, eax ; Disable paging and caches\r
pop ecx,\r
add esp, 4\r
\r
-MwaitCheck:\r
+MwaitCheckAmdSev:\r
cmp cl, 1 ; Check mwait-monitor support\r
- jnz HltLoop\r
+ jnz HltLoopAmdSev\r
mov ebx, edx ; Save C-State to ebx\r
-MwaitLoop:\r
+MwaitLoopAmdSev:\r
cli\r
mov eax, esp ; Set Monitor Address\r
xor ecx, ecx ; ecx = 0\r
mov eax, ebx ; Mwait Cx, Target C-State per eax[7:4]\r
shl eax, 4\r
mwait\r
- jmp MwaitLoop\r
+ jmp MwaitLoopAmdSev\r
\r
-HltLoop:\r
+HltLoopAmdSev:\r
pop edx ; PM16CodeSegment\r
add esp, 4\r
pop ebx ; WakeupBuffer\r
pop eax ; SevEsAPJumpTable\r
add esp, 4\r
cmp eax, 0 ; Check for SEV-ES\r
- je DoHlt\r
+ je DoHltAmdSev\r
\r
cli\r
;\r
\r
retf\r
\r
-DoHlt:\r
+DoHltAmdSev:\r
cli\r
hlt\r
- jmp DoHlt\r
+ jmp DoHltAmdSev\r
\r
BITS 64\r
-AsmRelocateApLoopEnd:\r
+AsmRelocateApLoopAmdSevEnd:\r
\r
;-------------------------------------------------------------------------------------\r
; AsmRelocateApLoop (MwaitSupport, ApTargetCState, TopOfApStack, CountTofinish, Cr3);\r
lea rax, [AsmRelocateApLoopGenericStart]\r
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddressGeneric], rax\r
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSizeGeneric], AsmRelocateApLoopGenericEnd - AsmRelocateApLoopGenericStart\r
- lea rax, [AsmRelocateApLoopStart]\r
- mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddress], rax\r
- mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSize], AsmRelocateApLoopEnd - AsmRelocateApLoopStart\r
+ lea rax, [AsmRelocateApLoopAmdSevStart]\r
+ mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddressAmdSev], rax\r
+ mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSizeAmdSev], AsmRelocateApLoopAmdSevEnd - AsmRelocateApLoopAmdSevStart\r
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.ModeTransitionOffset], Flat32Start - RendezvousFunnelProcStart\r
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealNoNxOffset], SwitchToRealProcStart - Flat32Start\r
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealPM16ModeOffset], PM16Mode - RendezvousFunnelProcStart\r