pub fn new_init() -> Self {
        let kstack=memory::alloc_stacks(7).unwrap();
        //deug!("stack bottom: {:#x}, stack top: {:#x}", kstack.bottom(), kstack.top());
        /*
        //deug!("new_init proc");
        assert_has_not_been_called!();
        let kstack = Box::new([0u8; 1<<12]);
        let stack_bottom = Box::into_raw(kstack);
        let stack_top = (1<<12) + stack_bottom as usize;
        //deug!("stack bottom: {:#x}, stack top: {:#x}", stack_bottom as usize, stack_top);
        // let rsp = unsafe{ (stack_top as *mut TrapFrame).offset(-1) } as usize;
        let kstack = unsafe{ Box::from_raw(stack_bottom) };*/
        Process {
            pid: 0,
            name: "init",
            // kstack: Stack::new().expect("cannot alloc stack in initproc!"),
            kstack: kstack,
            memory_set: None,
            page_table: None,
            status: Status::Running,
            rsp: 0, // will be set at first schedule
            is_user: false,
        }
    }
/// Make the first kernel thread `initproc`
/// Should be called only once
Make the first kernel thread `initproc`
Should be called only once
Make the first kernel thread ` initproc ` Should be called only once
pub fn new_init() -> Self {
        let kstack=memory::alloc_stacks(7).unwrap();
        //deug!("stack bottom: {:#x}, stack top: {:#x}", kstack.bottom(), kstack.top());
        /*
        //deug!("new_init proc");
        assert_has_not_been_called!();
        let kstack = Box::new([0u8; 1<<12]);
        let stack_bottom = Box::into_raw(kstack);
        let stack_top = (1<<12) + stack_bottom as usize;
        //deug!("stack bottom: {:#x}, stack top: {:#x}", stack_bottom as usize, stack_top);
        // let rsp = unsafe{ (stack_top as *mut TrapFrame).offset(-1) } as usize;
        let kstack = unsafe{ Box::from_raw(stack_bottom) };*/
        Process {
            pid: 0,
            name: "init",
            // kstack: Stack::new().expect("cannot alloc stack in initproc!"),
            kstack: kstack,
            memory_set: None,
            page_table: None,
            status: Status::Running,
            rsp: 0, // will be set at first schedule
            is_user: false,
        }
    }
pub fn new_init ( ) -> Self { let kstack = memory :: alloc_stacks ( 7 ) . unwrap ( ) ; //deug!("stack bottom: {:#x}, stack top: {:#x}", kstack.bottom(), kstack.top()); /*
        //deug!("new_init proc");
        assert_has_not_been_called!();
        let kstack = Box::new([0u8; 1<<12]);
        let stack_bottom = Box::into_raw(kstack);
        let stack_top = (1<<12) + stack_bottom as usize;
        //deug!("stack bottom: {:#x}, stack top: {:#x}", stack_bottom as usize, stack_top);
        // let rsp = unsafe{ (stack_top as *mut TrapFrame).offset(-1) } as usize;
        let kstack = unsafe{ Box::from_raw(stack_bottom) };*/ Process { pid : 0 , name : " " , // kstack: Stack::new().expect("cannot alloc stack in initproc!"), kstack : kstack , memory_set : None , page_table : None , status : Status :: Running , rsp : 0 , // will be set at first schedule is_user : false , } }
Make the first kernel thread `initproc`
Should be called only once
Make the first kernel thread ` initproc ` Should be called only once