简体   繁体   English

sysproc.c和sysfile.c如何链接到xv6

[英]how sysproc.c and sysfile.c are linked to xv6

I am trying to add a set of system calls to support semaphore in xv6. 我正在尝试添加一组系统调用以支持xv6中的信号量。 I added a syssemaphore.c file(which will be instored with functions that will path the user arguments from the ustack using argptr, argint, etc..) and noticed that I cant find the h file which will link the functions I will write. 我添加了一个syssemaphore.c文件(该文件将与将使用argptr,argint等从ustack传递用户参数的函数一起存储),并注意到找不到用于链接要编写的函数的h文件。 basicly I want to add files like sysproc.c and sysfile.c. 基本上,我想添加sysproc.c和sysfile.c之类的文件。 is it possible? 可能吗?

Adding a new system call to XV6 meaning altering the entire system call mechanism flow, from user space invoking system call interrupt while setting the system call id number in eax register, through syscall function which runs the right system call handler, and finally to the system call implementation (which includes a sys_something function to retrieve user parameters and validate them). 在XV6中添加新的系统调用,意味着改变整个系统调用机制的流程,从用户空间调用系统调用中断,同时在eax寄存器中设置系统调用ID号,通过运行正确的系统调用处理程序的syscall函数,最后到系统调用实现(包括sys_something函数以检索用户参数并对其进行验证)。

If I understand your question correctly, you're new file, syssemaphore.c, includes the sys_something functions that you wish to call from syscall in syscall.c file. 如果我正确理解了您的问题,则您是新文件syssemaphore.c,其中包含希望从syscall.c文件中的syscall调用的sys_something函数。

The syscall function is the only function that should invoke your new sys_something wrappers. syscall函数是唯一应调用新的sys_something包装器的函数。 therefore, it will be sufficient to add those functions prototypes (as extern function) above the syscalls array in syscall.c file, which will then allow you to add your new functions to the syscalls array. 因此,将这些函数原型(作为extern函数)添加到syscall.c文件中syscalls数组上方就足够了,然后,您就可以将新函数添加到syscalls数组中。

See additional information at How to pass a value into system call XV6 请参阅如何将值传递到系统调用XV6中的其他信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM