-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e5f901
commit 45c2ec0
Showing
14 changed files
with
968 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = .); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.