Refactor and fix IOP interrupts
This commit fixes some issues preventing IOP interrupts from working correctly while also seperating them into a seperate class for convenience. * Previously the pending flag was written to the first bit of cause.IP, which while correct was flawed. To understandw why let's look at how interrupts get triggered. COP0 has 2 8 bit masks, IP (cause) and Im (status). On both of these registers the first 2 bits are ignored because they are used for software interrupts which are unsupported on the IOP. However while Im was including these unused bits, IP did not thus causing mistaken comparions. Below is a diagram that shows the issue. IP was bits 10-15 while Im was bits 8-15. Comparing diffent ranges like this doesn't work. Cause: ... 00|111111| ... Status: ... |00111111| ... The fix was to make IP point to 8-15 range and adjust the writing mechanism in the INTR::interrupt_pending function. * In addition the usage of >= instead of == in the timers, caused a bug where the timer would continiously send interrupts after reaching target which is not the intended behaviour. Fix that as well.
Showing
- CMakeLists.txt 3 additions, 1 deletionCMakeLists.txt
- src/cpu/ee/ee.cc 8 additions, 0 deletionssrc/cpu/ee/ee.cc
- src/cpu/ee/intc.h 0 additions, 2 deletionssrc/cpu/ee/intc.h
- src/cpu/iop/cop0.h 1 addition, 2 deletionssrc/cpu/iop/cop0.h
- src/cpu/iop/intr.cc 49 additions, 0 deletionssrc/cpu/iop/intr.cc
- src/cpu/iop/intr.h 50 additions, 0 deletionssrc/cpu/iop/intr.h
- src/cpu/iop/iop.cc 7 additions, 23 deletionssrc/cpu/iop/iop.cc
- src/cpu/iop/iop.h 7 additions, 41 deletionssrc/cpu/iop/iop.h
- src/cpu/iop/timers.cc 11 additions, 3 deletionssrc/cpu/iop/timers.cc
Loading
Please register or sign in to comment