Skip to content

Instantly share code, notes, and snippets.

@itto-ki
Created August 4, 2018 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itto-ki/eff30cbbebb05721dc283331e2052400 to your computer and use it in GitHub Desktop.
Save itto-ki/eff30cbbebb05721dc283331e2052400 to your computer and use it in GitHub Desktop.
#![feature(panic_implementation)]
#![no_std]
use core::panic::PanicInfo;
#[panic_implementation]
#[no_mangle]
pub extern "C" fn panic(_info: &PanicInfo) -> ! {
loop {}
}
#[no_mangle]
pub extern fn kernel_main() -> ! {
let vga_buffer = 0xb8000 as *mut u8;
let hello: &[u8] = b"SawayakanaAsa";
for (i, &byte) in hello.iter().enumerate() {
unsafe {
*vga_buffer.offset(i as isize * 2) = byte;
*vga_buffer.offset(i as isize * 2 + 1) = 0x0b;
}
}
loop {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment