ArmPkg/CompilerIntrinsicesLib: Fixed memmove() and memset()

- Fixed memmove when going backward: the copy started one byte
  after the end of the region to copy
- memset: - removed unused register
          - fixed arguments size and character arguments were
            actually reversed
- Added memmove() to ARM32 GCC

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16328 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin
2014-11-11 00:52:11 +00:00
committed by oliviermartin
parent fb7ea6114a
commit 284fb5c811
5 changed files with 88 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
//------------------------------------------------------------------------------
//
// Copyright (c) 2011, ARM Limited. All rights reserved.
// Copyright (c) 2011-2014, ARM Limited. All rights reserved.
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
@@ -28,27 +28,26 @@
;
__aeabi_memmove
CMP r2, #0
BXEQ r14
BXEQ lr
CMP r0, r1
BXEQ r14
BXEQ lr
BHI memmove_backward
BLS memmove_forward
memmove_forward
LDRB r3, [r1], #1
STRB r3, [r0], #1
SUBS r2, r2, #1
BXEQ r14
B memmove_forward
BNE memmove_forward
BX lr
memmove_backward
add r0, r2
add r1, r2
memmove_backward_loop
LDRB r3, [r1], #-1
STRB r3, [r0], #-1
SUBS r2, r2, #-1
BXEQ r14
B memmove_backward_loop
LDRB r3, [r1, #-1]!
STRB r3, [r0, #-1]!
SUBS r2, r2, #1
BNE memmove_backward_loop
BX lr
END