completed a basic bootable kernel in rust
This commit is contained in:
1 parent
d1f89d3b33
commit
daa383db59
2 files changed
+14
No files matched your search
@@ -4,3 +4,6 @@ version = "0.1.0"
|
||||
authors = ["ishanjain28 <ishanjain28@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
[package.metadata.bootimage]
|
||||
default-target = "x86_64-os.json"
|
||||
+11
@@ -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 {}
|
||||
}
|
||||
Reference in new issue
Block a user