This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
dev:crosscompiler:backend_arm:exceptions [2019/08/05 17:49] – [Java Exceptions] ursgraf | dev:crosscompiler:backend_arm:exceptions [2019/08/15 18:42] – [Java Exceptions] ursgraf | ||
---|---|---|---|
Line 20: | Line 20: | ||
===== Java Exceptions ===== | ===== Java Exceptions ===== | ||
- | ==== Program | + | ==== Supervisor Call Exception ==== |
- | Each Java exception causes a ARM program | + | Each Java exception causes a ARM supervisor call exception. The supervisor call handler receives the thrown exception as a parameter in the first parameter register R0. The code generator has to make sure that this parameter is copied into R0 during the prolog of the program exception handler. The handler does the following: |
- | * Get address of causing instruction into variable //addr// from SRR0. | + | * increment counter |
- | * Read instruction at this address | + | * Get address of causing instruction into variable //addr// from LR. |
- | * Determine from type of instruction which kind of exception was thrown | + | * Read instruction at this address |
+ | * Determine from immediate value of instruction which kind of exception was thrown | ||
* If unchecked instruction: | * If unchecked instruction: | ||
* copy parameter // | * copy parameter // | ||
* copy parameter //addr// into register R3 | * copy parameter //addr// into register R3 | ||
* branch to compiler specific subroutine // | * branch to compiler specific subroutine // | ||
+ | |||
+ | The supervisor call handler can use volatile registers freely. It further uses a few nonvolatile registers. However, these must be saved onto the stack at the start of the method and must be restored at the end. | ||
==== Subroutine handleException ==== | ==== Subroutine handleException ==== |