Save failed stack trace code for future reference.

This commit is contained in:
2025-03-08 18:39:27 +00:00
parent 4b8388c66d
commit da6690fd8b
14 changed files with 335 additions and 122 deletions
+4 -5
View File
@@ -1,5 +1,5 @@
#![no_std]
#![feature(abi_x86_interrupt)]
#![feature(abi_x86_interrupt, breakpoint)]
#![warn(
clippy::correctness,
clippy::nursery,
@@ -35,7 +35,6 @@ use crate::{
use alloc::{boxed::Box, format};
use core::arch::asm;
use limine::BaseRevision;
use std::{debug, unwind::UNWINDER};
use x86_64::VirtAddr;
pub mod arch;
@@ -83,6 +82,7 @@ impl core::error::Error for NoError {}
/// Panicking before this is initialised is unwise. We should probably extract
/// very early init into it's own function because Stack Traces may require
/// allocations etc.
#[inline(never)]
pub fn boot() -> Result<(), Box<dyn core::error::Error>> {
if !BASE_REVISION.is_supported() {
return Err("Base revision not supported.".into());
@@ -149,10 +149,9 @@ pub fn boot() -> Result<(), Box<dyn core::error::Error>> {
x86_64::instructions::interrupts::enable();
debugln!("[Success]");
// Initialises the stack unwinder once and only once because this makes a
// heap allocation.
debug!(" Initializing Stack Unwinder... ");
UNWINDER.lock();
// Force evaluate the constructor.
// let _unwinder = &*UNWINDER;
debugln!("[Success]");
Ok(())