Skip to content

Instantly share code, notes, and snippets.

@agrif
Created July 8, 2020 22:33
Show Gist options
  • Save agrif/6d60e1cc0f1ae6df792c8b0469a66926 to your computer and use it in GitHub Desktop.
Save agrif/6d60e1cc0f1ae6df792c8b0469a66926 to your computer and use it in GitHub Desktop.
#![no_std]
#![no_main]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
fn color(fb: &blueloader_info::Framebuffer, c: (u8, u8, u8)) -> u32 {
use bitintr::Pdep;
let enc = (c.0 as u32).pdep(fb.masks[0])
| (c.1 as u32).pdep(fb.masks[1])
| (c.2 as u32).pdep(fb.masks[2]);
enc
}
blueloader_info::entry_point!(kmain);
fn kmain(info: blueloader_info::BootInfo) -> ! {
let mem = info.framebuffer.as_slice();
for i in 0..mem.len() {
mem[i] = color(&info.framebuffer, (0, 0, 255));
}
loop {
x86_64::instructions::hlt();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment