2022-04-11 17:23:11 -05:00
|
|
|
//! The ableOS kernel.
|
|
|
|
|
2022-08-28 15:04:55 -05:00
|
|
|
#![feature(alloc_error_handler, arbitrary_enum_discriminant, prelude_import)]
|
2022-05-07 07:08:34 -05:00
|
|
|
#![no_std]
|
|
|
|
#![deny(missing_docs)]
|
|
|
|
|
|
|
|
extern crate alloc;
|
2022-03-11 13:51:47 -06:00
|
|
|
|
2022-06-22 13:59:24 -05:00
|
|
|
pub mod aalloc;
|
2022-05-07 07:08:34 -05:00
|
|
|
pub mod allocator;
|
2022-06-18 15:00:16 -05:00
|
|
|
pub mod arch;
|
2022-03-02 08:38:22 -06:00
|
|
|
pub mod device_interface;
|
2022-07-29 12:48:45 -05:00
|
|
|
// pub mod panic;
|
2022-03-02 08:38:22 -06:00
|
|
|
pub mod proccess;
|
2022-03-16 05:39:01 -05:00
|
|
|
pub mod syscalls;
|
2022-08-07 16:42:23 -05:00
|
|
|
pub mod task;
|
2022-03-02 08:38:22 -06:00
|
|
|
pub mod time;
|
2022-02-28 08:54:41 -06:00
|
|
|
|
2022-08-01 06:50:41 -05:00
|
|
|
use core::arch::asm;
|
2022-03-02 08:38:22 -06:00
|
|
|
use versioning::Version;
|
|
|
|
|
2022-04-11 15:51:54 -05:00
|
|
|
/// The number of ticks since the first CPU was started
|
2022-07-31 01:54:01 -05:00
|
|
|
// pub static TICK: AtomicU64 = AtomicU64::new(0);
|
2022-03-02 08:38:22 -06:00
|
|
|
|
2022-04-11 17:23:11 -05:00
|
|
|
/// Kernel's version
|
2022-03-02 08:38:22 -06:00
|
|
|
pub const KERNEL_VERSION: Version = Version {
|
|
|
|
major: 0,
|
|
|
|
minor: 1,
|
|
|
|
patch: 2,
|
|
|
|
};
|
2022-04-11 17:23:11 -05:00
|
|
|
|
2022-07-31 01:54:01 -05:00
|
|
|
/*
|
2022-04-11 17:23:11 -05: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 01:54:01 -05:00
|
|
|
*/
|
2022-07-29 11:51:54 -05:00
|
|
|
/// Cause a software interrupt
|
|
|
|
pub fn software_int() {
|
|
|
|
unsafe { asm!("int 54") }
|
|
|
|
}
|