mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Provoke a stack overflow, which still causes a boot loop
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@@ -58,10 +58,13 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {
|
|||||||
// invoke a breakpoint exception
|
// invoke a breakpoint exception
|
||||||
x86_64::instructions::interrupts::int3();
|
x86_64::instructions::interrupts::int3();
|
||||||
|
|
||||||
// trigger a page fault
|
fn stack_overflow() {
|
||||||
unsafe {
|
stack_overflow(); // for each recursion, the return address is pushed
|
||||||
*(0xdeadbeaf as *mut u64) = 42;
|
}
|
||||||
};
|
|
||||||
|
// trigger a stack overflow
|
||||||
|
stack_overflow();
|
||||||
|
|
||||||
|
|
||||||
println!("It did not crash!");
|
println!("It did not crash!");
|
||||||
loop {}
|
loop {}
|
||||||
|
|||||||
Reference in New Issue
Block a user