Begin code for upcoming post

This commit is contained in:
Philipp Oppermann
2016-07-16 17:19:45 +02:00
parent 95c0452bcb
commit 2e0f4f9161
2 changed files with 80 additions and 1 deletions

View File

@@ -11,6 +11,7 @@
#![feature(const_fn, unique)]
#![feature(alloc, collections)]
#![feature(asm)]
#![feature(naked_functions)]
#![no_std]
extern crate rlibc;
@@ -47,6 +48,7 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {
// set up guard page and map the heap pages
memory::init(boot_info);
// initialize our IDT
interrupts::init();
@@ -54,6 +56,11 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {
unsafe { asm!("mov dx, 0; div dx" ::: "ax", "dx" : "volatile", "intel") }
}
//println!("{:?}", divide_by_zero());
// provoke a page fault inside println
println!("{:?}", unsafe { *(0xdeadbeaf as *mut u64) = 42 });
// provoke a divide by zero fault inside println
println!("{:?}", divide_by_zero());