Clean up dead code

This commit is contained in:
2025-03-08 18:43:43 +00:00
parent da6690fd8b
commit a83108a08e
7 changed files with 5 additions and 656 deletions
+5 -83
View File
@@ -3,18 +3,11 @@
extern crate alloc;
use core::arch::asm;
use foundry_os::{
// arch::x86_64::processing::async_io::task::{Executor, Task},
arch::x86_64::processing::async_io::task::{Executor, Task},
prelude::*,
// std::unwind::UNWINDER,
// util::shell::shell,
util::shell::shell,
};
// use framehop::{
// x86_64::{CacheX86_64, UnwindRegsX86_64},
// *,
// };
#[unsafe(no_mangle)]
extern "C" fn kmain() -> ! {
@@ -22,80 +15,9 @@ extern "C" fn kmain() -> ! {
if let Err(err) = foundry_os::boot() {
panic!("{}", err);
}
println_log!(" [ Kernel Initialised Successfully ] ");
// println!("TESTING :: Allocation");
// let somevec = vec![0; 1_000_000];
// println!("{:?}", somevec);
// println!("{}", somevec.len());
// println!("PASSED!");
test1();
// let mut executor = Executor::new();
// executor.spawn(Task::new(shell()));
// executor.run()
loop {}
}
#[inline(never)]
pub fn test1() {
test2();
}
#[inline(never)]
pub fn test2() {
test3();
}
const fn read_stack(addr: u64) -> Result<u64, ()> {
Ok(unsafe { *(addr as *const u64) })
}
#[inline(never)]
pub fn test3() {
// let mut cache = CacheX86_64::new();
// let unwinder = &*UNWINDER;
// let mut rip: u64;
// let mut rsp: u64;
// let mut rbp: u64;
// let mut read_stack_fn = read_stack;
// unsafe {
// asm!("lea {0}, [rip]",
// "mov {1}, rsp",
// "mov {2}, rbp",
// out(reg) rip,
// out(reg) rsp,
// out(reg) rbp);
// }
// let regs = UnwindRegsX86_64::new(rip, rsp, rbp);
// let mut frame_iter =
// unwinder.iter_frames(rip, regs, &mut cache, &mut read_stack_fn);
// // This is just me testing the unwinding. It seems to not return any
// stack // frames for some odd reason.
// loop {
// match frame_iter.next() {
// Ok(Some(frame)) => {
// debugln!("Got function with {:x?}",
// frame.address_for_lookup()); // match frame {
// // FrameAddress::InstructionPointer(rip) => (),
// // FrameAddress::ReturnAddress(ra) => {}
// // }
// }
// Ok(None) => {
// debugln!("Hit end of stack.");
// break;
// }
// Err(why) => {
// debugln!("{}", why);
// break;
// }
// }
// }
let mut executor = Executor::new();
executor.spawn(Task::new(shell()));
executor.run()
}