Reputation: 1350
I am trying to test my code written for exception handling in ARMv7. I need to test the prefetch abort functionality.I know that This can happen when there is unauthorized access to protected memory regions. But to check that some memory region is protected and trying to access it seems like much tough. Is there any assembly shortcuts or code snippets which will ensure that prefetch abort exception occurs.
Upvotes: 1
Views: 774
Reputation: 7842
If you try to execute code from the memory regions that do not exist, then a prefetch abort shall occur. In other words, it can occur if the program counter is set to an address that isn't valid.
Check the memory map of your device and give the below instruction in your code:
BL non-existent-memory-location
Upvotes: 4