diff --git a/Cargo.toml b/Cargo.toml index 742c4f0..1faad45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,6 @@ version = "0.1.0" authors = ["ishanjain28 "] [dependencies] + +[package.metadata.bootimage] +default-target = "x86_64-os.json" diff --git a/src/main.rs b/src/main.rs index 7f32eb4..792c807 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,18 @@ pub fn panic(_info: &PanicInfo) -> ! { loop {} } +static HELLO: &[u8] = b"Hello World!"; + #[no_mangle] // don't change the name of function in symbol table pub extern "C" fn _start() -> ! { + let vga_buffer = 0xb8000 as *mut u8; + + for (i, &byte) in HELLO.iter().enumerate() { + unsafe { + *vga_buffer.offset(i as isize * 2) = byte; + *vga_buffer.offset(i as isize * 2 + 1) = 0xb; + } + } + loop {} }