Add spin_wait function
Simple pure rust spin wait
This commit is contained in:
@@ -186,16 +186,31 @@ pub extern fn rust_main(multiboot_info_header: usize) {
|
||||
|
||||
//let boot_info = unsafe { multiboot2::load(multiboot_info_header) };
|
||||
|
||||
printstr::write_to_screen(6, "hello you person: {}");
|
||||
printstr::write_to_screen(6, "Gamarjoba munde");
|
||||
|
||||
let mut i: u32 = 0;
|
||||
|
||||
util::spin_wait(100_000_000);
|
||||
|
||||
printstr::write_to_screen(2, "HELLA");
|
||||
|
||||
loop {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 123 |3,2,1
|
||||
mod util {
|
||||
|
||||
pub fn spin_wait(count: u32) {
|
||||
let mut i: u32 = 0;
|
||||
loop {
|
||||
i += 1;
|
||||
if i > count {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn lo_hi_bits(n: u16) -> (u8, u8) {
|
||||
( (n & 0xff) as u8, (n >> 8) as u8)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user