#44855 - DekuTree64 - Mon Jun 06, 2005 2:10 am
Since you can use bit13 of P15.c1 to set the exception vector base to either 0xFFFF0000 (where it normally is, in the BIOS) or 0x00000000, and you can map ITCM to address 0x00000000 if you want, I couldn't help but wonder if that meant I could bypass the default BIOS handler altogether.
I finally decided to give it a try just now and lo and behold, it works!
Then you can put a direct branch to your handler at address 0x18 (the IRQ vector) and save the ordeal the BIOS goes through of getting the DTCM address and loading the handler address first.
And if that's not enough fun for you, you can even go so far as to use an msr instruction to switch into FIQ mode to avoid having to store any registers before doing anything. Of course, that means you have to write all your interrupt functions in assembly since normal functions expect r0-r3 and r12 to be free, and FIQ mode bankswaps r8-r14, but anything worthy of shaving off a few cycles this way should be in assembly anyway.
Then when you're all done, just msr back to IRQ, and bx lr to your caller.
This concludes today's issue of How to Waste Your Time.
EDIT: Oops, make that subs pc, lr, #4 instead of bx lr to return to the caller, which swaps back spsr_irq to cpsr, and returns to the right address.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
I finally decided to give it a try just now and lo and behold, it works!
Then you can put a direct branch to your handler at address 0x18 (the IRQ vector) and save the ordeal the BIOS goes through of getting the DTCM address and loading the handler address first.
And if that's not enough fun for you, you can even go so far as to use an msr instruction to switch into FIQ mode to avoid having to store any registers before doing anything. Of course, that means you have to write all your interrupt functions in assembly since normal functions expect r0-r3 and r12 to be free, and FIQ mode bankswaps r8-r14, but anything worthy of shaving off a few cycles this way should be in assembly anyway.
Then when you're all done, just msr back to IRQ, and bx lr to your caller.
This concludes today's issue of How to Waste Your Time.
EDIT: Oops, make that subs pc, lr, #4 instead of bx lr to return to the caller, which swaps back spsr_irq to cpsr, and returns to the right address.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku