From: Jeff Fan <jeff.fan@intel.com>
To: edk2-devel@lists.01.org
Cc: Feng Tian <feng.tian@intel.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>
Subject: [PATCH 2/3] UefiCpuPkg: Add ExceptionHandlerData for ArchRestoreExceptionContext()
Date: Wed, 30 Nov 2016 15:22:42 +0800 [thread overview]
Message-ID: <20161130072243.35268-3-jeff.fan@intel.com> (raw)
In-Reply-To: <20161130072243.35268-1-jeff.fan@intel.com>
mReservedVectors is not set, we could add parameter ExceptionHandlerData for
ArchRestoreExceptionContext() that could use it instead of mReservedVectors.
Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
---
.../CpuExceptionHandlerLib/CpuExceptionCommon.h | 11 +++++-----
.../Ia32/ArchExceptionHandler.c | 21 +++++++++++-------
.../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 2 +-
.../X64/ArchExceptionHandler.c | 25 +++++++++++++---------
4 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
index dc5d941..f2e4692 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h
@@ -211,14 +211,15 @@ ArchSaveExceptionContext (
/**
Restore CPU exception context when handling EFI_VECTOR_HANDOFF_HOOK_AFTER case.
- @param[in] ExceptionType Exception type.
- @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
-
+ @param[in] ExceptionType Exception type.
+ @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+ @param[in] ExceptionHandlerData Pointer to exception handler data.
**/
VOID
ArchRestoreExceptionContext (
- IN UINTN ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN UINTN ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData
);
/**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
index b96636b..7ab2438 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
@@ -87,19 +87,24 @@ ArchSaveExceptionContext (
/**
Restore CPU exception context when handling EFI_VECTOR_HANDOFF_HOOK_AFTER case.
- @param ExceptionType Exception type.
- @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+ @param[in] ExceptionType Exception type.
+ @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+ @param[in] ExceptionHandlerData Pointer to exception handler data.
**/
VOID
ArchRestoreExceptionContext (
- IN UINTN ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN UINTN ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData
)
{
- SystemContext.SystemContextIa32->Eflags = mReservedVectors[ExceptionType].OldFlags;
- SystemContext.SystemContextIa32->Cs = mReservedVectors[ExceptionType].OldCs;
- SystemContext.SystemContextIa32->Eip = mReservedVectors[ExceptionType].OldIp;
- SystemContext.SystemContextIa32->ExceptionData = mReservedVectors[ExceptionType].ExceptionData;
+ RESERVED_VECTORS_DATA *ReservedVectors;
+
+ ReservedVectors = ExceptionHandlerData->ReservedVectors;
+ SystemContext.SystemContextIa32->Eflags = ReservedVectors[ExceptionType].OldFlags;
+ SystemContext.SystemContextIa32->Cs = ReservedVectors[ExceptionType].OldCs;
+ SystemContext.SystemContextIa32->Eip = ReservedVectors[ExceptionType].OldIp;
+ SystemContext.SystemContextIa32->ExceptionData = ReservedVectors[ExceptionType].ExceptionData;
}
/**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
index 483a417..c0fc9a6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
@@ -68,7 +68,7 @@ CommonExceptionHandlerWorker (
// Old IDT handler has been executed, then restore CPU exception content to
// run new exception handler.
//
- ArchRestoreExceptionContext (ExceptionType, SystemContext);
+ ArchRestoreExceptionContext (ExceptionType, SystemContext, ExceptionHandlerData);
//
// Rlease spin lock for ApicId
//
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
index f84b1a8..7495b14 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
@@ -90,21 +90,26 @@ ArchSaveExceptionContext (
/**
Restore CPU exception context when handling EFI_VECTOR_HANDOFF_HOOK_AFTER case.
- @param ExceptionType Exception type.
- @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+ @param[in] ExceptionType Exception type.
+ @param[in] SystemContext Pointer to EFI_SYSTEM_CONTEXT.
+ @param[in] ExceptionHandlerData Pointer to exception handler data.
**/
VOID
ArchRestoreExceptionContext (
- IN UINTN ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN UINTN ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData
)
{
- SystemContext.SystemContextX64->Ss = mReservedVectors[ExceptionType].OldSs;
- SystemContext.SystemContextX64->Rsp = mReservedVectors[ExceptionType].OldSp;
- SystemContext.SystemContextX64->Rflags = mReservedVectors[ExceptionType].OldFlags;
- SystemContext.SystemContextX64->Cs = mReservedVectors[ExceptionType].OldCs;
- SystemContext.SystemContextX64->Rip = mReservedVectors[ExceptionType].OldIp;
- SystemContext.SystemContextX64->ExceptionData = mReservedVectors[ExceptionType].ExceptionData;
+ RESERVED_VECTORS_DATA *ReservedVectors;
+
+ ReservedVectors = ExceptionHandlerData->ReservedVectors;
+ SystemContext.SystemContextX64->Ss = ReservedVectors[ExceptionType].OldSs;
+ SystemContext.SystemContextX64->Rsp = ReservedVectors[ExceptionType].OldSp;
+ SystemContext.SystemContextX64->Rflags = ReservedVectors[ExceptionType].OldFlags;
+ SystemContext.SystemContextX64->Cs = ReservedVectors[ExceptionType].OldCs;
+ SystemContext.SystemContextX64->Rip = ReservedVectors[ExceptionType].OldIp;
+ SystemContext.SystemContextX64->ExceptionData = ReservedVectors[ExceptionType].ExceptionData;
}
/**
--
2.9.3.windows.2
next prev parent reply other threads:[~2016-11-30 7:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 7:22 [PATCH 0/3] mReservedVectors is not set Jeff Fan
2016-11-30 7:22 ` [PATCH 1/3] UefiCpuPkg: Add ExceptionHandlerData for ArchSaveExceptionContext() Jeff Fan
2016-11-30 7:22 ` Jeff Fan [this message]
2016-11-30 7:22 ` [PATCH 3/3] UefiCpuPkg/CpuExceptionHandlerLib: remove un-used mReservedVectors Jeff Fan
2016-12-01 7:28 ` [PATCH 0/3] mReservedVectors is not set Tian, Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161130072243.35268-3-jeff.fan@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox