parent
1e5f901926
commit
45c2ec0b17
@ -0,0 +1,49 @@
|
||||
/* Copy from bbl-ucore : https://ring00.github.io/bbl-ucore */
|
||||
|
||||
/* Simple linker script for the ucore kernel.
|
||||
See the GNU ld 'info' manual ("info ld") to learn the syntax. */
|
||||
|
||||
OUTPUT_ARCH(riscv)
|
||||
ENTRY(_start)
|
||||
|
||||
BASE_ADDRESS = 0xffffffffc0010000;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Load the kernel at this address: "." means the current address */
|
||||
. = BASE_ADDRESS;
|
||||
start = .;
|
||||
|
||||
.text : {
|
||||
stext = .;
|
||||
*(.text.entry)
|
||||
*(.text .text.*)
|
||||
. = ALIGN(4K);
|
||||
etext = .;
|
||||
}
|
||||
|
||||
.rodata : {
|
||||
srodata = .;
|
||||
*(.rodata .rodata.*)
|
||||
. = ALIGN(4K);
|
||||
erodata = .;
|
||||
}
|
||||
|
||||
.data : {
|
||||
sdata = .;
|
||||
*(.data .data.*)
|
||||
edata = .;
|
||||
}
|
||||
|
||||
.stack : {
|
||||
*(.bss.stack)
|
||||
}
|
||||
|
||||
.bss : {
|
||||
sbss = .;
|
||||
*(.bss .bss.*)
|
||||
ebss = .;
|
||||
}
|
||||
|
||||
PROVIDE(end = .);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
.section .text.entry
|
||||
.globl _start
|
||||
_start:
|
||||
# a0 == hartid
|
||||
# pc == 0x80010000
|
||||
# sp == 0x8000xxxx
|
||||
|
||||
# 1. set sp
|
||||
# sp = bootstack + (hartid + 1) * 0x10000
|
||||
add t0, a0, 1
|
||||
slli t0, t0, 14
|
||||
lui sp, %hi(bootstack)
|
||||
add sp, sp, t0
|
||||
|
||||
# 1.1 set device tree paddr
|
||||
# OpenSBI give me 0 ???
|
||||
li a1, 0x800003b0
|
||||
|
||||
# 2. jump to rust_main (absolute address)
|
||||
lui t0, %hi(rust_main)
|
||||
addi t0, t0, %lo(rust_main)
|
||||
jr t0
|
||||
|
||||
.section .bss.stack
|
||||
.align 12 # page align
|
||||
.global bootstack
|
||||
bootstack:
|
||||
.space 4096 * 4 * 2
|
||||
.global bootstacktop
|
||||
bootstacktop:
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in new issue