mirror of https://github.com/acidanthera/audk.git
IntelFspPkg/FspSecCore add AsmGetFspBaseAddressNoStack and AsmGetFspInfoHeaderNoStack
Fix GCC issue on FspInfoHeaderRelativeOff. Clean up comments for platform ID matching on Microcode and PcdFspBootFirmwareVolumeBase Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" <Jiewen.Yao@intel.com> Reviewed-by: "Rangarajan, Ravi P" <ravi.p.rangarajan@intel.com> Reviewed-by: "Mudusuru, Giri P" <giri.p.mudusuru@intel.com> Reviewed-by: "Ma, Maurice" <maurice.ma@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17496 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e7401ee1af
commit
f0abe42fd7
|
@ -143,8 +143,8 @@ check_main_header:
|
|||
mov ecx, MSR_IA32_PLATFORM_ID
|
||||
rdmsr
|
||||
mov ecx, edx
|
||||
shr ecx, 50-32
|
||||
and ecx, 7h
|
||||
shr ecx, 50-32 ; shift (50d-32d=18d=0x12) bits
|
||||
and ecx, 7h ; platform id at bit[52..50]
|
||||
mov edx, 1
|
||||
shl edx, cl
|
||||
|
||||
|
@ -569,7 +569,7 @@ FspApiCommon PROC C PUBLIC
|
|||
;
|
||||
; Pass BFV into the PEI Core
|
||||
; It uses relative address to calucate the actual boot FV base
|
||||
; For FSP impleantion with single FV, PcdFlashFvRecoveryBase and
|
||||
; For FSP implementation with single FV, PcdFspBootFirmwareVolumeBase and
|
||||
; PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,
|
||||
; they are different. The code below can handle both cases.
|
||||
;
|
||||
|
|
|
@ -297,8 +297,8 @@ CheckMainHeader:
|
|||
movl $MSR_IA32_PLATFORM_ID, %ecx
|
||||
rdmsr
|
||||
movl %edx, %ecx
|
||||
shrl $0x12, %ecx #($50-$32)
|
||||
andl $0x07, %ecx
|
||||
shrl $0x12, %ecx # shift (50d-32d=18d=0x12) bits
|
||||
andl $0x07, %ecx # platform id at bit[52..50]
|
||||
movl $0x01, %edx
|
||||
shll %cl,%edx
|
||||
|
||||
|
@ -784,7 +784,7 @@ FspApiCommonL2:
|
|||
#
|
||||
# Pass BFV into the PEI Core
|
||||
# It uses relative address to calucate the actual boot FV base
|
||||
# For FSP impleantion with single FV, PcdFlashFvRecoveryBase and
|
||||
# For FSP implementation with single FV, PcdFspBootFirmwareVolumeBase and
|
||||
# PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,
|
||||
# they are different. The code below can handle both cases.
|
||||
#
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
.model flat,C
|
||||
.code
|
||||
|
||||
;
|
||||
; FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
|
||||
; from the FSP Info header.
|
||||
;
|
||||
FspInfoHeaderRelativeOff PROC NEAR PUBLIC
|
||||
;
|
||||
; This value will be pached by the build script
|
||||
|
@ -22,6 +26,11 @@ FspInfoHeaderRelativeOff PROC NEAR PUBLIC
|
|||
DD 012345678h
|
||||
FspInfoHeaderRelativeOff ENDP
|
||||
|
||||
;
|
||||
; Returns FSP Base Address.
|
||||
;
|
||||
; This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
|
||||
;
|
||||
AsmGetFspBaseAddress PROC NEAR PUBLIC
|
||||
mov eax, AsmGetFspBaseAddress
|
||||
sub eax, dword ptr [FspInfoHeaderRelativeOff]
|
||||
|
@ -30,10 +39,35 @@ AsmGetFspBaseAddress PROC NEAR PUBLIC
|
|||
ret
|
||||
AsmGetFspBaseAddress ENDP
|
||||
|
||||
;
|
||||
; No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
|
||||
;
|
||||
AsmGetFspBaseAddressNoStack PROC NEAR PUBLIC
|
||||
mov eax, AsmGetFspBaseAddress
|
||||
sub eax, dword ptr [FspInfoHeaderRelativeOff]
|
||||
add eax, 01Ch
|
||||
mov eax, dword ptr [eax]
|
||||
jmp edi
|
||||
AsmGetFspBaseAddressNoStack ENDP
|
||||
|
||||
;
|
||||
; Returns FSP Info Header.
|
||||
;
|
||||
; This function gets the FSP Info Header using relative addressing and returns it
|
||||
;
|
||||
AsmGetFspInfoHeader PROC NEAR PUBLIC
|
||||
mov eax, AsmGetFspBaseAddress
|
||||
sub eax, dword ptr [FspInfoHeaderRelativeOff]
|
||||
ret
|
||||
AsmGetFspInfoHeader ENDP
|
||||
|
||||
;
|
||||
; No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
|
||||
;
|
||||
AsmGetFspInfoHeaderNoStack PROC NEAR PUBLIC
|
||||
mov eax, AsmGetFspBaseAddress
|
||||
sub eax, dword ptr [FspInfoHeaderRelativeOff]
|
||||
jmp edi
|
||||
AsmGetFspInfoHeaderNoStack ENDP
|
||||
|
||||
END
|
|
@ -15,6 +15,10 @@
|
|||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
|
||||
# from the FSP Info header.
|
||||
#
|
||||
ASM_GLOBAL ASM_PFX(FspInfoHeaderRelativeOff)
|
||||
ASM_PFX(FspInfoHeaderRelativeOff):
|
||||
#
|
||||
|
@ -22,17 +26,46 @@ ASM_PFX(FspInfoHeaderRelativeOff):
|
|||
#
|
||||
.long 0x012345678
|
||||
|
||||
|
||||
#
|
||||
# Returns FSP Base Address.
|
||||
#
|
||||
# This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
|
||||
#
|
||||
ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddress)
|
||||
ASM_PFX(AsmGetFspBaseAddress):
|
||||
mov $AsmGetFspBaseAddress, %eax
|
||||
sub $FspInfoHeaderRelativeOff, %eax
|
||||
sub FspInfoHeaderRelativeOff, %eax
|
||||
add $0x01C, %eax
|
||||
mov (%eax), %eax
|
||||
ret
|
||||
|
||||
#
|
||||
# No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
|
||||
#
|
||||
ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddressNoStack)
|
||||
ASM_PFX(AsmGetFspBaseAddressNoStack):
|
||||
mov $AsmGetFspBaseAddress, %eax
|
||||
sub FspInfoHeaderRelativeOff, %eax
|
||||
add $0x01C, %eax
|
||||
mov (%eax), %eax
|
||||
jmp *%edi
|
||||
|
||||
#
|
||||
# Returns FSP Info Header.
|
||||
#
|
||||
# This function gets the FSP Info Header using relative addressing and returns it
|
||||
#
|
||||
ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeader)
|
||||
ASM_PFX(AsmGetFspInfoHeader):
|
||||
mov $AsmGetFspBaseAddress, %eax
|
||||
sub $FspInfoHeaderRelativeOff, %eax
|
||||
sub FspInfoHeaderRelativeOff, %eax
|
||||
ret
|
||||
|
||||
#
|
||||
# No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
|
||||
#
|
||||
ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeaderNoStack)
|
||||
ASM_PFX(AsmGetFspInfoHeaderNoStack):
|
||||
mov $AsmGetFspBaseAddress, %eax
|
||||
sub FspInfoHeaderRelativeOff, %eax
|
||||
jmp *%edi
|
||||
|
|
Loading…
Reference in New Issue