abyss/lib.rs
1//! The abyss of kernel that operates hardwares.
2//!
3//! This crate contains collections of hardware communications.
4//!
5//! You might see the codes of this code for your personal study for how x86_64
6//! architecture cooperates with operating systems,
7//! HOWEVER, most of codes in this crate exceeds the scope of the CS330
8//! curriculum, which is why this crate is named "abyss".
9//!
10//! In other words, you are **not** required to understand every line of code in
11//! this crate. Most of its implementation details are not directly covered in
12//! exams or projects. However, some parts that you will explicitly use during
13//! the implementation (e.g., x86 register related contents)
14//! **may be** included in exams.
15//!
16//! If you want to go deeper into the low-level of the operating system, you may
17//! explore the internals of this crate along with the [`OSDev Wiki`].
18//!
19//! **IN PARTICULAR, YOU ARE *NOT* SUPPOSED TO DIRECTLY USE THE MODULES OF
20//! THIS CRATE TO IMPLEMENT THE KEOS PROJECT.**
21//! We are not responsible for any problems occured by (mis)using codes of this
22//! crate directly.
23//!
24//! Instead, you are supposed to see [`keos`] crate to see which modules (or
25//! functions) are available for implementing KeOS Project.
26//!
27//! [`keos`]: ../keos/index.html
28//! [`OSDev wiki`]: <https://wiki.osdev.org/Getting_Started>
29#![no_std]
30#![allow(internal_features, static_mut_refs, clippy::missing_safety_doc)]
31#![feature(
32 alloc_layout_extra,
33 abi_x86_interrupt,
34 core_intrinsics,
35 lang_items,
36 negative_impls,
37 link_llvm_intrinsics
38)]
39
40use core::sync::atomic::AtomicBool;
41
42extern crate alloc;
43
44#[doc(hidden)]
45#[macro_use]
46pub mod kprint;
47#[doc(hidden)]
48pub mod addressing;
49#[doc(hidden)]
50pub mod boot;
51#[doc(hidden)]
52#[macro_use]
53pub mod dev;
54#[doc(hidden)]
55pub mod interrupt;
56#[doc(hidden)]
57pub mod spinlock;
58#[doc(hidden)]
59pub mod syscall;
60#[doc(hidden)]
61pub mod unwind;
62#[doc(hidden)]
63pub mod x86_64;
64
65#[cfg(doc)]
66pub use addressing::{Pa, Va};
67#[cfg(doc)]
68pub use interrupt::GeneralPurposeRegisters;
69#[cfg(doc)]
70pub use interrupt::Registers;
71#[cfg(doc)]
72pub use spinlock::SpinLock;
73#[cfg(doc)]
74pub use x86_64::interrupt::PFErrorCode;
75
76/// Maximum number of CPU the kernel can support.
77pub const MAX_CPU: usize = 4;
78
79#[doc(hidden)]
80pub static QUITE: AtomicBool = AtomicBool::new(false);