xref: /rk3399_ARM-atf/lib/romlib/init.s (revision 72e8f2456af54b75a0a1d92aadfce0b4bcde6ba1)
15accce5bSRoberto Vargas/*
2*4c700c15SGovindraj Raja * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.
35accce5bSRoberto Vargas *
45accce5bSRoberto Vargas * SPDX-License-Identifier: BSD-3-Clause
55accce5bSRoberto Vargas */
65accce5bSRoberto Vargas
75accce5bSRoberto Vargas	.globl	rom_lib_init
8f1722b69SSoby Mathew	.extern	__DATA_RAM_START__, __DATA_ROM_START__, __DATA_RAM_END__
95accce5bSRoberto Vargas	.extern	memset, memcpy
105accce5bSRoberto Vargas
115accce5bSRoberto Vargasrom_lib_init:
125accce5bSRoberto Vargas	cmp	w0, #1
135accce5bSRoberto Vargas	mov	w0, #0
145accce5bSRoberto Vargas	b.le	1f
155accce5bSRoberto Vargas	ret
165accce5bSRoberto Vargas
175accce5bSRoberto Vargas1:	stp	x29, x30, [sp, #-16]!
185accce5bSRoberto Vargas	adrp	x0, __DATA_RAM_START__
19f1722b69SSoby Mathew	adrp	x1, __DATA_ROM_START__
20f1722b69SSoby Mathew	add	x1, x1, :lo12:__DATA_ROM_START__
21f1722b69SSoby Mathew	adrp	x2, __DATA_RAM_END__
22f1722b69SSoby Mathew	add	x2, x2, :lo12:__DATA_RAM_END__
23f1722b69SSoby Mathew	sub	x2, x2, x0
245accce5bSRoberto Vargas	bl	memcpy
255accce5bSRoberto Vargas
26f1722b69SSoby Mathew	adrp	x0,__BSS_START__
27f1722b69SSoby Mathew	add	x0, x0, :lo12:__BSS_START__
285accce5bSRoberto Vargas	mov	x1, #0
29f1722b69SSoby Mathew	adrp	x2, __BSS_END__
30f1722b69SSoby Mathew	add	x2, x2, :lo12:__BSS_END__
31f1722b69SSoby Mathew	sub	x2, x2, x0
325accce5bSRoberto Vargas	bl	memset
335accce5bSRoberto Vargas	ldp	x29, x30, [sp], #16
345accce5bSRoberto Vargas
355accce5bSRoberto Vargas	mov	w0, #1
365accce5bSRoberto Vargas	ret
37