Add multiboot2 rust lib

c.f. os.phil-opp.com/allocating-frames.html
This commit is contained in:
greg
2015-11-27 14:58:55 -08:00
parent 6c127273b3
commit 02ffdd55bd
3 changed files with 13 additions and 4 deletions

View File

@@ -8,3 +8,7 @@ crate-type = ["staticlib"]
[dependencies]
rlibc = "*"
[dependencies.multiboot2]
git = "https://github.com/phil-opp/multiboot2-elf64"

View File

@@ -9,7 +9,7 @@ section .bss
p3_table: resb 4096
p2_table: resb 4096
stack_bottom: resb 64 ;reserve 64 bytes of stack space
stack_bottom: resb 4096 ;reserve 4096 bytes of stack space
stack_top:
section .text
@@ -17,6 +17,8 @@ bits 32
start:
mov esp, stack_top
mov edi, ebx ; move multiboot info pointer to edi
call test_multiboot
call test_cpuid
call use_cpuid

View File

@@ -7,6 +7,7 @@
extern crate std;
extern crate rlibc;
extern crate multiboot2;
/* externs */
#[no_mangle]
@@ -38,7 +39,7 @@ pub extern fn rust_handle_timer() {
}
//timer_callback(gtc);
timer_callback2(gtc);
//timer_callback2(gtc);
}
#[no_mangle]
@@ -176,10 +177,12 @@ fn timer_callback(count: u64) {
}
#[no_mangle]
pub extern fn rust_main() {
pub extern fn rust_main(multiboot_info_header: usize) {
use vga_buffer::{clear, checkerboard, Color};
clear();
//checkerboard(Color::Red);
checkerboard(Color::Red);
let boot_info = unsafe { multiboot2::load(multiboot_info_header) };
loop {