MdePkg/BaseMemoryLibOptDxe ARM AARCH64: fix thinko in SetMem##

The new InternalMemSetMem##() implementations for ARM and AARCH64 in
BaseMemoryLibOptDxe fail to take into account that the 'length' argument
is not in bytes, but in number of items to be copied. So multiply by the
item size before proceeding.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Ard Biesheuvel
2016-09-22 09:52:00 +01:00
parent fe882c0112
commit 8b4ca351dd
3 changed files with 46 additions and 21 deletions

View File

@@ -21,21 +21,33 @@
AREA SetMem, CODE, READONLY, CODEALIGN, ALIGN=5
THUMB
InternalMemZeroMem
movs r2, #0
InternalMemSetMem16
uxth r2, r2
lsl r1, r1, #1
orr r2, r2, r2, lsl #16
b B0
InternalMemSetMem32
lsl r1, r1, #2
b B0
InternalMemSetMem64
lsl r1, r1, #3
b B1
ALIGN 32
InternalMemSetMem
uxtb r2, r2
orr r2, r2, r2, lsl #8
orr r2, r2, r2, lsl #16
b B0
InternalMemSetMem16
uxth r2, r2
orr r2, r2, r2, lsr #16
InternalMemSetMem32
InternalMemZeroMem
movs r2, #0
B0
mov r3, r2
InternalMemSetMem64
B1
push {r4, lr}
cmp r1, #16 ; fewer than 16 bytes of input?
add r1, r1, r0 ; r1 := dst + length