Skip to content

Commit

Permalink
Fix isr return
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgian committed Mar 29, 2023
1 parent 57739a1 commit ff838b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions kernel/src/idt.rs
Expand Up @@ -129,14 +129,14 @@ pub extern "C" fn exception_handler(int: u32) {
#[naked]
pub extern "C" fn div_error() {
unsafe {
asm!("iret", options(noreturn));
asm!("push 0x00", "call exception_handler","add esp, 4","iretd", options(noreturn));
}
}

#[naked]
pub extern "C" fn invalid_opcode() {
unsafe {
asm!("push 0x06", "call exception_handler", "iret", options(noreturn));
asm!("push 0x06", "call exception_handler", "add esp, 4","iretd", options(noreturn));
}
}

Expand Down
10 changes: 5 additions & 5 deletions kernel/src/main.rs
Expand Up @@ -46,14 +46,14 @@ pub extern "C" fn _start() -> ! {
IDT.load();

//generates invalid opcode exception
/*unsafe {
asm!("ud2");
}*/
unsafe {
asm!("int 0x0");
}

//generates division error exception
unsafe {
/*unsafe {
asm!("div bl", in("al") 0x00 as u8, in("bl") 0x00 as u8);
}
}*/

println!("Not crashed!");

Expand Down

0 comments on commit ff838b7

Please sign in to comment.