Skip to content
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

重构系统调用模块 #267

Merged
merged 7 commits into from
May 24, 2023

Conversation

fslongjin
Copy link
Member

@fslongjin fslongjin commented May 23, 2023

重构了系统调用模块。
主要设计为:

  • 为Syscall模块抽离出Arch层,将具体的处理器架构与通用的系统调用处理逻辑进行剥离。(见syscall_handler函数)
  • syscall/mod.rs下,新增了一个syscall_dispatcher,用于分发系统调用。这个函数内需要对用户态传入的指针参数,进行越界检查,防止访问到内核空间。

目前存在的问题:

  • 有几个系统调用,主要是进程管理模块的,由于进程管理模块设计时未充分考虑架构移植性,导致相关的几个系统调用被特殊处理,这需要之后解决:
    • SYS_FORK
    • SYS_VFORK
    • SYS_EXECVE
    • SYS_RT_SIGRETURN
  • 目前发现以下几个系统调用的行为不符合Posix,与Linux不一致,需要接下来修改或删除:
    • SYS_CLOCK
    • SYS_MSTAT
    • SYS_PUT_STRING

关于上面说的“特殊处理”,指的是:
因为这几个函数要直接操作pt_regs,但是我新的设计不允许直接操作pt_regs,避免系统调用与架构耦合。linux里面,他们这几个函数不用直接操作pt_regs。因此我目前就是那几个系统调用,没有走通用的系统调用处理的方法,而是特判了一下

@fslongjin fslongjin requested a review from houmkh May 23, 2023 11:29
@fslongjin fslongjin merged commit ab5c8ca into DragonOS-Community:master May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant