mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 06:17:49 +00:00
Trigger a double fault through a stack overflow -> triple fault
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -12,10 +12,12 @@ pub extern "C" fn _start() -> ! {
|
||||
|
||||
blog_os::interrupts::init_idt();
|
||||
|
||||
// trigger a page fault
|
||||
unsafe {
|
||||
*(0xdeadbeef as *mut u64) = 42;
|
||||
};
|
||||
fn stack_overflow() {
|
||||
stack_overflow(); // for each recursion, the return address is pushed
|
||||
}
|
||||
|
||||
// trigger a stack overflow
|
||||
stack_overflow();
|
||||
|
||||
println!("It did not crash!");
|
||||
loop {}
|
||||
|
||||
Reference in New Issue
Block a user