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_RAM_END__
9	.extern	memset, memcpy
10
11rom_lib_init:
12	cmp	w0, #1
13	mov	w0, #0
14	b.le	1f
15	ret
16
171:	stp	x29, x30, [sp, #-16]!
18	adrp	x0, __DATA_RAM_START__
19	adrp	x1, __DATA_ROM_START__
20	add	x1, x1, :lo12:__DATA_ROM_START__
21	adrp	x2, __DATA_RAM_END__
22	add	x2, x2, :lo12:__DATA_RAM_END__
23	sub	x2, x2, x0
24	bl	memcpy
25
26	adrp	x0,__BSS_START__
27	add	x0, x0, :lo12:__BSS_START__
28	mov	x1, #0
29	adrp	x2, __BSS_END__
30	add	x2, x2, :lo12:__BSS_END__
31	sub	x2, x2, x0
32	bl	memset
33	ldp	x29, x30, [sp], #16
34
35	mov	w0, #1
36	ret
37