1
0
Fork 0
forked from AbleOS/ableos

various bugs added

This commit is contained in:
able 2022-07-29 11:51:54 -05:00
parent a210abca23
commit 48f0ef9699
6 changed files with 73 additions and 69 deletions

View file

@ -57,23 +57,27 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
idt[6].set_handler_fn(floppy_disk_interrupt_handler);
// run `a + b + l + e + o + s print;` in ablescript and its 54 thats why this seemingly arbitrary number was chosen
idt[54].set_handler_fn(software_int_handler);
idt
});
extern "x86-interrupt" fn software_int_handler(stack_frame: InterruptStackFrame) {
println!("EXCEPTION: SOFTWARE INT\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn double_fault_handler(
stack_frame: InterruptStackFrame,
error_code: u64,
// NOTE(able): ignore this always is 0
_error_code: u64,
) -> ! {
bsod(&stack_frame, error_code);
bsod(&stack_frame, BSODSource::DoubleFault);
panic!(
"EXCEPTION: Error code{}\nDOUBLE FAULT\n{:#?}",
error_code, stack_frame
);
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
}
#[naked]
@ -195,7 +199,7 @@ pub fn reset_pit_for_cpu() {
set_pit_3(1000);
}
fn bsod(stack_frame: &InterruptStackFrame, error_code: u64) {
fn bsod(stack_frame: &InterruptStackFrame, src: BSODSource) {
let mut mode = SCREEN_BUFFER.lock();
mode.force_redraw();
@ -206,44 +210,15 @@ fn bsod(stack_frame: &InterruptStackFrame, error_code: u64) {
}
let mut x = 1;
let mut y = 1;
let mut y = 0;
let sf = format!("DF");
let st = format!(
"We fucked up ඞ : {:?}\nThe following qr code will link you to the\nwiki which hopefully solves your problems",
src
);
let code = QrCode::new("DOUBLE FAULT").unwrap();
// let image = code
// .render::<unicode::Dense1x2>()
// .dark_color(unicode::Dense1x2::Light)
// .light_color(unicode::Dense1x2::Dark)
// .build();
let image = code
.render::<char>()
.quiet_zone(false)
.module_dimensions(2, 1)
.build();
// let st = image;
let st = format!("We fucked up ඞ\n{:#?}", stack_frame);
for current in image.chars() {
x += 1;
if current == '\n' {
trace!("{}", y);
y += 1;
x = 1;
} else {
if current == '█' {
mode.draw_filled_rect(x * 6, y * 6, (x * 6) + 6, (y * 6) + 6, 0xffff0000);
}
}
}
let mut x = 0;
let mut y = 6;
for current in st.chars() {
x += 1;
if current == '\n' {
trace!("{}", y);
y += 1;
x = 1;
} else {
@ -253,12 +228,49 @@ fn bsod(stack_frame: &InterruptStackFrame, error_code: u64) {
current,
0xffff0000,
);
// if current == '█' {
// mode.draw_filled_rect(x * 4, y * 4, (x * 4) + 4, (y * 4) + 4, 0xffff0000);
// }
}
x += 1;
}
let mut x = 1;
let mut y = 11;
// 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",
};
let code = QrCode::new(sd).unwrap();
let image = code
.render::<char>()
.quiet_zone(false)
.module_dimensions(2, 1)
.build();
for current in image.chars() {
if current == '\n' {
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);
}
}
}
x += 1;
}
mode.copy_to_buffer();
}
#[derive(Debug)]
pub enum BSODSource {
DoubleFault,
}

View file

@ -49,10 +49,9 @@ 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(scratchpad);
});
@ -60,6 +59,7 @@ pub fn kernel_main() -> ! {
}
pub fn traceloop() {
// TODO: Having an empty function double faults
// let mut last_time = 0.0;
/*

View file

@ -47,6 +47,7 @@ impl log::Log for SimpleLogger {
);
}
/*
TODO: Get a proper socket from IPC instead of this deprecated method
let log_socket_id = SimpleSock::grab_socket("Logger".to_string());
match log_socket_id {
Some(mut log_socket_id) => {

View file

@ -23,6 +23,7 @@ use ext2::sys::inode;
use genfs::OpenOptions;
use genfs::{DirEntry, Fs};
use kernel::proccess::PID;
use kernel::software_int;
use vga::writers::GraphicsWriter;
// TODO: move to a better place
@ -71,8 +72,11 @@ pub fn scratchpad() {
print: (None) -> (None);
foo: (None) -> (Num);
}";
let axel = axel::parse(axel_raw.to_string());
software_int();
// let xyz = pci::brute_force_scan();
// for dev in xyz {
// trace!("{:?}", dev);

View file

@ -18,7 +18,10 @@ pub mod proccess;
pub mod syscalls;
pub mod time;
use core::sync::atomic::{AtomicU64, Ordering::Relaxed};
use core::{
arch::asm,
sync::atomic::{AtomicU64, Ordering::Relaxed},
};
use versioning::Version;
/// The number of ticks since the first CPU was started
@ -38,3 +41,8 @@ pub fn tick() {
TICK.store(data, Relaxed)
}
/// Cause a software interrupt
pub fn software_int() {
unsafe { asm!("int 54") }
}

View file

@ -6,17 +6,7 @@ version = "0.12.0"
edition = "2018"
authors = ["kennytm <kennytm@gmail.com>"]
keywords = ["qrcode"]
repository = "https://github.com/kennytm/qrcode-rust"
readme = "README.md"
documentation = "http://docs.rs/qrcode"
exclude = [".travis.yml", ".gitignore", "test-data/**"]
[badges]
travis-ci = { repository = "kennytm/qrcode-rust" }
coveralls = { repository = "kennytm/qrcode-rust" }
is-it-maintained-issue-resolution = { repository = "kennytm/qrcode-rust" }
is-it-maintained-open-issues = { repository = "kennytm/qrcode-rust" }
maintenance = { status = "passively-maintained" }
[dependencies]
# checked_int_cast = "1"
@ -29,14 +19,3 @@ svg = []
[[bin]]
name = "qrencode"
[[example]]
name = "encode_image"
required-features = ["image"]
[[example]]
name = "encode_string"
[[example]]
name = "encode_svg"
required-features = ["svg"]