Use _enter
for program entrypoint instead of _start
, and change entry
to start
This commit is contained in:
parent
8cfd1c245a
commit
ae7b904abc
10
src/main.rs
10
src/main.rs
|
@ -11,7 +11,7 @@ mod uart;
|
||||||
#[naked]
|
#[naked]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[link_section = ".text.init"]
|
#[link_section = ".text.init"]
|
||||||
unsafe extern "C" fn _start() -> ! {
|
unsafe extern "C" fn _enter() -> ! {
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
asm!(
|
asm!(
|
||||||
// before we use the `la` pseudo-instruction for the first time,
|
// before we use the `la` pseudo-instruction for the first time,
|
||||||
|
@ -35,14 +35,14 @@ unsafe extern "C" fn _start() -> ! {
|
||||||
"2:",
|
"2:",
|
||||||
// BSS is clear!
|
// BSS is clear!
|
||||||
|
|
||||||
// "tail-call" to {entry} (call without saving a return address)
|
// "tail-call" to {start} (call without saving a return address)
|
||||||
"tail {entry}",
|
"tail {start}",
|
||||||
entry = sym entry, // {entry} refers to the function [entry] below
|
start = sym start, // {start} refers to the function [start] below
|
||||||
options(noreturn) // we must handle "returning" from assembly
|
options(noreturn) // we must handle "returning" from assembly
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn entry() -> ! {
|
extern "C" fn start() -> ! {
|
||||||
// UNSAFE: Called exactly once, right here.
|
// UNSAFE: Called exactly once, right here.
|
||||||
unsafe { heap::init() };
|
unsafe { heap::init() };
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# src/script.ld
|
# src/script.ld
|
||||||
|
|
||||||
OUTPUT_ARCH("riscv")
|
OUTPUT_ARCH("riscv")
|
||||||
ENTRY(_start)
|
ENTRY(_enter)
|
||||||
|
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ram (wxa) : ORIGIN = 0x80000000, LENGTH = 128M
|
ram (wxa) : ORIGIN = 0x80000000, LENGTH = 128M
|
||||||
|
|
Loading…
Reference in a new issue