2010-04-22 00:04:35 +02:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
;
|
|
|
|
; CopyMem() worker for ARM
|
|
|
|
;
|
|
|
|
; This file started out as C code that did 64 bit moves if the buffer was
|
|
|
|
; 32-bit aligned, else it does a byte copy. It also does a byte copy for
|
|
|
|
; any trailing bytes. Update using VSTM/SLDM to do 128 byte copies.
|
|
|
|
;
|
2010-04-29 14:15:47 +02:00
|
|
|
; Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
|
|
|
; This program and the accompanying materials
|
2010-04-22 00:04:35 +02:00
|
|
|
; are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
; which accompanies this distribution. The full text of the license may be found at
|
|
|
|
; http://opensource.org/licenses/bsd-license.php
|
|
|
|
;
|
|
|
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
;
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
Copy Length bytes from Source to Destination. Overlap is OK.
|
|
|
|
|
|
|
|
This implementation
|
|
|
|
|
|
|
|
@param Destination Target of copy
|
|
|
|
@param Source Place to copy from
|
|
|
|
@param Length Number of bytes to copy
|
|
|
|
|
|
|
|
@return Destination
|
|
|
|
|
|
|
|
|
|
|
|
VOID *
|
|
|
|
EFIAPI
|
|
|
|
InternalMemCopyMem (
|
|
|
|
OUT VOID *DestinationBuffer,
|
|
|
|
IN CONST VOID *SourceBuffer,
|
|
|
|
IN UINTN Length
|
|
|
|
)
|
|
|
|
**/
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\sEXPORT InternalMemCopyMem
|
2010-04-22 00:04:35 +02:00
|
|
|
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\sAREA AsmMemStuff, CODE, READONLY
|
2010-04-22 00:04:35 +02:00
|
|
|
|
|
|
|
InternalMemCopyMem
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\sstmfd\s\ssp!, {r4, r9, lr}
|
|
|
|
\s\stst\s\sr0, #3
|
|
|
|
\s\smov\s\sr4, r0
|
|
|
|
\s\smov\s\sr9, r0
|
|
|
|
\s\smov\s\sip, r2
|
|
|
|
\s\smov\s\slr, r1
|
|
|
|
\s\smovne\s\sr0, #0
|
|
|
|
\s\sbne\s\sL4
|
|
|
|
\s\stst\s\sr1, #3
|
|
|
|
\s\smovne\s\sr3, #0
|
|
|
|
\s\smoveq\s\sr3, #1
|
|
|
|
\s\scmp\s\sr2, #127
|
|
|
|
\s\smovls\s\sr0, #0
|
|
|
|
\s\sandhi\s\sr0, r3, #1
|
2010-04-22 00:04:35 +02:00
|
|
|
L4
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\scmp\s\sr4, r1
|
|
|
|
\s\sbcc\s\sL26
|
|
|
|
\s\sbls\s\sL7
|
|
|
|
\s\srsb\s\sr3, r1, r4
|
|
|
|
\s\scmp\s\sip, r3
|
|
|
|
\s\sbcc\s\sL26
|
|
|
|
\s\scmp\s\sip, #0
|
|
|
|
\s\sbeq\s\sL7
|
|
|
|
\s\sadd\s\sr9, r4, ip
|
|
|
|
\s\sadd\s\slr, ip, r1
|
|
|
|
\s\sb\s\sL16
|
2010-04-22 00:04:35 +02:00
|
|
|
L29
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\ssub\s\sip, ip, #8
|
|
|
|
\s\scmp\s\sip, #7
|
|
|
|
\s\sldrd\s\sr2, [lr, #-8]!
|
|
|
|
\s\smovls\s\sr0, #0
|
|
|
|
\s\scmp\s\sip, #0
|
|
|
|
\s\sstrd\s\sr2, [r9, #-8]!
|
|
|
|
\s\sbeq\s\sL7
|
2010-04-22 00:04:35 +02:00
|
|
|
L16
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\scmp\s\sr0, #0
|
|
|
|
\s\sbne\s\sL29
|
|
|
|
\s\ssub\s\sr3, lr, #1
|
|
|
|
\s\ssub\s\sip, ip, #1
|
|
|
|
\s\sldrb\s\sr3, [r3, #0]\s\s
|
|
|
|
\s\ssub\s\sr2, r9, #1
|
|
|
|
\s\scmp\s\sip, #0
|
|
|
|
\s\ssub\s\sr9, r9, #1
|
|
|
|
\s\ssub\s\slr, lr, #1
|
|
|
|
\s\sstrb\s\sr3, [r2, #0]
|
|
|
|
\s\sbne\s\sL16
|
|
|
|
\s\sb L7
|
2010-04-22 00:04:35 +02:00
|
|
|
L11
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\sldrb\s\sr3, [lr], #1\s\s
|
|
|
|
\s\ssub\s\sip, ip, #1
|
|
|
|
\s\sstrb\s\sr3, [r9], #1
|
2010-04-22 00:04:35 +02:00
|
|
|
L26
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\scmp\s\sip, #0
|
|
|
|
\s\sbeq\s\sL7
|
2010-04-22 00:04:35 +02:00
|
|
|
L30
|
2011-02-02 23:52:07 +01:00
|
|
|
\s\scmp\s\sr0, #0
|
|
|
|
\s\sbeq\s\sL11
|
|
|
|
\s\ssub\s\sip, ip, #128 // 32
|
|
|
|
\s\scmp\s\sip, #127 // 31
|
|
|
|
\s\svldm lr!, {d0-d15}
|
|
|
|
\s\smovls\s\sr0, #0
|
|
|
|
\s\scmp\s\sip, #0
|
|
|
|
\s\svstm r9!, {d0-d15}
|
|
|
|
\s\sbne\s\sL30
|
2010-04-22 00:04:35 +02:00
|
|
|
L7
|
|
|
|
dsb
|
2011-02-02 23:52:07 +01:00
|
|
|
mov\s\sr0, r4
|
|
|
|
\s\sldmfd\s\ssp!, {r4, r9, pc}
|
2010-04-22 00:04:35 +02:00
|
|
|
|
|
|
|
END
|
|
|
|
|