public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "leif.lindholm@linaro.org" <leif.lindholm@linaro.org>
Subject: Re: [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 bug in ScanMem()
Date: Tue, 27 Sep 2016 04:21:49 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14B47D4FD@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1474930756-6536-1-git-send-email-ard.biesheuvel@linaro.org>

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Tuesday, September 27, 2016 6:59 AM
> To: edk2-devel@lists.01.org; Gao, Liming <liming.gao@intel.com>
> Cc: leif.lindholm@linaro.org; Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Subject: [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2
> bug in ScanMem()
> 
> The ARM ScanMem() in BaseMemoryLibOptDxe contains code from the
> open
> source cortex-strings library, and inherited a bug from it where the
> conditional execution of a sequence of instructions is erroneously
> made dependent on the same condition. Since the final 'addeq' is
> supposed to be dependent on the preceding 'tsteq' instruction, they
> cannot be part of the same IT block.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S
> b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S
> index dc0e74e8657c..1c269547b072 100644
> --- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S
> +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S
> @@ -134,11 +134,12 @@ ASM_PFX(InternalMemScanMem8):
>      bne     61f
>      adds    r0, r0, #1
>      tst     r5, #CHARTSTMASK(1)     // 2nd character
> -    ittt    eq
> -    addeq   r0, r0 ,#1
> -    tsteq   r5, #(3 << 15)          // 2nd & 3rd character
> +    bne     61f
> +    adds    r0, r0 ,#1
> +    tst     r5, #(3 << 15)          // 2nd & 3rd character
>      // If not the 3rd must be the last one
> -    addeq   r0, r0, #1
> +    it      eq
> +    addeq.n r0, r0, #1
> 
>  61:
>      pop     {r4-r7}
> --
> 2.7.4



      parent reply	other threads:[~2016-09-27  4:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 22:59 [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 bug in ScanMem() Ard Biesheuvel
2016-09-26 22:59 ` [PATCH 2/2] MdePkg/BaseMemoryLibOptDxe: replace deprecated uses of IT blocks Ard Biesheuvel
2016-09-27  4:21 ` Gao, Liming [this message]

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=4A89E2EF3DFEDB4C8BFDE51014F606A14B47D4FD@shsmsx102.ccr.corp.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