summaryrefslogtreecommitdiff
path: root/src/mainboard/emulation/qemu-aarch64/bootblock_custom.S
blob: f9e85d0efc55c06bd0558f2f2558c54197036cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Early initialization code for aarch64 (a.k.a. armv8)
 *
 * Copyright 2019 Asami Doi <d0iasm.pub@gmail.com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include <arch/asm.h>

ENTRY(_start)
	/* Setup CPU. */
	bl      arm64_init_cpu

	/* Get code positions. */
	ldr	x1, =_flash
	ldr	x0, =_bootblock

	/* Calculate bootblock size. */
	ldr     x2, =_ebootblock
	sub     x2, x2, x0

	/* Call memcpy in arch/arm64/memcpy.S */
	bl	memcpy
	dmb     sy

	/* Calculate relocation offset between bootblock in flash and in DRAM. */
 	ldr	x0, =_flash
	ldr	x1, =_bootblock
	sub	x1, x1, x0

	/* Jump to main() in DRAM. */
	adr	x0, main
	add	x0, x0, x1
	blr	x0
ENDPROC(_start)