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#include <linux/linkage.h>
11
12.text
13
14SYM_CODE_START(purgatory_start)
15
16 lla sp, .Lstack
17 mv s0, a0 /* The hartid of the current hart */
18 mv s1, a1 /* Phys address of the FDT image */
19
20 jal purgatory
21
22 /* Start new image. */
23 mv a0, s0
24 mv a1, s1
25 ld a2, riscv_kernel_entry
26 jr a2
27SYM_CODE_END(purgatory_start)
28
29.align 4
30 .rept 256
31 .quad 0
32 .endr
33.Lstack:
34
35.data
36
37SYM_DATA(riscv_kernel_entry, .quad 0)
38
39.end
40

source code of linux/arch/riscv/purgatory/entry.S