I am attempting to create a simple priority based scheduler in XV6. To do this, I also have to create a system call that will allow a process to set its priority. I have done
Passing arguments from user-level functions to kernel-level functions cannot be done in XV6. XV6 has its own built-in functions for passing arguments into a kernel function. For instance, to pass in an integer, the argint() function is called. In the implementation that I used for the set-priority function, that would look something like:
argint(0, &pid);
... to get the first argument which is the Process ID, and:
argint(1, &pty);
... to get the second argument which is the desired priority. The function call from the user process looks like this:
setpty(getpid(), priority);