public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Tan, Dun" <dun.tan@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: Code optimization to allow bigger stack
Date: Wed, 28 Sep 2022 05:43:25 +0000	[thread overview]
Message-ID: <MWHPR11MB16319953692A0994BC52E9718C549@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220928015157.1647-1-dun.tan@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Tan, Dun <dun.tan@intel.com>
> Sent: Wednesday, September 28, 2022 9:52 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar,
> Rahul R <rahul.r.kumar@intel.com>
> Subject: [PATCH] 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>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> ---
>  UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c |
> 2 +-
>  UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c  |
> 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
> b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.
> c
> index 8c398ebc5b..c8fa30a32f 100644
> ---
> a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c
> +++
> b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.
> c
> @@ -215,7 +215,7 @@ ArchSetupExceptionStack (
>    // Fixup exception task descriptor and task-state segment
>    //
>    AsmGetTssTemplateMap (&TemplateMap);
> -  StackTop = StackTop - CPU_STACK_ALIGNMENT;
> +  StackTop = StackTop - CPU_STACK_ALIGNMENT + 1;
>    StackTop = (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT);
>    IdtTable = (IA32_IDT_GATE_DESCRIPTOR  *)Idtr.Base;
>    for (Index = 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER;
> ++Index) {
> diff --git
> a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
> b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
> index 80e9f08e5b..74b2193cb0 100644
> ---
> a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
> +++
> b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c
> @@ -223,7 +223,7 @@ ArchSetupExceptionStack (
>    // Fixup exception task descriptor and task-state segment
>    //
>    ZeroMem (Tss, sizeof (*Tss));
> -  StackTop = StackTop - CPU_STACK_ALIGNMENT;
> +  StackTop = StackTop - CPU_STACK_ALIGNMENT + 1;
>    StackTop = (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT);
>    IdtTable = (IA32_IDT_GATE_DESCRIPTOR  *)Idtr.Base;
>    for (Index = 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER;
> ++Index) {
> --
> 2.31.1.windows.1


  reply	other threads:[~2022-09-28  5:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28  1:51 [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: Code optimization to allow bigger stack duntan
2022-09-28  5:43 ` Ni, Ray [this message]
2022-09-29  1:04 ` [edk2-devel] " Chang, Abner
2022-09-29  9:02   ` duntan

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=MWHPR11MB16319953692A0994BC52E9718C549@MWHPR11MB1631.namprd11.prod.outlook.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