Begin setting up stack unwinding/tracing.
This actually worked so I am chuffed, but it doesn't read the necessary DWARF structures just yet. Still a good step forwards.
This commit is contained in:
+14
-1
@@ -19,6 +19,8 @@ use arch::x86_64::memory::allocation::page_alloc::FoundryOSFrameAllocator;
|
||||
use arch::x86_64::memory::mapping;
|
||||
use core::arch::asm;
|
||||
use limine::BaseRevision;
|
||||
use std::unwind;
|
||||
use std::unwind::eh_info::ELF;
|
||||
use x86_64::VirtAddr;
|
||||
|
||||
pub mod arch;
|
||||
@@ -64,7 +66,7 @@ pub fn hcf() -> ! {
|
||||
|
||||
pub fn boot() -> Result<(), &'static str> {
|
||||
if !BASE_REVISION.is_supported() {
|
||||
return Err("base revision not supported");
|
||||
return Err("Base revision not supported");
|
||||
}
|
||||
|
||||
use arch::x86_64::{gdt, interrupts};
|
||||
@@ -118,5 +120,16 @@ pub fn boot() -> Result<(), &'static str> {
|
||||
x86_64::instructions::interrupts::enable();
|
||||
println_log!("[Success]");
|
||||
|
||||
print_log!(" Setting up stack unwinder, panic handler... ");
|
||||
// Setup stack traces and proper panic handler. TODO: Handle panics
|
||||
// differently if not initialised.
|
||||
let eh_frame_ptr = ELF
|
||||
.get_section_addr(".eh_frame_hdr")
|
||||
.expect("Could not get `.eh_frame_hdr` address.");
|
||||
|
||||
let _eh_info =
|
||||
unsafe { unwind::eh_info::EhInfo::from_hdr_ptr(eh_frame_ptr) };
|
||||
println_log!("[Success]");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user