xref: /rk3399_ARM-atf/lib/romlib/init.s (revision f1722b693d363cc6a2b624d59f0442bf845baf62)
15accce5bSRoberto Vargas/*
25accce5bSRoberto Vargas * 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
8*f1722b69SSoby 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__
19*f1722b69SSoby Mathew	adrp	x1, __DATA_ROM_START__
20*f1722b69SSoby Mathew	add	x1, x1, :lo12:__DATA_ROM_START__
21*f1722b69SSoby Mathew	adrp	x2, __DATA_RAM_END__
22*f1722b69SSoby Mathew	add	x2, x2, :lo12:__DATA_RAM_END__
23*f1722b69SSoby Mathew	sub	x2, x2, x0
245accce5bSRoberto Vargas	bl	memcpy
255accce5bSRoberto Vargas
26*f1722b69SSoby Mathew	adrp	x0,__BSS_START__
27*f1722b69SSoby Mathew	add	x0, x0, :lo12:__BSS_START__
285accce5bSRoberto Vargas	mov	x1, #0
29*f1722b69SSoby Mathew	adrp	x2, __BSS_END__
30*f1722b69SSoby Mathew	add	x2, x2, :lo12:__BSS_END__
31*f1722b69SSoby 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