Hints for A2

This file may be updated during the term, so check back periodically


Quick Topic Links


General

  • Don't forget to re-configure your kernel for Assignment 2 and to do all of your kernel builds in kern/compile/ASST2
    % cd $HOME/cs350-os161/os161-1.11/kern/conf
    % ./config ASST2
    % cd ../compile/ASST2
    % make depend
    % make
    % make install
    

  • Don't forget that if you add any new source files to the kernel code, you need to update the file kern/conf/conf.kern and you need to reconfigure your kernel. If you don't do this, the code in your new source file will not be included in the kernel build.

  • You may like to have lots of debugging information printing out from your kernel, but we don't want to see mountains of output when we run your kernel. OS/161 provides a DEBUG facility that can help with this problem - you can bury lots of debugging statements in your code, but turn them all off by just changing the value of a single variable. You can even turn them off conditionally by labeling them properly. To use this facility, you just include DEBUG statements in your code instead of kprintf, like this:
    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. To control which DEBUG statements produce output, set the dbflags variable, which is found in kern/lib/kprintf.c. For example, setting
    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.

  • write


    _exit


    passing arguments


    fork


    testing