mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Reset src to master to be able to follow step-by-step
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@@ -11,8 +11,6 @@
|
||||
#![feature(const_fn, unique)]
|
||||
#![feature(alloc, collections)]
|
||||
#![feature(asm)]
|
||||
#![feature(naked_functions)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![no_std]
|
||||
|
||||
extern crate rlibc;
|
||||
@@ -49,22 +47,13 @@ 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();
|
||||
|
||||
// provoke a page fault
|
||||
unsafe { *(0xdeadbeaf as *mut u64) = 42 };
|
||||
|
||||
fn divide_by_zero() {
|
||||
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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user