public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"Leif Lindholm (Linaro address)" <leif.lindholm@linaro.org>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 1/3] UefiCpuPkg/PiSmmCpuDxeSmm: update comments in IA32 SmmStartup()
Date: Fri, 2 Feb 2018 07:05:14 +0100	[thread overview]
Message-ID: <82f18986-68f3-367f-04a0-60ce71c273a0@redhat.com> (raw)
In-Reply-To: <E92EE9817A31E24EB0585FDF735412F5B895C360@ORSMSX113.amr.corp.intel.com>

On 01/31/18 23:11, Kinney, Michael D wrote:
> Laszlo,
> 
> I agree the Unaligned functions have issues.
> We should see if we could change the param type.
> It should be a backwards compatible change to
> go from a type specific pointer to VOID *.  But
> need to check with all supported compilers.
> 
> We can have arch specific functions and macros.
> There are many in BaseLib.h.  This way, if a macro
> or function is used by an unsupported arch, the
> build will fail.  I also like some of the name
> change suggestions.  Maybe PatchInstructionX86()
> and change the parameter name to InstructionEnd.
> 
> BaseLib.h
> ==========
> #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
> 
> VOID
> EFIAPI
> PatchInstructionX86 (
>   VOID    *InstructionEnd,
>   UINT64  PatchValue,
>   UINTN   ValueSize
>   );
> 
> #endif
> 
> BaseLib Instance
> ==========
> VOID
> EFIAPI
> PatchInstructionX86 (
>   VOID    *InstructionEnd,
>   UINT64  PatchValue,
>   UINTN   ValueSize
>   )
> {
>   ASSERT ((UINTN)InstructionEnd > ValueSize);
>   switch (ValueSize) {
>   case 1:
>     ASSERT (PatchValue <= MAX_UINT8);
>     *((UINT8 *)InstructionEnd - 1) = (UINT8)PatchValue;
>   case 2:
>     ASSERT (PatchValue <= MAX_UINT16);
>     WriteUnaligned16 ((UINT16 *)(InstructionEnd) - 1, (UINT16)PatchValue));
>     break;
>   case 4:
>     ASSERT (PatchValue <= MAX_UINT32);
>     WriteUnaligned32 ((UINT32 *)(InstructionEnd) - 1, (UINT32)PatchValue));
>     break;
>   case 8:
>     WriteUnaligned64 ((UINT64 *)(InstructionEnd) - 1, PatchValue));
>     break;
>   default:
>     ASSERT (FALSE);
>   }
> }

I managed to remove all instruction DBs from PiSmmCpuDxeSmm. I plan to
post the patches this week or the next.

Thanks!
Laszlo


  reply	other threads:[~2018-02-02  5:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 15:33 [PATCH 0/3] UefiCpuPkg/PiSmmCpuDxeSmm: fix IA32 SmmStartup() regression on KVM Laszlo Ersek
2018-01-30 15:33 ` [PATCH 1/3] UefiCpuPkg/PiSmmCpuDxeSmm: update comments in IA32 SmmStartup() Laszlo Ersek
2018-01-30 17:22   ` Kinney, Michael D
2018-01-30 18:17     ` Laszlo Ersek
2018-01-30 20:31       ` Kinney, Michael D
2018-01-30 21:26         ` Kinney, Michael D
2018-01-30 21:55           ` Laszlo Ersek
2018-01-30 21:45         ` Laszlo Ersek
2018-01-30 22:25           ` Kinney, Michael D
2018-01-31  5:44             ` Ni, Ruiyu
2018-01-31  5:54               ` Ni, Ruiyu
2018-01-31 10:56                 ` Laszlo Ersek
2018-01-31 10:42               ` Laszlo Ersek
2018-01-31 10:40             ` Laszlo Ersek
2018-01-31 22:11               ` Kinney, Michael D
2018-02-02  6:05                 ` Laszlo Ersek [this message]
2018-02-02 10:06               ` Ard Biesheuvel
2018-02-02 13:26                 ` Laszlo Ersek
2018-02-02 13:28                 ` Leif Lindholm
2018-02-02 13:36                   ` Laszlo Ersek
2018-01-30 15:33 ` [PATCH 2/3] UefiCpuPkg/PiSmmCpuDxeSmm: remove unneeded DBs from " Laszlo Ersek
2018-01-31  5:45   ` Ni, Ruiyu
2018-01-30 15:33 ` [PATCH 3/3] UefiCpuPkg/PiSmmCpuDxeSmm: eliminate conditional jump in " Laszlo Ersek
2018-01-31  5:12   ` Ni, Ruiyu
2018-01-30 16:37 ` [PATCH 0/3] UefiCpuPkg/PiSmmCpuDxeSmm: fix IA32 SmmStartup() regression on KVM Paolo Bonzini
2018-01-31 12:17 ` Laszlo Ersek
2018-02-01  1:20 ` Wang, Jian J

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=82f18986-68f3-367f-04a0-60ce71c273a0@redhat.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