Re: 回复: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer

Lendacky, Thomas

On 5/14/21 2:54 PM, Lendacky, Thomas via wrote:
On 5/10/21 10:04 PM, gaoliming via wrote:
Reviewed-by: Liming Gao <>
Thanks, Liming.

Sorry, for the delay, your email ended up in my Spam folder... urg, IT at
its best. Anyway...

The patch is changing enough that I don't think I should add your
Reviewed-by: just yet. Look for a new version soon.
Ugh, I thought this was for AP reset stack... wrong patch. Disregard.



发件人: <> 代表 Lendacky,
发送时间: 2021年5月10日 22:25
抄送: Brijesh Singh <>; Eric Dong
<>; Ray Ni <>; Laszlo Ersek
<>; Rahul Kumar <>
主题: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to
SEV-ES jump table pointer


A VS2012 build fails with a cast conversion warning when the SEV-ES work
area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.

When casting from a PCD value to a pointer, the cast should first be done
to a UINTN and then to the pointer. Update the code to perform a cast to
a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.

Cc: Eric Dong <>
Cc: Ray Ni <>
Cc: Laszlo Ersek <>
Cc: Rahul Kumar <>
Signed-off-by: Tom Lendacky <>
UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 3d945972a025..dc2a54aa31e8 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
UINT32 Offset, InsnByte;
UINT8 LoNib, HiNib;

- JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32
+ JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32
ASSERT (JmpFar != NULL);


Join to automatically receive all group messages.