|
|
@ -14,11 +14,36 @@ mod processor;
|
|
|
|
/// * Debug: 用于Debug输出
|
|
|
|
/// * Debug: 用于Debug输出
|
|
|
|
use arch::interrupt::TrapFrame;
|
|
|
|
use arch::interrupt::TrapFrame;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: 使用宏来更优雅地导入符号,现在会有编译错误
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// #![feature(concat_idents)]
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// macro_rules! binary_symbol {
|
|
|
|
|
|
|
|
// ($name: ident) => {
|
|
|
|
|
|
|
|
// extern {
|
|
|
|
|
|
|
|
// fn concat_idents!(_binary_user_, $name, _start)();
|
|
|
|
|
|
|
|
// fn concat_idents!(_binary_user_, $name, _end)();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// binary_symbol!(forktest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "link_user_program")]
|
|
|
|
|
|
|
|
extern {
|
|
|
|
|
|
|
|
fn _binary_user_forktest_start();
|
|
|
|
|
|
|
|
fn _binary_user_forktest_end();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn init(mc: &mut MemoryController) {
|
|
|
|
pub fn init(mc: &mut MemoryController) {
|
|
|
|
PROCESSOR.call_once(|| {Mutex::new({
|
|
|
|
PROCESSOR.call_once(|| {Mutex::new({
|
|
|
|
let mut processor = Processor::new(mc);
|
|
|
|
let mut processor = Processor::new(mc);
|
|
|
|
let initproc = Process::new_init(mc);
|
|
|
|
let initproc = Process::new_init(mc);
|
|
|
|
let idleproc = Process::new("idle", idle_thread, mc);
|
|
|
|
let idleproc = Process::new("idle", idle_thread, mc);
|
|
|
|
|
|
|
|
#[cfg(feature = "link_user_program")]
|
|
|
|
|
|
|
|
let forktest = Process::new_user(_binary_user_forktest_start as usize,
|
|
|
|
|
|
|
|
_binary_user_forktest_end as usize);
|
|
|
|
processor.add(initproc);
|
|
|
|
processor.add(initproc);
|
|
|
|
processor.add(idleproc);
|
|
|
|
processor.add(idleproc);
|
|
|
|
processor
|
|
|
|
processor
|
|
|
|