+++ /dev/null
-#------------------------------------------------------------------------------\r
-#\r
-# CopyMem() worker for ARM\r
-#\r
-# This file started out as C code that did 64 bit moves if the buffer was\r
-# 32-bit aligned, else it does a byte copy. It also does a byte copy for\r
-# any trailing bytes. Update using VSTM/SLDM to do 128 byte copies.\r
-#\r
-# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-#include <AsmMacroIoLib.h>\r
-\r
-/**\r
- Copy Length bytes from Source to Destination. Overlap is OK.\r
-\r
- This implementation\r
-\r
- @param Destination Target of copy\r
- @param Source Place to copy from\r
- @param Length Number of bytes to copy\r
-\r
- @return Destination\r
-\r
-\r
-VOID *\r
-EFIAPI\r
-InternalMemCopyMem (\r
- OUT VOID *DestinationBuffer,\r
- IN CONST VOID *SourceBuffer,\r
- IN UINTN Length\r
- )\r
-**/\r
-ASM_FUNC(InternalMemCopyMem)\r
- stmfd sp!, {r4, r9, lr}\r
- tst r0, #3\r
- mov r4, r0\r
- mov r9, r0\r
- mov ip, r2\r
- mov lr, r1\r
- movne r0, #0\r
- bne L4\r
- tst r1, #3\r
- movne r3, #0\r
- moveq r3, #1\r
- cmp r2, #127\r
- movls r0, #0\r
- andhi r0, r3, #1\r
-L4:\r
- cmp r4, r1\r
- bcc L26\r
- bls L7\r
- rsb r3, r1, r4\r
- cmp ip, r3\r
- bcc L26\r
- cmp ip, #0\r
- beq L7\r
- add r9, r4, ip\r
- add lr, ip, r1\r
- b L16\r
-L29:\r
- sub ip, ip, #8\r
- cmp ip, #7\r
- ldrd r2, [lr, #-8]!\r
- movls r0, #0\r
- cmp ip, #0\r
- strd r2, [r9, #-8]!\r
- beq L7\r
-L16:\r
- cmp r0, #0\r
- bne L29\r
- sub r3, lr, #1\r
- sub ip, ip, #1\r
- ldrb r3, [r3, #0]\r
- sub r2, r9, #1\r
- cmp ip, #0\r
- sub r9, r9, #1\r
- sub lr, lr, #1\r
- strb r3, [r2, #0]\r
- bne L16\r
- b L7\r
-L11:\r
- ldrb r3, [lr], #1\r
- sub ip, ip, #1\r
- strb r3, [r9], #1\r
-L26:\r
- cmp ip, #0\r
- beq L7\r
-L30:\r
- cmp r0, #0\r
- beq L11\r
- sub ip, ip, #128 // 32\r
- cmp ip, #127 // 31\r
- vldm lr!, {d0-d15}\r
- movls r0, #0\r
- cmp ip, #0\r
- vstm r9!, {d0-d15}\r
- bne L30\r
-L7:\r
- dsb\r
- mov r0, r4\r
- ldmfd sp!, {r4, r9, pc}\r
-\r
-\r