diff options
Diffstat (limited to 'src/Native/Runtime/arm64/ExceptionHandling.asm')
-rw-r--r-- | src/Native/Runtime/arm64/ExceptionHandling.asm | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Native/Runtime/arm64/ExceptionHandling.asm b/src/Native/Runtime/arm64/ExceptionHandling.asm index e08118516..5a548279a 100644 --- a/src/Native/Runtime/arm64/ExceptionHandling.asm +++ b/src/Native/Runtime/arm64/ExceptionHandling.asm @@ -15,15 +15,16 @@ ;; Macro used to create frame of exception throwing helpers (RhpThrowEx, RhpThrowHwEx) MACRO ALLOC_THROW_FRAME $exceptionType - - PROLOG_NOP mov x3, sp + PROLOG_NOP mov x3, sp + ;; Setup a PAL_LIMITED_CONTEXT on the stack { - PROLOG_STACK_ALLOC 0x50 IF $exceptionType == HARDWARE_EXCEPTION + PROLOG_NOP sub sp,sp,#0x50 PROLOG_NOP stp x3, x1, [sp] ; x3 is the SP and x1 is the IP of the fault site PROLOG_PUSH_MACHINE_FRAME ELSE + PROLOG_STACK_ALLOC 0x50 PROLOG_NOP stp x3, lr, [sp] ; x3 is the SP and lr is the IP of the fault site ENDIF PROLOG_NOP stp d8, d9, [sp, #0x10] @@ -49,12 +50,18 @@ MACRO ALLOC_CALL_FUNCLET_FRAME $extraStackSize - PROLOG_SAVE_REG_PAIR fp, lr, #-0x60! + ; Using below prolog instead of PROLOG_SAVE_REG_PAIR fp,lr, #-60! + ; is intentional. Above statement would also emit instruction to save + ; sp in fp. If sp is saved in fp in prolog then it is not expected that fp can change in the body + ; of method. However, this method needs to be able to change fp before calling funclet. + ; This is required to access locals in funclet. + PROLOG_SAVE_REG_PAIR_NO_FP fp,lr, #-0x60! PROLOG_SAVE_REG_PAIR x19, x20, #0x10 PROLOG_SAVE_REG_PAIR x21, x22, #0x20 PROLOG_SAVE_REG_PAIR x23, x24, #0x30 PROLOG_SAVE_REG_PAIR x25, x26, #0x40 PROLOG_SAVE_REG_PAIR x27, x28, #0x50 + PROLOG_NOP mov fp, sp IF $extraStackSize != 0 PROLOG_STACK_ALLOC $extraStackSize @@ -353,6 +360,7 @@ NotHijacked add x1, sp, #rsp_offsetof_ExInfo ;; x1 <- ExInfo* str xzr, [x1, #OFFSETOF__ExInfo__m_exception] ;; pExInfo->m_exception = null + strb wzr, [x1, #OFFSETOF__ExInfo__m_kind] ;; init to a deterministic value (ExKind.None) mov w3, #1 strb w3, [x1, #OFFSETOF__ExInfo__m_passNumber] ;; pExInfo->m_passNumber = 1 mov w3, #0xFFFFFFFF @@ -482,7 +490,7 @@ DonePopping NoAbort ;; reset SP and jump to continuation address mov sp, x2 - ret x0 + br x0 NESTED_END RhpCallCatchFunclet |