shuffling

This commit is contained in:
able 2022-07-29 12:48:45 -05:00
parent 48f0ef9699
commit 1cead2eccf
8 changed files with 46 additions and 23 deletions

View file

@ -1,3 +1,5 @@
use core::panic::PanicInfo;
use crate::{
arch::{drivers::vga::WRITER, gdt},
image::mono_bitmap::bruh,
@ -75,9 +77,8 @@ extern "x86-interrupt" fn double_fault_handler(
// NOTE(able): ignore this always is 0
_error_code: u64,
) -> ! {
bsod(&stack_frame, BSODSource::DoubleFault);
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
bsod(BSODSource::DoubleFault(&stack_frame));
// panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
}
#[naked]
@ -198,23 +199,28 @@ pub fn reset_pit_for_cpu() {
set_pit_2(1000);
set_pit_3(1000);
}
fn bsod(stack_frame: &InterruptStackFrame, src: BSODSource) {
pub fn bsod(src: BSODSource) -> ! {
let mut mode = SCREEN_BUFFER.lock();
mode.force_redraw();
/*
for y in 0..480 {
for x in 0..640 {
mode.set_pixel(x, y, 0x0000ff00);
}
}
*/
let mut x = 1;
let mut y = 0;
let src1 = match src {
BSODSource::DoubleFault(_) => "DoubleFault",
BSODSource::Panic(_) => "Panic",
};
let st = format!(
"We fucked up ඞ : {:?}\nThe following qr code will link you to the\nwiki which hopefully solves your problems",
src
"We fucked up ඞ : {}\nThe following qr code will link you to the\nwiki which hopefully solves your problems",
src1
);
for current in st.chars() {
@ -238,7 +244,11 @@ fn bsod(stack_frame: &InterruptStackFrame, src: BSODSource) {
// let sf = format!("https://git.ablecorp.us/able/ableos/wiki/Double-Faults");
let sd = match src {
BSODSource::DoubleFault => "https://git.ablecorp.us/able/ableos/wiki/Double-Faults",
BSODSource::DoubleFault(_) => "https://git.ablecorp.us/able/ableos/wiki/Double-Faults",
BSODSource::Panic(_) => {
//
"https://git.ablecorp.us/able/ableos/wiki/"
}
};
let code = QrCode::new(sd).unwrap();
@ -254,23 +264,20 @@ fn bsod(stack_frame: &InterruptStackFrame, src: BSODSource) {
y += 1;
x = 0;
} else {
if x == 0 {
if current == '█' {
mode.draw_filled_rect(x, y * 7, x + 6, (y * 7) + 7, 0xffff0000);
}
} else {
if current == '█' {
mode.draw_filled_rect(x * 6, y * 7, (x * 6) + 6, (y * 7) + 7, 0xffff0000);
}
if current == '█' {
mode.draw_filled_rect(x * 6, y * 7, (x * 6) + 6, (y * 7) + 7, 0xffffff00);
}
}
x += 1;
}
mode.copy_to_buffer();
loop {}
}
#[derive(Debug)]
pub enum BSODSource {
DoubleFault,
pub enum BSODSource<'a> {
DoubleFault(&'a InterruptStackFrame),
Panic(&'a PanicInfo<'a>),
}

View file

@ -15,6 +15,7 @@ pub struct BinaryData {
pub enum HandleResource {
Channel,
Socket,
BinaryData,
}

View file

@ -50,7 +50,7 @@ pub fn kernel_main() -> ! {
x86_64::instructions::interrupts::without_interrupts(|| {
let mut scheduler = SCHEDULER.lock();
// comment this out to resume normal use
scheduler.enqueue_spawn(traceloop);
// scheduler.enqueue_spawn(traceloop);
scheduler.enqueue_spawn(scratchpad);
});

View file

@ -70,6 +70,7 @@ pub mod allocator;
pub mod channels;
pub mod handle;
pub mod ipc;
pub mod panic;
mod unicode_utils;
pub mod vga_e;
@ -81,7 +82,7 @@ pub use experiments::*;
pub use graphics::*;
pub use kernel;
pub use kernel::messaging;
pub use kernel::panic;
// pub use kernel::panic;
pub use kernel_state::*;
pub use keyboard::*;
pub use logger::*;

11
ableos/src/panic.rs Normal file
View file

@ -0,0 +1,11 @@
use core::panic::PanicInfo;
use log::error;
use crate::arch::interrupts::{bsod, BSODSource};
#[panic_handler]
fn panic_handler(info: &PanicInfo) -> ! {
error!("{}", info);
bsod(BSODSource::Panic(info));
}

View file

@ -75,7 +75,9 @@ pub fn scratchpad() {
let axel = axel::parse(axel_raw.to_string());
software_int();
// software_int();
unsafe { asm!("int 5") }
// let xyz = pci::brute_force_scan();
// for dev in xyz {

View file

@ -13,7 +13,7 @@ pub mod allocator;
pub mod arch;
pub mod device_interface;
pub mod messaging;
pub mod panic;
// pub mod panic;
pub mod proccess;
pub mod syscalls;
pub mod time;

View file

@ -6,5 +6,6 @@ use log::error;
#[panic_handler]
fn panic_handler(info: &PanicInfo) -> ! {
error!("{}", info);
loop {}
}