OS/161 is a teaching operating system, that is, a simplified system used for teaching undergraduate operating systems classes. It is BSD-like in feel and has more "reality" than most other teaching OSes; while it runs on a simulator it has the structure and design of a larger system.
More info here: http://os161.eecs.harvard.edu
-
Create a file in kern/main/yourfile.c and write a function
-
Modify kern/main/main.c entering a call to your function
-
In test.h:
#include "opt-yourfile.h" //(opt-optname.h) Insert a prototype of your function
-
Modify kern/conf/conf.kern inserting the new file (#Startup and initialization):
defoption yourfile optfile yourfile main/yourfile.c
-
Generate in kern/conf a new file (for example YOURFILE)
It can be a copy of DUMBVM adding a new line: "options yourfile"
-
Finally do the make of the kernel:
In kern/conf ./config YOURFILE In kern/compile/YOURFILE bmake depend bmake bmake install
-
In kern/arch/mips/syscall/syscall.c there is switch case in which you can menage the system calls
-
To menage a system call it's necessary an integer code. See:
kern/include/kern/syscall.h
-
Create your system call in kern/syscall/my_syscalls.c
-
Modify kern/include/syscall.h adding a prototype of the syscall function
-
Modify kern/conf/conf.kern inserting the new file (#System call layer):
file syscall/my_syscalls.c
-
Finally do the make of the kernel
In kern/conf ./config DUMBVM In kern/compile/DUMBVM bmake depend bmake bmake install