2017-04-11 17:02:21 +04:00
|
|
|
#![feature(lang_items)]
|
2017-11-19 15:41:20 +04:00
|
|
|
#![feature(alloc)]
|
2018-04-25 21:00:32 +04:00
|
|
|
#![feature(naked_functions)]
|
2018-12-16 16:55:04 +04:00
|
|
|
#![feature(untagged_unions)]
|
2018-04-18 17:53:39 +04:00
|
|
|
#![feature(asm)]
|
2018-06-04 21:32:21 +04:00
|
|
|
#![feature(optin_builtin_traits)]
|
2018-06-19 19:43:40 +04:00
|
|
|
#![feature(panic_info_message)]
|
2018-07-04 12:23:11 +04:00
|
|
|
#![feature(global_asm)]
|
2019-04-16 20:46:39 +04:00
|
|
|
#![deny(unused_must_use)]
|
2017-04-11 17:02:21 +04:00
|
|
|
#![no_std]
|
|
|
|
|
2018-11-19 13:21:06 +04:00
|
|
|
// just keep it ...
|
2018-12-16 16:55:04 +04:00
|
|
|
#[macro_use]
|
2017-11-19 15:41:20 +04:00
|
|
|
extern crate alloc;
|
2019-02-22 08:54:42 +04:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
#[macro_use]
|
|
|
|
extern crate lazy_static;
|
2018-06-04 20:34:34 +04:00
|
|
|
|
2019-03-27 14:35:08 +04:00
|
|
|
pub use crate::process::{new_kernel_context, processor};
|
2019-03-18 05:00:51 +04:00
|
|
|
use buddy_system_allocator::LockedHeap;
|
2019-03-27 14:35:08 +04:00
|
|
|
use rcore_thread::std_thread as thread;
|
2018-04-04 16:56:56 +04:00
|
|
|
|
2019-03-27 14:35:08 +04:00
|
|
|
#[macro_use] // print!
|
2018-11-19 13:21:06 +04:00
|
|
|
mod logging;
|
2019-04-04 16:01:59 +04:00
|
|
|
#[macro_use]
|
|
|
|
mod util;
|
2019-03-27 14:35:08 +04:00
|
|
|
mod backtrace;
|
2018-04-12 16:57:56 +04:00
|
|
|
mod consts;
|
2019-03-27 14:35:08 +04:00
|
|
|
mod drivers;
|
2018-05-18 07:49:27 +04:00
|
|
|
mod fs;
|
2019-03-27 14:35:08 +04:00
|
|
|
mod lang;
|
|
|
|
mod memory;
|
|
|
|
mod net;
|
|
|
|
mod process;
|
|
|
|
mod shell;
|
2018-05-31 16:23:26 +04:00
|
|
|
mod sync;
|
2019-03-27 14:35:08 +04:00
|
|
|
mod syscall;
|
2018-07-12 20:00:42 +04:00
|
|
|
mod trap;
|
2017-04-12 21:16:04 +04:00
|
|
|
|
2018-04-04 16:56:56 +04:00
|
|
|
#[allow(dead_code)]
|
|
|
|
#[cfg(target_arch = "x86_64")]
|
|
|
|
#[path = "arch/x86_64/mod.rs"]
|
2018-08-05 13:50:56 +04:00
|
|
|
pub mod arch;
|
2018-04-04 16:56:56 +04:00
|
|
|
|
2019-04-01 07:37:14 +04:00
|
|
|
#[cfg(target_arch = "mips")]
|
2019-03-31 19:31:37 +04:00
|
|
|
#[path = "arch/mipsel/mod.rs"]
|
|
|
|
pub mod arch;
|
|
|
|
|
2018-12-19 21:13:42 +04:00
|
|
|
#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
|
2018-07-04 12:23:11 +04:00
|
|
|
#[path = "arch/riscv32/mod.rs"]
|
2018-08-04 19:08:10 +04:00
|
|
|
pub mod arch;
|
2018-07-04 12:23:11 +04:00
|
|
|
|
2018-10-26 07:21:43 +04:00
|
|
|
#[cfg(target_arch = "aarch64")]
|
|
|
|
#[path = "arch/aarch64/mod.rs"]
|
|
|
|
pub mod arch;
|
|
|
|
|
2018-09-08 21:25:14 +04:00
|
|
|
pub fn kmain() -> ! {
|
2018-11-19 13:21:06 +04:00
|
|
|
processor().run();
|
2018-04-18 08:26:21 +04:00
|
|
|
}
|
|
|
|
|
2018-05-13 11:06:44 +04:00
|
|
|
/// Global heap allocator
|
|
|
|
///
|
|
|
|
/// Available after `memory::init()`.
|
|
|
|
///
|
|
|
|
/// It should be defined in memory mod, but in Rust `global_allocator` must be in root mod.
|
2017-11-19 16:13:18 +04:00
|
|
|
#[global_allocator]
|
2017-11-19 17:16:33 +04:00
|
|
|
static HEAP_ALLOCATOR: LockedHeap = LockedHeap::empty();
|