]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c
Fix >4G issue on IDT not restored correctly.
[mirror_edk2.git] / IntelFspWrapperPkg / Library / BaseFspApiLib / X64 / DispatchExecute.c
index e2f44225347c844d0025f8b3ccf7b1d811c7196c..360327ed08f53391a229b4ebfaf7c55ee4bc2aaf 100644 (file)
@@ -89,6 +89,18 @@ Execute32BitCode (
   IN UINT64      Param1\r
   )\r
 {\r
-  return AsmExecute32BitCode (Function, Param1, 0, &mGdt);\r
+  EFI_STATUS       Status;\r
+  IA32_DESCRIPTOR  Idtr;\r
+\r
+  //\r
+  // Idtr might be changed inside of FSP. 32bit FSP only knows the <4G address.\r
+  // If IDTR.Base is >4G, FSP can not handle. So we need save/restore IDTR here for X64 only.\r
+  // Interrupt is already disabled here, so it is safety to update IDTR.\r
+  //\r
+  AsmReadIdtr (&Idtr);\r
+  Status = AsmExecute32BitCode (Function, Param1, 0, &mGdt);\r
+  AsmWriteIdtr (&Idtr);\r
+\r
+  return Status;\r
 }\r
 \r