-
-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(process): 调整arch_switch_to_user函数,把riscv和x86_64的共用逻辑抽取出来。 #773
refactor(process): 调整arch_switch_to_user函数,把riscv和x86_64的共用逻辑抽取出来。 #773
Conversation
…switch_to_user to run_init_process 调整arch_switch_to_user函数,把riscv和x86_64的共用逻辑抽取出来。写成run_init_process函数,并且能够尝试运行多个不同的init程序,直到某个运行成功
kernel/src/init/initial_kthread.rs
Outdated
|
||
unsafe { arch_switch_to_user(path, argv, envp) }; | ||
unsafe { arch_switch_to_user(trap_frame) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这个函数的调用在switch_to_user
里面更合适,代码功能性区分会更明确一点
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
fn try_to_run_init_process(path: &str) -> Result<(), SystemError> { | ||
if let Err(e) = run_init_process(path.to_string()) { | ||
if e != SystemError::ENOENT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从switch_to_user
来看,init程序的启动是有优先级的,所以我觉得这里的日志应该更完善一点,提示当前是运行哪个init程序,前面的为什么出错。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
会有报错的,在那个exec那里就会报出错误的
…ragonOS-Community#773) * refactor(process): Extract common logic for riscv and x86_64 in arch_switch_to_user to run_init_process 调整arch_switch_to_user函数,把riscv和x86_64的共用逻辑抽取出来。写成run_init_process函数,并且能够尝试运行多个不同的init程序,直到某个运行成功
refactor(process): Extract common logic for riscv and x86_64 in arch_switch_to_user to run_init_process
调整arch_switch_to_user函数,把riscv和x86_64的共用逻辑抽取出来。写成run_init_process函数,并且能够尝试运行多个不同的init程序,直到某个运行成功