You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
931 B
Rust

#![no_std]
#![no_main]
use core::panic::PanicInfo;
/// Collection of all assembly sources and symbols they expose
mod asm;
/// BIOS disk access utilities
mod disk;
use crate::disk::{get_sector_size, read_lba};
use asm::{do_bios_int, get_boot_drive, get_boot_lba, BiosIntRegs};
use asm::{do_bios_int, BiosIntRegs};
#[no_mangle]
pub extern "C" fn main() -> ! {
print("hi im gay uwu");
loop {}
}
#[panic_handler]
pub fn rust_panic(_info: &PanicInfo) -> ! {
print("stage1 panicked, system halted.\r\n");
loop {
unsafe {
core::arch::asm!("cli", "hlt");
}
}
}
pub fn print(s: &str) {
for b in s.bytes() {
if b == b'\0' {
break;
}
let regs = BiosIntRegs {
eax: 0x0e00 | b as u32,
ebx: 0x0001,
..Default::default()
};
unsafe {
let _ = do_bios_int(0x10, regs);
}
}
}