diff --git a/ch1/src/entry.asm b/ch1/src/entry.asm index cd24d76..f790219 100644 --- a/ch1/src/entry.asm +++ b/ch1/src/entry.asm @@ -1,7 +1,7 @@ .section .text.entry .globl _start // 声明_start是全局符号 _start: - la sp, boot_stack_top + la sp, boot_stack_top_bound call rust_main @@ -9,7 +9,7 @@ _start: // 声明栈空间 后续 .bss.stack 会被link脚本链接到 .bss段 .section .bss.stack .globl boot_stack_lower_bound // 栈低地址公开为全局符号 - .globl boot_stack_top // 栈高地址公开为全局符号 + .globl boot_stack_top_bound // 栈高地址公开为全局符号 boot_stack_lower_bound: .space 4096 * 16 -boot_stack_top: +boot_stack_top_bound: diff --git a/ch1/src/main.rs b/ch1/src/main.rs index ed9307f..bcbe1e2 100644 --- a/ch1/src/main.rs +++ b/ch1/src/main.rs @@ -17,14 +17,17 @@ extern "C" { fn etext(); fn sbss(); fn ebss(); + fn boot_stack_top_bound(); + fn boot_stack_lower_bound(); } #[no_mangle] pub fn rust_main(){ init_bss(); - println!("stext: {:#x}, etext: {:#x}", stext as usize, etext as usize); + println!("sbss: {:#x}, ebss: {:#x}", sbss as usize, ebss as usize); + println!("boot_stack_top_bound: {:#x}, boot_stack_lower_bound: {:#x}", boot_stack_top_bound as usize, boot_stack_lower_bound as usize); panic!("my panic"); }