From 6713e550733565616209656acb361a52b9512c14 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 17 Aug 2015 15:16:38 +0200 Subject: [PATCH] Pass Multiboot structure pointer as argument --- src/arch/x86_64/boot.asm | 1 + src/arch/x86_64/long_mode_init.asm | 2 +- src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/arch/x86_64/boot.asm b/src/arch/x86_64/boot.asm index 5759fa69..41074cbb 100644 --- a/src/arch/x86_64/boot.asm +++ b/src/arch/x86_64/boot.asm @@ -19,6 +19,7 @@ section .text bits 32 start: mov esp, stack_top + mov edi, ebx call check_multiboot call check_cpuid diff --git a/src/arch/x86_64/long_mode_init.asm b/src/arch/x86_64/long_mode_init.asm index 1dfb0186..47927d58 100644 --- a/src/arch/x86_64/long_mode_init.asm +++ b/src/arch/x86_64/long_mode_init.asm @@ -20,7 +20,7 @@ bits 64 long_mode_start: call setup_SSE - ; call rust main + ; call rust main (with multiboot pointer in rdi) call rust_main .os_returned: ; rust main returned, print `OS returned!` diff --git a/src/lib.rs b/src/lib.rs index 32b00cca..bc30a4e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,7 +24,7 @@ use core::fmt::Write; mod vga_buffer; #[no_mangle] -pub extern fn rust_main() { +pub extern fn rust_main(multiboot_address: usize) { // ATTENTION: we have a very small stack and no guard page use vga_buffer::{Writer, Color};