how do i add a system call / utility in xv6

前端 未结 3 1238
执笔经年
执笔经年 2020-12-02 21:46

Can any one tell me/ point me any references to how to add a system call / utility in XV6

exhaustive search on google was futile and hacking the hard way also was n

3条回答
  •  生来不讨喜
    2020-12-02 22:07

    To add a system call that can be called in xv6's shell, you should so something with the five files

    • sysproc.c add the real implementation of your method here
    • syscall.h define the position of the system call vector that connect to your implementation
    • user.h define the function that can be called through the shell
    • syscall.c external define the function that connect the shell and the kernel, use the position defined in syscall.h to add the function to the system call vector
    • usys.S use the macro to define connect the call of user to the system call function

    • defs.h add a forward declaration for your new system call

    • sysfunc.h add the new system call handler into this file too like "int sys_newsystemcall(void)"

提交回复
热议问题