You'' need to:
syscall
, that forces a trap.
When the trap occurs, the hardware needs to do all of the following in the current
cycle:
rfe
, that returns from an interrupt
syscall
. (This is the part we'll do in software.)
syscall
and rfe
do the desired things by writing tiny test programs and observing that the machine
jumps to the correct address and that the Status register is updated correctly.
It is much easier to debug on small programs than on the OS.
(The formats of the new instructions are in the Cebollita documentation.)
The SMOK container provides a lot of support for these functions -- you should not have to understand the internals of that component to get this working.
Cause ID | Meaning |
1 | Char device needs attention |
2 | Block device needs attention |
4 | Addressing violation |
6 | Bus error (no such address) |
8 | System call |
9 | Breakpoint |
10 | Privileged instruction |
16 | Integer overflow |
32 | Illegal instruction |
You'll be writing in C++, using a development environment you're not accustomed to, but:
- The code is only a couple dozen lines, in file
ExceptionComponent.cpp
.- All of those lines would be the same in Java (even though this is C++).
See this page. (Some of the images are a version or so out of date, but shouldn't cause any confusion.)
You don't need the component you build to do very much. Its outputs are simply whether or not an exception has occurred (a single, one-bit output) and a cause (a single output a few bits wide). It takes as inputs whatever you find is needed to compute those outputs. (Note that the cause output is a "don't care" if there is no exception.) You code should not be very long.
One last thing: if you REALLY want to you can avoid C++ and Visual Studio and just build this entire step in logic. I think it will be easier to take he approach suggested, though, even if you don't know C++ and Visual Studio.