[NSWI004] A04
Petr Tuma
petr.tuma at d3s.mff.cuni.cz
Sun Nov 22 20:27:21 CET 2020
Hello Georgii,
> You say in the assignment that handle_exception_general_asm pushes exception context on the stack of the currently running thread. But then handle_exception_general is called an as a parameter it has a pointer to an exception_context. Are these contexts the same?
Yes, they are the same contexts. You can check out the comments in `handlers.S` for details.
> Do I need only "cause" register from it?
Looking at the `cause` register certainly makes sense.
> What value in cause indicates that it is indeed an interrupt exception and not something else?
Check out the `cp0_cause_is_interrupt_pending` inline function in `cp0.h`. Also, looking at the processor documentation for the relevant register can help.
> How can I call a register dump?
In the simulator ? You may want to look at the `announce_exception` macro in `head.S`. This is in assembly, but the same can be done in inline assembly in C, or you could just create an assembly function for dumping the registers using the macro and then export it into C. See `machine_halt` and `machine_enter_debugger` functions in `machine.h` for how this is done - both are really one liners so it is trivial to add register dump.
Petr
More information about the NSWI004
mailing list