]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
UefiCpuPkg: Add ExceptionHandlerData for ArchSaveExceptionContext()
[mirror_edk2.git] / UefiCpuPkg / Library / CpuExceptionHandlerLib / Ia32 / ArchExceptionHandler.c
index 7a183bf9a4fa836fb057882a5a8b4ac76d5ffb1c..b96636bea24ce34600289aac744c7f46e4cde848 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   IA32 CPU Exception Handler functons.\r
 \r
-  Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -50,24 +50,28 @@ ArchGetIdtHandler (
 /**\r
   Save CPU exception context when handling EFI_VECTOR_HANDOFF_HOOK_AFTER case.\r
 \r
-  @param ExceptionType  Exception type.\r
-  @param SystemContext  Pointer to EFI_SYSTEM_CONTEXT.\r
-\r
+  @param[in] ExceptionType        Exception type.\r
+  @param[in] SystemContext        Pointer to EFI_SYSTEM_CONTEXT.\r
+  @param[in] ExceptionHandlerData Pointer to exception handler data.\r
 **/\r
 VOID\r
 ArchSaveExceptionContext (\r
-  IN UINTN                ExceptionType,\r
-  IN EFI_SYSTEM_CONTEXT   SystemContext \r
+  IN UINTN                        ExceptionType,\r
+  IN EFI_SYSTEM_CONTEXT           SystemContext,\r
+  IN EXCEPTION_HANDLER_DATA       *ExceptionHandlerData\r
   )\r
 {\r
   IA32_EFLAGS32           Eflags;\r
+  RESERVED_VECTORS_DATA   *ReservedVectors;\r
+\r
+  ReservedVectors = ExceptionHandlerData->ReservedVectors;\r
   //\r
   // Save Exception context in global variable\r
   //\r
-  mReservedVectors[ExceptionType].OldFlags      = SystemContext.SystemContextIa32->Eflags;\r
-  mReservedVectors[ExceptionType].OldCs         = SystemContext.SystemContextIa32->Cs;\r
-  mReservedVectors[ExceptionType].OldIp         = SystemContext.SystemContextIa32->Eip;\r
-  mReservedVectors[ExceptionType].ExceptionData = SystemContext.SystemContextIa32->ExceptionData;\r
+  ReservedVectors[ExceptionType].OldFlags      = SystemContext.SystemContextIa32->Eflags;\r
+  ReservedVectors[ExceptionType].OldCs         = SystemContext.SystemContextIa32->Cs;\r
+  ReservedVectors[ExceptionType].OldIp         = SystemContext.SystemContextIa32->Eip;\r
+  ReservedVectors[ExceptionType].ExceptionData = SystemContext.SystemContextIa32->ExceptionData;\r
   //\r
   // Clear IF flag to avoid old IDT handler enable interrupt by IRET\r
   //\r
@@ -77,7 +81,7 @@ ArchSaveExceptionContext (
   //\r
   // Modify the EIP in stack, then old IDT handler will return to the stub code\r
   //\r
-  SystemContext.SystemContextIa32->Eip    = (UINTN) mReservedVectors[ExceptionType].HookAfterStubHeaderCode;\r
+  SystemContext.SystemContextIa32->Eip    = (UINTN) ReservedVectors[ExceptionType].HookAfterStubHeaderCode;\r
 }\r
 \r
 /**\r