You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-raspberrypi-OS-tutorials/18_backtrace/kernel/tests/06_backtrace_invalid_frame.rs

34 lines
769 B
Rust

// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Copyright (c) 2022 Andre Richter <andre.o.richter@gmail.com>
//! Test if backtracing code detects an invalid frame pointer.
#![feature(format_args_nl)]
#![no_main]
#![no_std]
/// Console tests should time out on the I/O harness in case of panic.
mod panic_wait_forever;
use libkernel::{backtrace, bsp, cpu, exception, memory};
#[inline(never)]
fn nested() {
unsafe { backtrace::corrupt_previous_frame_addr() };
panic!()
}
#[no_mangle]
unsafe fn kernel_init() -> ! {
exception::handling_init();
memory::mmu::post_enable_init();
bsp::console::qemu_bring_up_console();
nested();
// The QEMU process running this test will be closed by the I/O test harness.
cpu::wait_forever()
}