From 9ef817ce9756423117b7f883c317099f876e5464 Mon Sep 17 00:00:00 2001 From: zhangxinyu <840317537@qq.com> Date: Mon, 15 May 2023 14:07:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AC=A6=E5=8F=B7=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ch1/src/entry.asm | 6 +++--- ch1/src/main.rs | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) 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"); }