Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
ARM64: Additional debug checks during exception handling (#8342)
Browse files Browse the repository at this point in the history
- Reenable stored register trashing as the debugger has no issues with it.
- Implement missing call to RhpValidateExInfoPop
  • Loading branch information
RalfKornmannEnvision authored Sep 18, 2020
1 parent bb7300d commit 529357b
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/Native/Runtime/arm64/ExceptionHandling.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
// Setup a PAL_LIMITED_CONTEXT on the stack {
.if \exceptionType == HARDWARE_EXCEPTION
sub sp,sp,#0x50
.cfi_adjust_cfa_offset 0x50
stp x3, x1, [sp] // x3 is the SP and x1 is the IP of the fault site
// TODO PROLOG_PUSH_MACHINE_FRAME
.else
PROLOG_STACK_ALLOC 0x50
.cfi_adjust_cfa_offset 0x50
Expand Down Expand Up @@ -169,7 +169,7 @@
// regdisplayReg - register pointing to the REGDISPLAY structure
.macro TRASH_PRESERVED_REGISTERS_STORAGE regdisplayReg

#if 0 // def _DEBUG // @TODO: temporarily removed because trashing the frame pointer breaks the debugger
#if _DEBUG
movz x3, #0xbaad, LSL #48
movk x3, #0xdeed, LSL #32
movk x3, #0xbaad, LSL #16
Expand Down Expand Up @@ -458,7 +458,27 @@ ClearSuccess_Catch:

ldr x2, [sp, #rsp_offset_x2] // x2 <- REGDISPLAY*

// @TODO: add debug-only validation code for ExInfo pop
#ifdef _DEBUG
// Call into some C++ code to validate the pop of the ExInfo. We only do this in debug because we
// have to spill all the preserved registers and then refill them after the call.

str x0, [sp, rsp_offset_x0]

SAVE_PRESERVED_REGISTERS x2

ldr x0, [sp, rsp_CatchFunclet_offset_thread] // x0 <- Thread*
ldr x1, [sp, #rsp_offset_x3] // x1 <- current ExInfo*
ldr x2, [x2, #OFFSETOF__REGDISPLAY__SP] // x2 <- resume SP value
bl RhpValidateExInfoPop

ldr x2, [sp, rsp_offset_x2] // x2 <- REGDISPLAY*

RESTORE_PRESERVED_REGISTERS x2

ldr x0, [sp, rsp_offset_x0] // reload resume IP
#endif

ldr x1, [sp, rsp_CatchFunclet_offset_thread]

ldr x1, [sp, rsp_CatchFunclet_offset_thread]

Expand Down

0 comments on commit 529357b

Please sign in to comment.