mirror of
https://gitlab.com/bztsrc/bootboot.git
synced 2023-02-13 20:54:32 -05:00
Minor fixes to the rust mykernel
This commit is contained in:
parent
d0c66e7097
commit
58ce2515c0
1 changed files with 6 additions and 21 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* mykernel/rust/src/main.rs
|
* mykernel/rust/src/main.rs
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 - 2021 Vinay Chandra
|
* Copyright (C) 2017 - 2022 Vinay Chandra, Valkony Balázs
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person
|
* Permission is hereby granted, free of charge, to any person
|
||||||
* obtaining a copy of this software and associated documentation
|
* obtaining a copy of this software and associated documentation
|
||||||
|
@ -32,9 +32,6 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
#[cfg(not(test))]
|
|
||||||
use core::panic::PanicInfo;
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
@ -55,7 +52,7 @@ fn _start() -> ! {
|
||||||
let bootboot_r = unsafe { & (*(BOOTBOOT_INFO as *const BOOTBOOT)) };
|
let bootboot_r = unsafe { & (*(BOOTBOOT_INFO as *const BOOTBOOT)) };
|
||||||
|
|
||||||
if bootboot_r.fb_scanline > 0 {
|
if bootboot_r.fb_scanline > 0 {
|
||||||
|
|
||||||
//As pointer arithmetic is not possible in rust, use the address as u64
|
//As pointer arithmetic is not possible in rust, use the address as u64
|
||||||
let fb = BOOTBOOT_FB as u64;
|
let fb = BOOTBOOT_FB as u64;
|
||||||
|
|
||||||
|
@ -97,11 +94,11 @@ fn _start() -> ! {
|
||||||
unsafe { *(addr as *mut u64) = 0x000000FF };
|
unsafe { *(addr as *mut u64) = 0x000000FF };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// say hello
|
||||||
|
puts("Hello from a simple BOOTBOOT kernel");
|
||||||
}
|
}
|
||||||
|
|
||||||
// say hello
|
|
||||||
puts("Hello Rust Hobby Kernel");
|
|
||||||
|
|
||||||
// hang for now
|
// hang for now
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
@ -109,9 +106,7 @@ fn _start() -> ! {
|
||||||
/**************************
|
/**************************
|
||||||
* Display text on screen *
|
* Display text on screen *
|
||||||
**************************/
|
**************************/
|
||||||
//TODO: REFACTOR
|
fn puts(string: &'static str) {
|
||||||
|
|
||||||
fn puts(string: &'static str) {
|
|
||||||
use bootboot::*;
|
use bootboot::*;
|
||||||
|
|
||||||
let fb = BOOTBOOT_FB as u64;
|
let fb = BOOTBOOT_FB as u64;
|
||||||
|
@ -155,13 +150,3 @@ fn _start() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
|
||||||
* This function is called on panic. *
|
|
||||||
*************************************/
|
|
||||||
#[cfg(not(test))]
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(_info: &PanicInfo) -> ! {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue