Roberto Vargas | e92111a | 2018-05-22 16:05:42 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | .globl rom_lib_init |
| 8 | .extern __DATA_RAM_START__, __DATA_ROM_START__, __DATA_SIZE__ |
| 9 | .extern memset, memcpy |
| 10 | |
| 11 | rom_lib_init: |
| 12 | cmp w0, #1 |
| 13 | mov w0, #0 |
| 14 | b.le 1f |
| 15 | ret |
| 16 | |
| 17 | 1: stp x29, x30, [sp, #-16]! |
| 18 | adrp x0, __DATA_RAM_START__ |
| 19 | ldr x1,= __DATA_ROM_START__ |
| 20 | ldr x2, =__DATA_SIZE__ |
| 21 | bl memcpy |
| 22 | |
| 23 | ldr x0, =__BSS_START__ |
| 24 | mov x1, #0 |
| 25 | ldr x2, =__BSS_SIZE__ |
| 26 | bl memset |
| 27 | ldp x29, x30, [sp], #16 |
| 28 | |
| 29 | mov w0, #1 |
| 30 | ret |