summaryrefslogtreecommitdiff
path: root/kernel/tests/int3.rs
blob: ac0e5f0e04513f317e7e3d2726b3741928e5ca56 (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
31
32
33
#![no_main]
#![feature(abi_x86_interrupt)]
#![feature(panic_info_message)]
#![allow(unreachable_code)]
#![feature(custom_test_frameworks)]
#![test_runner(kernel::testing::serial_test_runner)]
#![no_std]

use kernel;
use kernel::interrupts;
use kernel::interrupts::exception_handlers;
use kernel::qemu;

#[no_mangle]
extern "C" fn _start() -> ! {
    kernel::init();
    unsafe {
        exception_handlers::expect_fault(interrupts::InterruptType::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_panic(info);
    loop {}
}