1/*
2 * Copyright 2019, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12#include <sel4runtime/gen_config.h>
13
14.section .text
15.global _sel4_start
16_sel4_start:
17
18/* Set gp for relaxation. See
19 * https://www.sifive.com/blog/2017/08/28/all-aboard-part-3-linker-relaxation-in-riscv-toolchain/
20 */
21.option push
22.option norelax
231:auipc gp, %pcrel_hi(__global_pointer$)
24  addi  gp, gp, %pcrel_lo(1b)
25.option pop
26
27	la sp, __stack_top
28	jal __sel4_start_root
29	/* should not return */
301:
31	j 1b
32
33.section .bss
34__stack_base:
35	.align 16
36	.space CONFIG_SEL4RUNTIME_ROOT_STACK
37__stack_top:
38