xref: /openbmc/linux/arch/riscv/purgatory/entry.S (revision e5242c5f)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * purgatory: Runs between two kernels
4 *
5 * Copyright (C) 2022 Huawei Technologies Co, Ltd.
6 *
7 * Author: Li Zhengyu (lizhengyu3@huawei.com)
8 *
9 */
10
11.macro	size, sym:req
12	.size \sym, . - \sym
13.endm
14#include <asm/asm.h>
15#include <linux/linkage.h>
16
17.text
18
19.globl purgatory_start
20purgatory_start:
21
22	lla	sp, .Lstack
23	mv	s0, a0	/* The hartid of the current hart */
24	mv	s1, a1	/* Phys address of the FDT image */
25
26	jal	purgatory
27
28	/* Start new image. */
29	mv	a0, s0
30	mv	a1, s1
31	ld	a2, riscv_kernel_entry
32	jr	a2
33
34size purgatory_start
35
36.align 4
37	.rept	256
38	.quad	0
39	.endr
40.Lstack:
41
42.data
43
44.align LGREG
45.globl riscv_kernel_entry
46riscv_kernel_entry:
47	.quad	0
48size riscv_kernel_entry
49
50.end
51