Use _enter for program entrypoint instead of _start, and change entry to start

This commit is contained in:
gil 2024-05-15 20:44:54 -05:00
parent 8cfd1c245a
commit ae7b904abc
2 changed files with 6 additions and 6 deletions

View file

@ -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() };

View file

@ -1,7 +1,7 @@
# src/script.ld
OUTPUT_ARCH("riscv")
ENTRY(_start)
ENTRY(_enter)
MEMORY {
ram (wxa) : ORIGIN = 0x80000000, LENGTH = 128M