summaryrefslogtreecommitdiff
path: root/kernel/tests/int3.rs
blob: f5b547083fe4f8d19811e73d1abd1ad248fce446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#![no_main]
#![feature(compiler_builtins_lib)]
#![feature(abi_x86_interrupt)]
#![feature(panic_info_message)]
#![no_std]

use kernel;
use kernel::interrupts;
use kernel::interrupts::exceptions;
use kernel::io::qemu;

#[no_mangle]
extern "C" fn _start() -> ! {
    kernel::init();
    unsafe {
        exceptions::expect_fault(interrupts::Interrupts::Breakpoint);
    }
    x86_64::instructions::interrupts::int3();
    panic!("BREAKPOINT not caught");

    loop {}
}

#[cfg(test)]
#[panic_handler]
#[no_mangle]
extern "C" fn panic_handler(info: &core::panic::PanicInfo) -> ! {
    kernel::testing::serial_should_panic(info);
    loop {}
}