Project 0

CMSC 412, Spring 2005

Due Thursday, February 3 at 6pm

The purpose of this assignment is to get you familiar with the GeekOS development environment (including the BOCHS x86 simulator). The assignment is to write a simple kernel mode thread that does three things:

  1. Prints a message
  2. Reads keyboard input, echoing each key pressed to the terminal, until the user hits control-d.

1  Preparation

You should use the CSIC cluster (see http://www.csic.cs.umd.edu/linuxlab for information on how to login). Your account information is available by logging into the class grade web site (grades.cs.umd.edu) using your campus Directory ID and password.

After logging in, get the Bochs simulator environment and the mini-kernel for GeekOS running in your account. You should download the GeekOS kernel and unpack it in your account. This will create a directory project0. Next, you need to set up your PATH to include the Bochs bin/ directory. On Linuxlab, you should add /usr/local/bochs-2.0.2/bin. At this point, you cd to the directory project0/build and invoke GNU make to build the kernel (GNU make is the default make command on LinuxLab). Once the kernel builds, you can run the simulator by typing bochs and choosing option 5 (which is the default). For this to work, you need a proper .bochsrc in that directory; the version there should be fine for LinuxLab. If you run into trouble, check the GeekOS documentation for more details.


2  Reading and Printing Text

Your first task is to add code to the kernel some code to create a new kernel mode thread. The kernel mode thread should print out ``Hello from xxx'' where xxx is your class account name. To start a new kernel mode thread you use the Start_Kernel_Thread function. Look at the comments in before the definition of this function in geekos/kthread.c.

Next, implement the thread to then call the keyboard input routine Wait_For_Key repeatedly, echoing each character entered, until the termination character (left control-d) is entered. You need only handle left control key when testing for termination character. The KeyCode returned by Wait_For_Key is 16 bits; you need to properly convert this to an 8-bit ASCII value before printing it to the screen.


 


This document was translated from LATEX by HEVEA.