From 3c59321b54f07d83a1b565910dc9d087e53c6140 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 25 Apr 2019 18:28:37 +0200 Subject: [PATCH] Remove old `bootimage test` integration test --- ...t-exception-double-fault-stack-overflow.rs | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 src/bin/test-exception-double-fault-stack-overflow.rs diff --git a/src/bin/test-exception-double-fault-stack-overflow.rs b/src/bin/test-exception-double-fault-stack-overflow.rs deleted file mode 100644 index 51d24755..00000000 --- a/src/bin/test-exception-double-fault-stack-overflow.rs +++ /dev/null @@ -1,77 +0,0 @@ -#![feature(abi_x86_interrupt)] -#![no_std] -#![cfg_attr(not(test), no_main)] -#![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))] - -use blog_os::{exit_qemu, serial_println}; -use core::panic::PanicInfo; -use lazy_static::lazy_static; - -#[cfg(not(test))] -#[no_mangle] -#[allow(unconditional_recursion)] -pub extern "C" fn _start() -> ! { - blog_os::gdt::init(); - init_test_idt(); - - fn stack_overflow() { - stack_overflow(); // for each recursion, the return address is pushed - } - - // trigger a stack overflow - stack_overflow(); - - serial_println!("failed"); - serial_println!("No exception occured"); - - unsafe { - exit_qemu(); - } - - loop {} -} - -/// This function is called on panic. -#[cfg(not(test))] -#[panic_handler] -fn panic(info: &PanicInfo) -> ! { - serial_println!("failed"); - serial_println!("{}", info); - - unsafe { - exit_qemu(); - } - - loop {} -} - -use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; - -lazy_static! { - static ref TEST_IDT: InterruptDescriptorTable = { - let mut idt = InterruptDescriptorTable::new(); - unsafe { - idt.double_fault - .set_handler_fn(double_fault_handler) - .set_stack_index(blog_os::gdt::DOUBLE_FAULT_IST_INDEX); - } - - idt - }; -} - -pub fn init_test_idt() { - TEST_IDT.load(); -} - -extern "x86-interrupt" fn double_fault_handler( - _stack_frame: &mut InterruptStackFrame, - _error_code: u64, -) { - serial_println!("ok"); - - unsafe { - exit_qemu(); - } - loop {} -}