Assignment 3 (Due 11th of August)
Design and Implementation of an Operating System
In this assignment, we are to design and implement our own operating system.
To make things easier we will use two softwares: VMWare and OSKit.
- VMWare will be used as to test the operating system.
It will only be used as an emulation of the x86 architecture.
Once we compile your operating system code, we can test it
by booting it in VMWare instead of booting a physical machine.
- OSKit will be used to provide some basic functionality to the
operating system such as:
- Boot code: We will not write our own boot code but use existing
code provided by OSKit. For this purpose, look at the sample kernel
$OSKIT_DIR/examples/x86/hello.c. This code includes the boot code and
drops the system into user mode when booted.
- Interrupt Handlers: OSKit provides and easy way to assign custom
interrupt handlers for various interrupt types. We will use OSKit's
Programmable Interrupt Controller (PIC) to assign custom handlers for
keyboard, timer and software interrupts. Read OSKit manual chapter
15 for more details.
- x86 Assembly directives: We will need to use some assembly
instructions at some places in the code especially for context switch.
OSKit can help us easily use x86 asembly instructions within C code.
See chapter 15 of OSKit manual for more details.
- Trap state: OSKit can help a lot with context switching.
On recieving an interrupt, OSKit automatically saves the state of the
hardware registers(and more) into a C structure called trap_state.
This can be used to customize the context switch code. Read chapter
15 of OSKit manual for more details.
Our OS design will be layed and modular. We will have the following layers
in our code in bottom to top fashion:
- Hardware layer: x86 hardware will be emulated by VMWare.
- Boot code: will be provided by OSKit.
- Interrupt Handlers: Here we will write code for three
functions: 1) Keyboard interrupt handler(called when keyboard is used),
2) Timer interrupt handler(called at a periodic interval)
and 3) Soft interrupt handler(called when there is a software
interrupt)
- System Calls: We will implement many system calls for
process management, memory management etc. in this layer of code.
- Application Layer: Here we will have all our application
code including the SHELL program which will be the interface to run the
rest of the applications. All the other application will be included
here as C source files using #include directives.
Refrence Material