1/*
2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3 * Copyright 2015, 2016 Hesham Almatary <heshamelmatary@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 */
7
8OUTPUT_ARCH(riscv)
9ENTRY(_start)
10
11#include <config.h>
12#define __ASSEMBLER__
13#include <hardware.h>
14#include <sel4/plat/api/constants.h>
15#include <plat/machine/devices_gen.h>
16
17KERNEL_OFFSET = KERNEL_ELF_BASE - KERNEL_ELF_PADDR_BASE;
18
19SECTIONS
20{
21    . = KERNEL_ELF_BASE;
22
23    .boot.text . : AT(ADDR(.boot.text) - KERNEL_OFFSET)
24    {
25        *(.boot.text)
26    }
27    .boot.rodata . : AT(ADDR(.boot.rodata) - KERNEL_OFFSET)
28    {
29        *(.boot.rodata)
30    }
31    .boot.data . : AT(ADDR(.boot.data) - KERNEL_OFFSET)
32    {
33        *(.boot.data)
34    }
35    . = ALIGN(4K);
36
37    ki_boot_end = .;
38
39    .text . : AT(ADDR(.text) - KERNEL_OFFSET)
40    {
41        /* Sit inside a large frame */
42        . = ALIGN(4K);
43
44
45        /* Standard kernel */
46        *(.text)
47    }
48
49    /* Start of data section */
50    _sdata = .;
51    .sdata : {
52        __global_pointer$ = . + 0x800;
53        *(.sdata*)
54    }
55    .srodata : {
56        *(.srodata*)
57    }
58
59    .rodata . : AT(ADDR(.rodata) - KERNEL_OFFSET)
60    {
61        *(.rodata)
62        *(.rodata.*)
63    }
64
65    .data . : AT(ADDR(.data) - KERNEL_OFFSET)
66    {
67        *(.data)
68    }
69
70    .bss . : AT(ADDR(.bss) - KERNEL_OFFSET)
71    {
72        *(.bss)
73        *(.sbss)
74
75        /* 4k breakpoint stack */
76        _breakpoint_stack_bottom = .;
77        . = . + 4K;
78        _breakpoint_stack_top = .;
79
80        /* large data such as the globals frame and global PD */
81        *(.bss.aligned)
82        . = . + 8;
83    }
84
85    . = ALIGN(4K);
86    ki_end = .;
87}
88