We have a SYS/BIOS application running on the C6678. We have not previously enabled any Memory Protection however now wish to do so after recent bug investigations have revealed illegal read/write operations (typically to address 0). The effect of these illegal read/write operations was varied; sometimes causing minor bugs, and other times causing exceptions to be raised.
The application is generally stable and the concern is that by enabling memory protection ("Exception.enableExternalMPC = true" in the cfg file) we will generate additional exceptions due to innocuous illegal memory accesses which previously the system would have coped with fine. Ideally we would like to log these illegal memory accesses in the field without the risk of causing an exception, such that we can later retrieve this information for investigation.
We have experimented with returning from the NMI interrupt generated when the memory exception occurs, but if the guidelines regarding the conditions under which it is safe to return are followed (Section 6.2.4. in spru732j.pdf), this may not always be possible. With a simple demo app we can cause the exception to occur in the delay slots of a branch instruction, when interrupts are blocked (IB=1 in the NTSR register), which is one example of when it is not safe to return. This seems to be a perfectly feasible scenario in our actual application.
My question is therefore, is there any way to detect illegal memory accesses without generating an NMI interrupt? Is it possible to configure the memory protection module to raise a different interrupt, which would be safe to return from? Essentially, we would like to log any illegal memory accesses without introducing instability into the application.
Also, I do not have a great understanding of the relationship between the Exception module (which we seem to be able to use to detect memory accesses to invalid addresses) and the MemoryProtect module (which we haven't yet experimented with, but I presume can be used to protect access to valid addresses?). Is that broadly correct?