1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#![feature(lang_items)]
#![feature(const_fn, unique)]
#![feature(alloc)]
#![feature(allocator_api)]
#![feature(asm)]
#![feature(naked_functions)]
#![feature(abi_x86_interrupt)]
#![feature(const_unique_new)]
#![feature(const_max_value)]
#![feature(core_intrinsics)]
#![feature(global_allocator)]
#![no_std]
#[macro_use]
extern crate alloc;
extern crate bit_field;
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate lazy_static;
extern crate linked_list_allocator;
extern crate multiboot2;
#[macro_use]
extern crate once;
extern crate rlibc;
extern crate spin;
extern crate volatile;
extern crate x86_64;
#[macro_use]
mod macros;
pub mod device;
pub mod task;
pub mod syscall;
pub mod arch;
mod runtime_glue;
pub use runtime_glue::*;
#[no_mangle]
pub extern "C" fn kmain(multiboot_information_address: usize) {
unsafe { arch::kinit(multiboot_information_address) };
let proc_closure = || {
let max_procs = 50;
for i in 0..max_procs {
syscall::create(process_test, format!("test_process_{}", i));
}
};
proc_closure();
use alloc::String;
syscall::create(real_main, String::from("real_main"));
loop {}
}
#[no_mangle]
pub extern "C" fn real_main() {
println!("In real main");
}
pub extern "C" fn process_test() {
println!("Inside test process.");
}
use arch::memory::heap_allocator::HeapAllocator;
#[global_allocator]
static HEAP_ALLOCATOR: HeapAllocator = HeapAllocator::new();