Skip to main content
Department of Information Technology

Get Started

Here you will find more detailed information about the files you are given as a starting point for your project. In these files you find examples on how to accomplish:

  • I/O to the Malta TTY console.
  • Output text to the Malta LCD.
  • Handle exceptions and interrupts.
  • Implement system calls using the MIPS syscall instruction.

In these files you will find MIPS assembly code to perform basic tasks and how to call assembly subroutines from C. Assembly directives used by the assembly code are described here.

asm.S

The main functionality lies in asm.S. The execution of your binary will start here. asm.S includes 3 files: regdef.h, cp0_regdef.h and asm_regs.h. These can be found in /it/kurs/compsys/HT2007/include. Include this directory as an include path in your makefile.

asm.S does three things:

  • It provides functions for getting and setting cpu registers.
  • It sets up the MIPS exception vector. The exception vector is a (predefined) starting point for all exceptions. The code inserted will call the exception handler defined in asm.S. This exception handler saves the contents of all registers and calls kexception(), the kernels exception handler. After kexception() returns, it loads the stored registers back in and continues execution.
  • It provides a starting point for your code. After the exception vector has been set up, it calls kinit(), the starting function of the kernel.

C interfaces to these functions, as well as declarations of kexception() and kinit() are in asm.h. Note that these are only declarations: you must write kexception() and kinit().

Updated  2009-04-03 14:25:13 by Karl Marklund.