mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
The BaseMemEncryptSevLib functionality was updated to rely on the use of the OVMF/SEV workarea to check for SEV guests. However, this area is only updated when running the X64 OVMF build, not the hybrid Ia32/X64 build. Base SEV support is allowed under the Ia32/X64 build, but it now fails to boot as a result of the change. Update the ResetVector code to check for SEV features when built for 32-bit mode, not just 64-bit mode (requiring updates to both the Ia32 and Ia32X64 fdf files). Fixes: f1d1c337e7c0575da7fd248b2dd9cffc755940df Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Min Xu <min.m.xu@intel.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
128 lines
2.9 KiB
NASM
128 lines
2.9 KiB
NASM
;------------------------------------------------------------------------------
|
|
; @file
|
|
; Main routine of the pre-SEC code up through the jump into SEC
|
|
;
|
|
; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
|
|
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
;
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
|
BITS 16
|
|
|
|
;
|
|
; Modified: EBX, ECX, EDX, EBP
|
|
;
|
|
; @param[in,out] RAX/EAX Initial value of the EAX register
|
|
; (BIST: Built-in Self Test)
|
|
; @param[in,out] DI 'BP': boot-strap processor, or
|
|
; 'AP': application processor
|
|
; @param[out] RBP/EBP Address of Boot Firmware Volume (BFV)
|
|
; @param[out] DS Selector allowing flat access to all addresses
|
|
; @param[out] ES Selector allowing flat access to all addresses
|
|
; @param[out] FS Selector allowing flat access to all addresses
|
|
; @param[out] GS Selector allowing flat access to all addresses
|
|
; @param[out] SS Selector allowing flat access to all addresses
|
|
;
|
|
; @return None This routine jumps to SEC and does not return
|
|
;
|
|
Main16:
|
|
OneTimeCall EarlyInit16
|
|
|
|
;
|
|
; Transition the processor from 16-bit real mode to 32-bit flat mode
|
|
;
|
|
OneTimeCall TransitionFromReal16To32BitFlat
|
|
|
|
BITS 32
|
|
|
|
; Clear the WorkArea header. The SEV probe routines will populate the
|
|
; work area when detected.
|
|
mov byte[WORK_AREA_GUEST_TYPE], 0
|
|
|
|
%ifdef ARCH_X64
|
|
|
|
jmp SearchBfv
|
|
|
|
;
|
|
; Entry point of Main32
|
|
;
|
|
Main32:
|
|
OneTimeCall InitTdx
|
|
|
|
SearchBfv:
|
|
|
|
%endif
|
|
|
|
;
|
|
; Search for the Boot Firmware Volume (BFV)
|
|
;
|
|
OneTimeCall Flat32SearchForBfvBase
|
|
|
|
;
|
|
; EBP - Start of BFV
|
|
;
|
|
|
|
;
|
|
; Search for the SEC entry point
|
|
;
|
|
OneTimeCall Flat32SearchForSecEntryPoint
|
|
|
|
;
|
|
; ESI - SEC Core entry point
|
|
; EBP - Start of BFV
|
|
;
|
|
|
|
%ifdef ARCH_IA32
|
|
|
|
;
|
|
; SEV support can be built and run using the Ia32/X64 split environment.
|
|
; Set the OVMF/SEV work area as appropriate.
|
|
;
|
|
OneTimeCall CheckSevFeatures
|
|
|
|
;
|
|
; Restore initial EAX value into the EAX register
|
|
;
|
|
mov eax, esp
|
|
|
|
;
|
|
; Jump to the 32-bit SEC entry point
|
|
;
|
|
jmp esi
|
|
|
|
%else
|
|
|
|
;
|
|
; Transition the processor from 32-bit flat mode to 64-bit flat mode
|
|
;
|
|
OneTimeCall Transition32FlatTo64Flat
|
|
|
|
BITS 64
|
|
|
|
;
|
|
; Some values were calculated in 32-bit mode. Make sure the upper
|
|
; 32-bits of 64-bit registers are zero for these values.
|
|
;
|
|
mov rax, 0x00000000ffffffff
|
|
and rsi, rax
|
|
and rbp, rax
|
|
and rsp, rax
|
|
|
|
;
|
|
; RSI - SEC Core entry point
|
|
; RBP - Start of BFV
|
|
;
|
|
|
|
;
|
|
; Restore initial EAX value into the RAX register
|
|
;
|
|
mov rax, rsp
|
|
|
|
;
|
|
; Jump to the 64-bit SEC entry point
|
|
;
|
|
jmp rsi
|
|
|
|
%endif
|