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

View file

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

View file

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

View file

@ -70,6 +70,7 @@ pub mod allocator;
pub mod channels; pub mod channels;
pub mod handle; pub mod handle;
pub mod ipc; pub mod ipc;
pub mod panic;
mod unicode_utils; mod unicode_utils;
pub mod vga_e; pub mod vga_e;
@ -81,7 +82,7 @@ pub use experiments::*;
pub use graphics::*; pub use graphics::*;
pub use kernel; pub use kernel;
pub use kernel::messaging; pub use kernel::messaging;
pub use kernel::panic; // pub use kernel::panic;
pub use kernel_state::*; pub use kernel_state::*;
pub use keyboard::*; pub use keyboard::*;
pub use logger::*; 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()); let axel = axel::parse(axel_raw.to_string());
software_int(); // software_int();
unsafe { asm!("int 5") }
// let xyz = pci::brute_force_scan(); // let xyz = pci::brute_force_scan();
// for dev in xyz { // for dev in xyz {

View file

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

View file

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