TA Notes

Lab 5

Problem 3

Problem 4

In Problem 4.2 there has been a modification where a field for length has been added in the struct inusememblk.
Please note with this change you do not need to modify the kernel functions meminsert or memextract prototypes.

Please take a note that there was a change made in Problem 4 on April 5, 2020.

Please make changes for lab 5 using lab 1 as base code.

Lab 4

The technical basis of Problem 4 is about inspecting the relevant stack frames of ctxsw(), quietmalware(), victimA() to determine what is contained where.
From this you will know what to change where to modify return addresses and local variable x.

Please make changes for this lab using code from lab1 as base code.

Lab 3


If you are getting unusually large values for procgrosscpumicro, you should experiment and check if the values are similarly large for all processes.
Please understand how ctxsw works and try to figure out corner cases where your logic might not work. Please exlpain the rationale for your fix.

While using asm with 64-bit return, please be aware that gcc can do some optimizations. Please consider this before using global variables to get the the 64b asm return value.

Note for kprintf

If you are adding a print statement (kprintf) and getting some weird (unexpected) return values or behavior where you suspect print causing them, you should try something of this sort :

Lab 2

If you are adding a print statement (kprintf()) in system calls and getting some weird (unexpected) return values, you should try moving them around or comment them out.

Please replace putc() with kprintf() or kputc() for Problem 3.2.

Please do a clean build (make clean && make) whenever you edit a header file.

Presentation-1.pdf is available at /homes/cs354/Presentation-1.pdf. This is in the course directory, so use terminal to access this.

Helpful link for inline assembly

Lab 1

Using macros

The below code may be added in "./include/process.h" and the macros X[TEST/DEBUG]_KPRINTF can be used instead of #if ... #endif for every kprintf added.

    #define XINUTEST  1 /* set to 1 */ 
    #define XINUDEBUG 0 /* User debug. should be 0 in final turnin */ 
    /* for print required for labs */ 
    #if XINUTEST 
    #define XTEST_KPRINTF(...) kprintf(__VA_ARGS__) 
    #define XTEST_KPRINTF(...) 
    /* User debug */ 
    #if XINUDEBUG 
    #define XDEBUG_KPRINTF(...) kprintf(__VA_ARGS__) 
    #define XDEBUG_KPRINTF(...)