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