if let Some(app_inode) = open_file(path.as_str(), OpenFlags::WRONLY) { let all_data = app_inode.read_all(); let process = current_process(); let argc = args_vec.len(); process.exec(all_data.as_slice(), args_vec); // return argc because cx.x[10] will be covered with it later println!("exec argc is {}", argc as isize); argc as isize } else { -1 }
/// BLUE PRINT /// /// 1. LOAD APPLICATION /// 2. SYMBOL RESOLUTION: make sure all symbol has been meet. /// 3. RELOCATION: /// [1] RELOCATION SECTION: /// merges all sections of the same type into a new aggregate section of the same typecombine /// BC we only need SHT_PROGBITS thus not care about others (copy). /// [2] RELOCATE SYMBOL REFERENCES IN SECTIONS: /// Modify references to each symbol in code and data sections so that they point to the correct run-time address