ableos/kernel/src/lib.rs

50 lines
961 B
Rust
Raw Normal View History

2022-04-11 22:23:11 +00:00
//! The ableOS kernel.
2022-05-07 12:08:34 +00:00
#![feature(alloc_error_handler)]
2022-04-12 23:17:48 +00:00
#![feature(arbitrary_enum_discriminant)]
2022-05-07 12:08:34 +00:00
#![feature(prelude_import)]
#![no_std]
#![deny(missing_docs)]
extern crate alloc;
2022-06-22 18:59:24 +00:00
pub mod aalloc;
2022-05-07 12:08:34 +00:00
pub mod allocator;
2022-06-18 20:00:16 +00:00
pub mod arch;
2022-03-02 14:38:22 +00:00
pub mod device_interface;
pub mod messaging;
2022-07-29 17:48:45 +00:00
// pub mod panic;
2022-03-02 14:38:22 +00:00
pub mod proccess;
pub mod syscalls;
2022-03-02 14:38:22 +00:00
pub mod time;
2022-07-29 16:51:54 +00:00
use core::{
arch::asm,
sync::atomic::{AtomicU64, Ordering::Relaxed},
};
2022-03-02 14:38:22 +00:00
use versioning::Version;
/// The number of ticks since the first CPU was started
2022-07-31 06:54:01 +00:00
// pub static TICK: AtomicU64 = AtomicU64::new(0);
2022-03-02 14:38:22 +00:00
2022-04-11 22:23:11 +00:00
/// Kernel's version
2022-03-02 14:38:22 +00:00
pub const KERNEL_VERSION: Version = Version {
major: 0,
minor: 1,
patch: 2,
};
2022-04-11 22:23:11 +00:00
2022-07-31 06:54:01 +00:00
/*
2022-04-11 22:23:11 +00:00
/// called by arch specific timers to tick up all kernel related functions
pub fn tick() {
let mut data = TICK.load(Relaxed);
data = data.wrapping_add(1);
TICK.store(data, Relaxed)
}
2022-07-31 06:54:01 +00:00
*/
2022-07-29 16:51:54 +00:00
/// Cause a software interrupt
pub fn software_int() {
unsafe { asm!("int 54") }
}