To understand the process of adding and using a syscall in Xv6.
Add a syscall to Xv6 that prints the little lad dance to the console when called.
Most steps have an associated question in Gradescope, so make sure to follow along. The question will be in reference to the same file the step has you editing.
Add the following line to the end of 'syscall.h':
#define SYS_littlelad 22
In 'syscall.c' at the end of the static int (*syscalls[])(void)
list on lines 108-130, add the following:
[SYS_littlelad] sys_littlelad
Still in 'syscall.c', add the following after line 105:
extern int sys_littlelad(void);
In 'sysproc.c' add the following function:
//does the little lad dance
int
sys_littlelad(void)
{
littlelad();
return 0;
}
In 'usys.S', add the following line to the end:
SYSCALL(littlelad)
In 'user.h' add the following line under the function stubs labelled 'system calls':
int littlelad(void);
In 'proc.c' add the following function:
void
littlelad(void)
{
cprintf("Berries and cream, berries and cream, I'm a little lad who loves berries and cream!\n");
}
Lastly, in 'defs.h' add the following in the list of function definitions labelled 'proc.c':
void littlelad(void);