% cd $HOME/cs350-os161/os161-1.99/kern/conf % ./config ASST2 % cd ../compile/ASST2 % bmake depend % bmake % bmake install
You encountered the DEBUG mechanism in A0, but as a reminder:
DEBUG(DB_EXEC, "ELF: Loading %lu bytes to 0x%lx\n", (unsigned long) filesize, (unsigned long) vaddr);The DEBUG macro and the various flags (like DB_EXEC) are defined in kern/include/lib.h.
u_int32_t dbflags = 0;will turn off all debugging output, while
u_int32_t dbflags = DB_EXEC|DB_THREADS;will turn off everything except DEBUG statements that are labeled with DB_EXEC or DB_THREADS.
Here is something to think about when you do start worrying about those exit status codes: a process's exit status code may be needed long after that process has exited. Where will you keep the code, and when will it be safe to forget it?
#include ‹types.h›will always come first. For more details and rules about #include, see the comments at the top of kern/include/types.h. Symptoms of failure to observe the these rules include complaints about errors in header files during kernel compilation.
#ifndef _LIB_H_ #define _LIB_H_as well as a corresponding
#endif /* _LIB_H_ */at the end of the file. This ensures that lib.h will never be included more than once during a compilation. Every other kernel include file includes similar code, for the same reason. If you add a new header file to your kernel, you should follow a similar convention to ensure that your header will never be included twice. Failure to do so can lead to compilation errors, such as complaints about multiply-defined symbols or variables.
kvaddr = kmalloc(size); /* allocated some memory */ /* do some stuff */ kfree(kvaddr); /* finished with the memory so free it */
You build all of the OS/161 application programs when you run bmake in the directory cs350-os161/os161-1.99. When you do this, the application program executable files are copied into subdirectories under cs350-os161/root/.
Once your OS/161 kernel has booted, you can launch an application program using the p command from the kernel menu. For example, to run the palin program, which is located in testbin, use the following command
OS/161 kernel [? for menu]: p testbin/palinAs usual, you can pass commands to the kernel on sys161 command line, e.g.,
sys161 kernel "p testbin/palin"
# Old/default value # 31 mainboard ramsize=524288 cpus=1 # Changed to 4 MB. 31 mainboard ramsize=4194304 cpus=1In particular, you will probably have to do this for applications like forktest, farm and sty.