Add multiboot2 rust lib
c.f. os.phil-opp.com/allocating-frames.html
This commit is contained in:
@@ -8,3 +8,7 @@ crate-type = ["staticlib"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rlibc = "*"
|
rlibc = "*"
|
||||||
|
|
||||||
|
[dependencies.multiboot2]
|
||||||
|
git = "https://github.com/phil-opp/multiboot2-elf64"
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ section .bss
|
|||||||
p3_table: resb 4096
|
p3_table: resb 4096
|
||||||
p2_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:
|
stack_top:
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
@@ -17,6 +17,8 @@ bits 32
|
|||||||
|
|
||||||
start:
|
start:
|
||||||
mov esp, stack_top
|
mov esp, stack_top
|
||||||
|
mov edi, ebx ; move multiboot info pointer to edi
|
||||||
|
|
||||||
call test_multiboot
|
call test_multiboot
|
||||||
call test_cpuid
|
call test_cpuid
|
||||||
call use_cpuid
|
call use_cpuid
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
extern crate std;
|
extern crate std;
|
||||||
|
|
||||||
extern crate rlibc;
|
extern crate rlibc;
|
||||||
|
extern crate multiboot2;
|
||||||
|
|
||||||
/* externs */
|
/* externs */
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@@ -38,7 +39,7 @@ pub extern fn rust_handle_timer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//timer_callback(gtc);
|
//timer_callback(gtc);
|
||||||
timer_callback2(gtc);
|
//timer_callback2(gtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@@ -176,10 +177,12 @@ fn timer_callback(count: u64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn rust_main() {
|
pub extern fn rust_main(multiboot_info_header: usize) {
|
||||||
use vga_buffer::{clear, checkerboard, Color};
|
use vga_buffer::{clear, checkerboard, Color};
|
||||||
clear();
|
clear();
|
||||||
//checkerboard(Color::Red);
|
checkerboard(Color::Red);
|
||||||
|
|
||||||
|
let boot_info = unsafe { multiboot2::load(multiboot_info_header) };
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user