parent
5ccd84e934
commit
211aeff841
@ -0,0 +1,18 @@
|
||||
.section .text,"ax",%progbits
|
||||
.globl kern_entry
|
||||
kern_entry:
|
||||
# la sp, bootstacktop
|
||||
auipc sp, %hi(bootstacktop)
|
||||
addi sp, sp, %lo(bootstacktop)
|
||||
|
||||
# tail rust_main
|
||||
auipc t1, %hi(rust_main)
|
||||
jalr zero, t1, %lo(rust_main)
|
||||
|
||||
.section .data
|
||||
.align 12 #PGSHIFT
|
||||
.global bootstack
|
||||
bootstack:
|
||||
.space 4096 * 8 #KSTACKSIZE
|
||||
.global bootstacktop
|
||||
bootstacktop:
|
@ -0,0 +1,53 @@
|
||||
/* 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(kern_entry)
|
||||
|
||||
BASE_ADDRESS = 0xC0000000;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Load the kernel at this address: "." means the current address */
|
||||
. = BASE_ADDRESS;
|
||||
|
||||
.text : {
|
||||
*(.text.kern_entry .text .stub .text.* .gnu.linkonce.t.*)
|
||||
}
|
||||
|
||||
PROVIDE(etext = .); /* Define the 'etext' symbol to this value */
|
||||
|
||||
.rodata : {
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
}
|
||||
|
||||
/* Adjust the address for the data segment to the next page */
|
||||
. = ALIGN(0x1000);
|
||||
|
||||
/* The data segment */
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
}
|
||||
|
||||
.sdata : {
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
}
|
||||
|
||||
PROVIDE(edata = .);
|
||||
|
||||
.bss : {
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.sbss*)
|
||||
}
|
||||
|
||||
PROVIDE(end = .);
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame .note.GNU-stack)
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
global_asm!(include_str!("boot/entry.S"));
|
||||
|
||||
extern crate riscv;
|
Loading…
Reference in new issue