diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-09-26 15:51:45 -0700 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-09-27 09:12:14 -0700 |
commit | c4f637077eb4504aa0109aac9983dfe85e5b2afb (patch) | |
tree | d538e23675d34bb641c651dd1616692b1d4749dc /MdePkg/Library/BaseMemoryLibOptDxe | |
parent | 7807dea57fba6a019bb8641572e0159ffa03ad9e (diff) | |
download | edk2-platforms-c4f637077eb4504aa0109aac9983dfe85e5b2afb.tar.xz |
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>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdePkg/Library/BaseMemoryLibOptDxe')
-rw-r--r-- | MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S index dc0e74e865..1c269547b0 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}
|