Skip to content

Commit 86c0b7e

Browse files
committed
fix: mangle loader_main
1 parent 600242a commit 86c0b7e

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

src/arch/aarch64/entry.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ use core::arch::{asm, global_asm};
55
use aarch64_cpu::registers::{Writeable, SCTLR_EL1};
66
use log::info;
77

8-
extern "C" {
9-
fn loader_main();
10-
}
11-
128
const BOOT_CORE_ID: u64 = 0; // ID of CPU for booting on SMP systems - this might be board specific in the future
139

1410
/*
@@ -189,10 +185,8 @@ unsafe fn pre_init() -> ! {
189185

190186
// Enter loader
191187
unsafe {
192-
loader_main();
188+
crate::os::loader_main();
193189
}
194-
195-
unreachable!()
196190
}
197191

198192
pub unsafe fn wait_forever() -> ! {

src/arch/x86_64/entry.s

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ start64:
187187
add rsp, BOOT_STACK_SIZE-16
188188

189189
# jump to the boot processors's C code
190-
.extern loader_main
191-
jmp loader_main
190+
jmp {loader_main}
192191
jmp start64+0x28
193192

194193
.section .data

src/arch/x86_64/entry_fc.s

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ start64:
6969
add rsp, BOOT_STACK_SIZE-16
7070

7171
# jump to the boot processors's C code
72-
.extern loader_main
73-
jmp loader_main
72+
jmp {loader_main}
7473
invalid:
7574
jmp invalid
7675

src/arch/x86_64/firecracker.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ extern "C" {
2626
}
2727

2828
mod entry {
29-
core::arch::global_asm!(include_str!("entry_fc.s"));
29+
core::arch::global_asm!(
30+
include_str!("entry_fc.s"),
31+
loader_main = sym crate::os::loader_main,
32+
);
3033
}
3134

3235
pub fn find_kernel() -> &'static [u8] {

src/arch/x86_64/multiboot.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ extern "C" {
2525

2626
#[allow(bad_asm_style)]
2727
mod entry {
28-
core::arch::global_asm!(include_str!("entry.s"));
28+
core::arch::global_asm!(
29+
include_str!("entry.s"),
30+
loader_main = sym crate::os::loader_main,
31+
);
2932
}
3033

3134
struct Mem;

src/os/none/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ extern "C" {
1818

1919
/// Entry Point of the BIOS Loader
2020
/// (called from entry.asm or entry.rs)
21-
#[no_mangle]
2221
pub(crate) unsafe extern "C" fn loader_main() -> ! {
2322
crate::log::init();
2423

0 commit comments

Comments
 (0)