mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
wip
This commit is contained in:
26
src/lib.rs
26
src/lib.rs
@@ -11,6 +11,8 @@
|
||||
#![feature(const_fn, unique)]
|
||||
#![feature(alloc, collections)]
|
||||
#![feature(asm)]
|
||||
#![feature(drop_types_in_const)]
|
||||
#![feature(heap_api)]
|
||||
#![no_std]
|
||||
|
||||
extern crate rlibc;
|
||||
@@ -47,16 +49,17 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {
|
||||
// set up guard page and map the heap pages
|
||||
memory::init(boot_info);
|
||||
|
||||
use alloc::boxed::Box;
|
||||
let heap_test = Box::new(42);
|
||||
|
||||
for i in 0..10000 {
|
||||
format!("Some String");
|
||||
}
|
||||
|
||||
interrupts::init();
|
||||
|
||||
unsafe { *(0xdeadbeaf as *mut u32) = 42};
|
||||
//println!("{:?}", unsafe { *(0xdeadbeaf as *mut u32) });
|
||||
//unsafe { *(0xdeadbeaf as *mut u32) = 42 };
|
||||
|
||||
fn recursive() {
|
||||
recursive();
|
||||
}
|
||||
recursive();
|
||||
|
||||
unsafe { *(0xdeadbeaf as *mut u32) = 42 };
|
||||
|
||||
unsafe {
|
||||
asm!("xor eax, eax; idiv eax" :::: "intel");
|
||||
@@ -91,8 +94,11 @@ extern "C" fn eh_personality() {}
|
||||
#[cfg(not(test))]
|
||||
#[lang = "panic_fmt"]
|
||||
extern "C" fn panic_fmt(fmt: core::fmt::Arguments, file: &str, line: u32) -> ! {
|
||||
println!("\n\nPANIC in {} at line {}:", file, line);
|
||||
println!(" {}", fmt);
|
||||
use vga_buffer::print_error;
|
||||
unsafe {
|
||||
print_error(format_args!("\n\nPANIC in {} at line {}:", file, line));
|
||||
print_error(format_args!(" {}", fmt));
|
||||
}
|
||||
loop {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user