public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 bug in ScanMem()
@ 2016-09-26 22:59 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 ` [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 bug in ScanMem() Gao, Liming
  0 siblings, 2 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2016-09-26 22:59 UTC (permalink / raw)
  To: edk2-devel, liming.gao; +Cc: leif.lindholm, Ard Biesheuvel

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-27  4:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 1/2] MdePkg/BaseMemoryLibOptDxe ARM: fix Thumb-2 bug in ScanMem() Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox