This commit is contained in:
husky 2025-09-12 18:25:48 -07:00
parent af5a366b59
commit 8c67690099
10 changed files with 12 additions and 12 deletions

View file

@ -24,7 +24,7 @@ panic = "abort"
opt-level = "z"
debug-assertions = false
overflow-checks = false
strip = true
strip = false
lto = true
codegen-units = 1

View file

@ -1,6 +1,7 @@
fn main() {
let arch = std::env::var("LBOS_ARCH").unwrap_or("virt".to_string());
println!("cargo:rerun-if-env-changed=LBOS_ARCH");
println!("cargo:rerun-if-env-changed=LBOS_FONT");
println!("cargo:rustc-cfg=feature=\"arch_{}\"", arch);
println!("cargo:rerun-if-changed=src/arch/{}/asm", arch);

View file

@ -17,7 +17,7 @@ global_asm!(include_str!("asm/trap.s"));
extern "C" fn eh_personality() {}
#[panic_handler]
//#[cfg(feature = "debug_messages")]
#[cfg(feature = "debug_messages")]
fn panic(info: &core::panic::PanicInfo) -> ! {
use core::fmt::Write;
let mut uart = UART::new(0x1000_0000);
@ -38,7 +38,6 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
}
}
}
/*
#[panic_handler]
#[cfg(not(feature = "debug_messages"))]
fn panic(_info: &core::panic::PanicInfo) -> ! {
@ -52,7 +51,6 @@ fn panic(_info: &core::panic::PanicInfo) -> ! {
}
}
}
*/
pub fn virt_rough_panic(errcode: [char; 3]) -> ! {
let uart = UART::new(0x1000_0000);
for c in b"PANIC".iter() {

View file

@ -1,7 +1,7 @@
use crate::arch::virt::{plic, serial_port};
use crate::rough_panic;
use crate::syscalls::usize2sc;
use crate::trafficcontrol::{TC, context_switch, handle_syscall, MAX_TASKS};
use crate::trafficcontrol::{TC, context_switch, handle_syscall, MAX_TASKS, TrafficControl, Task};
use core::arch::asm;
use crate::spinlock::Spinlock;

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -5,9 +5,10 @@ use core::sync::atomic::Ordering;
pub mod console;
pub const VAPFONT: &[u8] = include_bytes!("./vapfont.data");
pub const VAPFONT_W: usize = 256;
pub const VAPFONT_H: usize = 112;
pub const VAPFONT: &[u8] = include_bytes!(env!("LBOS_FONT"));
pub const VAPFONT_W: usize = 184;
pub const VAPFONT_H: usize = 84;
pub const CHAR_SIZE: usize = 12;
pub struct FBColor {
pub red: u8,
@ -43,15 +44,14 @@ pub fn fb_write_char_array(tc: &mut TrafficControl, mut x: usize, y: usize, char
return;
}
let fbstride = FRAMEBUFFER_BPP.load(Ordering::Relaxed) * FRAMEBUFFER_WIDTH;
const CHAR_SIZE: usize = 16;
for c in chars {
let c = *c;
if c == ' ' {
x += CHAR_SIZE;
} else if c as u8 > 32 {
let c = c as u8 - 32;
let cx = (c % 16) as usize * CHAR_SIZE;
let cy = (c / 16) as usize * CHAR_SIZE;
let c = c as u8 - b'!';
let cx = (c % 15) as usize * CHAR_SIZE;
let cy = (c / 15) as usize * CHAR_SIZE;
for row in 0..CHAR_SIZE {
for col in 0..CHAR_SIZE {
let coff = (VAPFONT_W * (cy + row)) + (cx + col);

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -17,6 +17,7 @@ panic = "abort"
opt-level = "z"
debug-assertions = false
overflow-checks = false
strip = true
lto = true
codegen-units = 1