Home | History | Annotate | Download | only in Arm
      1 ;------------------------------------------------------------------------------
      2 ;
      3 ; SetMem() worker for ARM
      4 ;
      5 ; This file started out as C code that did 64 bit moves if the buffer was
      6 ; 32-bit aligned, else it does a byte copy. It also does a byte copy for
      7 ; any trailing bytes. It was updated to do 32-byte at a time.
      8 ;
      9 ; Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
     10 ; This program and the accompanying materials
     11 ; are licensed and made available under the terms and conditions of the BSD License
     12 ; which accompanies this distribution.  The full text of the license may be found at
     13 ; http://opensource.org/licenses/bsd-license.php
     14 ;
     15 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     16 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     17 ;
     18 
     19 /**
     20   Set Buffer to Value for Size bytes.
     21 
     22   @param  Buffer   Memory to set.
     23   @param  Length   Number of bytes to set
     24   @param  Value    Value of the set operation.
     25 
     26   @return Buffer
     27 
     28 VOID *
     29 EFIAPI
     30 InternalMemSetMem (
     31   OUT     VOID                      *Buffer,
     32   IN      UINTN                     Length,
     33   IN      UINT8                     Value
     34   )
     35 **/
     36 
     37 
     38     INCLUDE AsmMacroExport.inc
     39 
     40  RVCT_ASM_EXPORT InternalMemSetMem
     41   stmfd  sp!, {r4-r11, lr}
     42   tst    r0, #3
     43   movne  r3, #0
     44   moveq  r3, #1
     45   cmp    r1, #31
     46   movls lr, #0
     47   andhi  lr, r3, #1
     48   cmp    lr, #0
     49   mov    r12, r0
     50   bne    L31
     51 L32
     52   mov    r3, #0
     53   b      L43
     54 L31
     55   and   r4, r2, #0xff
     56   orr   r4, r4, r4, LSL #8
     57   orr   r4, r4, r4, LSL #16
     58   mov   r5, r4
     59   mov   r6, r4
     60   mov   r7, r4
     61   mov   r8, r4
     62   mov   r9, r4
     63   mov   r10, r4
     64   mov   r11, r4
     65   b      L32
     66 L34
     67   cmp      lr, #0
     68   streqb  r2, [r12], #1
     69   subeq    r1, r1, #1
     70   beq      L43
     71   sub      r1, r1, #32
     72   cmp      r1, #31
     73   movls    lr, r3
     74   stmia    r12!, {r4-r11}
     75 L43
     76   cmp      r1, #0
     77   bne      L34
     78   ldmfd    sp!, {r4-r11, pc}
     79 
     80   END
     81