Programming Assignment 5

Adding New System Call to Xv6

Objective

In this project, you will add a new system call to Xv6 (book and source listing).

Steps

  1. Download this Linux VM image (xv6.ova) (1.3 GB in size) [with password: xv6] which contains the source code of Xv6 and QEMU (Quick Emulator).
  2. Install VirtualBox on your laptop/desktop, and then start it.
    1. Click `File' to choose `Import Appliance' (choose the xv6.ova file downloaded)
    2. In `Appliance settings,' uncheck "USB Controller"
    3. Click Import
    Windows users: If had trouble running VirtualBox or booting up Xv6, it is likely that CPU virtualization was not enabled in the Windows' BIOS. Please review this link to enable CPU virtualization. You may also watch this video.
  3. After booting up (and logging into) the Linux VM, open a terminal,
        cd xv6-public
        make clean
        make
        make qemu-nox
      
    to boot up an Xv6 VM (within QEMU). To shutdown the Xv6 VM on QEMU, type Ctrl-A and then x (or Ctrl-A, c and quit). You may log into the Linux VM with username cisc361 and password xv6.
  4. Review A New System Call to Xv6 and Adding a User Program to Xv6 to complete the assignment.
Note: There is no C compiler on Xv6. You need to compile any user programs and the (updated) Xv6 kernel itself on the Linux VM.

Assignments

Follow the instructions to add the getyear() system call that returns 2020. Code and execute the following user program.
#include "types.h"
#include "stat.h"
#include "user.h"

int
main(void)
{
  printf(1, "I took CISC 361 in Spring %d\n", getyear());
  exit();
}
Take a photo of your screen showing the output and upload it into Canvas.