Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions src/coreclr/nativeaot/Runtime/arm/ExceptionHandling.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@
#define rsp_offsetof_ExInfo 0
#define rsp_offsetof_Context STACKSIZEOF_ExInfo

.macro PUSH_THROW_FRAME

// Setup a PAL_LIMITED_CONTEXT on the stack {
PROLOG_VPUSH {d8-d15}
push {r0,lr} // Reserve space for SP (or store SP if it is in R0) and store LR
.pad #8
PROLOG_PUSH "{r0,r4-r11,lr}"
add r11, sp, #0x20 // Maintain r11 chain
// } end PAL_LIMITED_CONTEXT

PROLOG_STACK_ALLOC STACKSIZEOF_ExInfo
.endm

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// RhpThrowHwEx
Expand All @@ -29,13 +42,7 @@ NESTED_ENTRY RhpThrowHwEx, _TEXT, NoHandler

mov lr, r1 // set IP of fault site

// Setup a PAL_LIMITED_CONTEXT on the stack {
PROLOG_VPUSH {d8-d15}
PROLOG_PUSH "{r0,lr}" // push {sp, pc} of fault site
PROLOG_PUSH "{r0,r4-r11,lr}"
// } end PAL_LIMITED_CONTEXT

PROLOG_STACK_ALLOC STACKSIZEOF_ExInfo
PUSH_THROW_FRAME

// r0: SP of fault site
// r1: IP of fault site
Expand Down Expand Up @@ -90,13 +97,7 @@ NESTED_END RhpThrowHwEx
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
NESTED_ENTRY RhpThrowEx, _TEXT, NoHandler

// Setup a PAL_LIMITED_CONTEXT on the stack {
PROLOG_VPUSH {d8-d15}
PROLOG_PUSH "{r0,lr}" // Reserve space for SP and store LR
PROLOG_PUSH "{r0,r4-r11,lr}"
// } end PAL_LIMITED_CONTEXT

PROLOG_STACK_ALLOC STACKSIZEOF_ExInfo
PUSH_THROW_FRAME

// Calculate SP at callsite and save into the PAL_LIMITED_CONTEXT
add r4, sp, #(STACKSIZEOF_ExInfo + SIZEOF__PAL_LIMITED_CONTEXT)
Expand Down Expand Up @@ -197,13 +198,7 @@ NESTED_END RhpThrowEx, _TEXT
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
NESTED_ENTRY RhpRethrow, _TEXT, NoHandler

// Setup a PAL_LIMITED_CONTEXT on the stack {
PROLOG_VPUSH {d8-d15}
PROLOG_PUSH "{r0,lr}" // Reserve space for SP and store LR
PROLOG_PUSH "{r0,r4-r11,lr}"
// } end PAL_LIMITED_CONTEXT

PROLOG_STACK_ALLOC STACKSIZEOF_ExInfo
PUSH_THROW_FRAME

// Compute and save SP at callsite.
add r1, sp, #(STACKSIZEOF_ExInfo + SIZEOF__PAL_LIMITED_CONTEXT)
Expand Down
2 changes: 2 additions & 0 deletions src/tests/nativeaot/SmokeTests/Exceptions/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public BringUpTest()

public static int Main()
{
if (Environment.TickCount != 0) throw new Exception();

// This test also doubles as server GC test
if (!System.Runtime.GCSettings.IsServerGC)
return 42;
Expand Down
Loading