use long mode, x86_64-unknown-none works now
This commit is contained in:
21
src/lib.rs
21
src/lib.rs
@@ -6,15 +6,22 @@ use core::panic::PanicInfo;
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn _start() -> ! {
|
||||
// 'k'
|
||||
loop{unsafe {core::arch::asm!(
|
||||
"out dx, al", in("al") 0x6Bu8
|
||||
)}}
|
||||
print("kernel\n");
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn print(s: &str) {
|
||||
let mut bytes = s.bytes();
|
||||
while let Some(b) = bytes.next() {
|
||||
unsafe {core::arch::asm!(
|
||||
"out dx, al"
|
||||
, in("al") b
|
||||
)};
|
||||
};
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_: &PanicInfo) -> ! {
|
||||
// 'p'
|
||||
loop{unsafe {core::arch::asm!(
|
||||
"out dx, al", in("al") 0x70u8
|
||||
)}}
|
||||
print("panicked");
|
||||
loop {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user