Skip to content

Commit

Permalink
v0.3.0: basic display & console & interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Mar 29, 2022
1 parent c74f03f commit 9342ce3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pkg/kernel/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ target = "config/x86_64-unknown-none.json"
[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins"]

[env]
LOG = "trace"
5 changes: 5 additions & 0 deletions pkg/kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@ pub fn kernal_main(boot_info: &'static BootInfo) -> ! {
x86_64::instructions::interrupts::enable();
info!("Interrupts Enabled.");

trace!("Trace?");
debug!("Debug Test.");
warn!("Warning Test.");
error!("ERROR!!!");

loop {}
}
9 changes: 6 additions & 3 deletions pkg/kernel/src/utils/math.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
extern crate libm;

macro_rules! no_mangle {
/// export functions in libm for float calculate
///
/// ref: https://github.com/rust-lang/compiler-builtins/blob/master/src/math.rs
macro_rules! libm_export {
($(fn $fun:ident($($iid:ident : $ity:ty),+) -> $oty:ty;)+) => {
$(
#[no_mangle]
pub extern "C" fn $fun($($iid: $ity),+) -> $oty {
self::libm::$fun($($iid),+)
libm::$fun($($iid),+)
}
)+
}
}

no_mangle! {
libm_export! {
fn acos(x: f64) -> f64;
fn asin(x: f64) -> f64;
fn cbrt(x: f64) -> f64;
Expand Down

0 comments on commit 9342ce3

Please sign in to comment.