mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/CpuExceptionHandlerLib: Code optimization to allow bigger stack
This commit is a code optimization to allow bigger seperate stack size in ArchSetupExceptionStack. In previous code logic, CPU_STACK_ALIGNMENT bytes will be wasted if StackTop is already CPU_STACK_ALIGNMENT aligned. Signed-off-by: Dun Tan <dun.tan@intel.com> Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Reviewed-by: Abner Chang <abner.chang@amd.com>
This commit is contained in:
parent
406ad0582a
commit
a670f12a74
|
@ -215,7 +215,10 @@ ArchSetupExceptionStack (
|
||||||
// Fixup exception task descriptor and task-state segment
|
// Fixup exception task descriptor and task-state segment
|
||||||
//
|
//
|
||||||
AsmGetTssTemplateMap (&TemplateMap);
|
AsmGetTssTemplateMap (&TemplateMap);
|
||||||
StackTop = StackTop - CPU_STACK_ALIGNMENT;
|
//
|
||||||
|
// Plus 1 byte is for compact stack layout in case StackTop is already aligned.
|
||||||
|
//
|
||||||
|
StackTop = StackTop - CPU_STACK_ALIGNMENT + 1;
|
||||||
StackTop = (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT);
|
StackTop = (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT);
|
||||||
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)Idtr.Base;
|
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)Idtr.Base;
|
||||||
for (Index = 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER; ++Index) {
|
for (Index = 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER; ++Index) {
|
||||||
|
|
|
@ -223,7 +223,10 @@ ArchSetupExceptionStack (
|
||||||
// Fixup exception task descriptor and task-state segment
|
// Fixup exception task descriptor and task-state segment
|
||||||
//
|
//
|
||||||
ZeroMem (Tss, sizeof (*Tss));
|
ZeroMem (Tss, sizeof (*Tss));
|
||||||
StackTop = StackTop - CPU_STACK_ALIGNMENT;
|
//
|
||||||
|
// Plus 1 byte is for compact stack layout in case StackTop is already aligned.
|
||||||
|
//
|
||||||
|
StackTop = StackTop - CPU_STACK_ALIGNMENT + 1;
|
||||||
StackTop = (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT);
|
StackTop = (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT);
|
||||||
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)Idtr.Base;
|
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)Idtr.Base;
|
||||||
for (Index = 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER; ++Index) {
|
for (Index = 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER; ++Index) {
|
||||||
|
|
Loading…
Reference in New Issue