CpuExceptionHandlerLib: Add comments to make code more readable
Today's implementation of handling HOOK_BEFORE and HOOK_AFTER is a bit complex. More comments is better. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Fan Jeff <vanjeff_919@hotmail.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
x64 CPU Exception Handler.
|
||||
|
||||
Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -67,7 +67,9 @@ ArchSaveExceptionContext (
|
||||
|
||||
ReservedVectors = ExceptionHandlerData->ReservedVectors;
|
||||
//
|
||||
// Save Exception context in global variable
|
||||
// Save Exception context in global variable in first entry of the exception handler.
|
||||
// So when original exception handler returns to the new exception handler (second entry),
|
||||
// the Eflags/Cs/Eip/ExceptionData can be used.
|
||||
//
|
||||
ReservedVectors[ExceptionType].OldSs = SystemContext.SystemContextX64->Ss;
|
||||
ReservedVectors[ExceptionType].OldSp = SystemContext.SystemContextX64->Rsp;
|
||||
@@ -82,7 +84,7 @@ ArchSaveExceptionContext (
|
||||
Eflags.Bits.IF = 0;
|
||||
SystemContext.SystemContextX64->Rflags = Eflags.UintN;
|
||||
//
|
||||
// Modify the EIP in stack, then old IDT handler will return to the stub code
|
||||
// Modify the EIP in stack, then old IDT handler will return to HookAfterStubBegin.
|
||||
//
|
||||
SystemContext.SystemContextX64->Rip = (UINTN) ReservedVectors[ExceptionType].HookAfterStubHeaderCode;
|
||||
}
|
||||
|
Reference in New Issue
Block a user