Skip to content

Commit a36c365

Browse files
filipnavaratmds
authored andcommitted
[NativeAOT] Linux/ARM bring-up (3/n) (dotnet#97104)
* Mask thumb bit when setting IP in a context (eg. palContext->SetIp((uintptr_t)&RhpThrowHwEx)) * Set ExInfo.m_pExContext in RhpThrowHwEx * Remove REGDISPLAY.GetAddrOfIP and it's only usage * Resolve ARM relocations (also workarounds LLD bug with thumb bit present both in addend and in symbol value) * Remove REGDISPLAY.pIP/SetAddrOfIP * Make most of the assembly code PIE compatible * NativeAOT: Enable DFEATURE_64BIT_ALIGNMENT on linux-arm * Enable NativeAOT linux-arm build * Enable DWARF exception handling for linux-arm * Fix UnwindFuncletInvokeThunk to skip over r2 register saved on stack by RhpCallFilterFunclet * Fix signature of P/Invoke native code in SafeHandleTest to match the managed one * Implement missing StackFrameIterator::InternalInit code for ARM * Fix thumb bit masking in InInterfaceDispatchHelper * Workaround: Ensure the Thumb bit is set when looking up method info in DWARF. We would fail to lookup methods at their first instruction otherwise. * Correctly convert the addend for IMAGE_REL_BASED_THUMB_MOV32[_PCREL] into the ELF relocations * Simplify CMake condition * Simplify NativeAotSupported conditions * Fix typo * Fix IMAGE_REL_BASED_THUMB_MOV32 conversion to ELF
1 parent a8b071f commit a36c365

File tree

26 files changed

+161
-170
lines changed

26 files changed

+161
-170
lines changed

eng/Subsets.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112

113113
<PropertyGroup>
114114
<!-- CLR NativeAot only builds in a subset of the matrix -->
115-
<NativeAotSupported Condition="('$(TargetOS)' == 'windows' or '$(TargetOS)' == 'linux' or '$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'freebsd') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64')">true</NativeAotSupported>
115+
<NativeAotSupported Condition="('$(TargetOS)' == 'windows' or '$(TargetOS)' == 'linux' or '$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'freebsd') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">true</NativeAotSupported>
116116

117117
<!-- If we're building clr.nativeaotlibs and not building the CLR runtime, compile libraries against NativeAOT CoreLib -->
118118
<UseNativeAotCoreLib Condition="'$(TestNativeAot)' == 'true' or ($(_subset.Contains('+clr.nativeaotlibs+')) and !$(_subset.Contains('+clr.native+')) and !$(_subset.Contains('+clr.runtime+')))">true</UseNativeAotCoreLib>

src/coreclr/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ add_subdirectory(tools/aot/jitinterface)
147147

148148
if(NOT CLR_CROSS_COMPONENTS_BUILD)
149149
# NativeAOT only buildable for a subset of CoreCLR-supported configurations
150-
if(CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64)
150+
if(CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64 OR CLR_CMAKE_HOST_ARCH_ARM)
151151
add_subdirectory(nativeaot)
152152
endif()
153153
endif(NOT CLR_CROSS_COMPONENTS_BUILD)

src/coreclr/nativeaot/Runtime/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
239239
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
240240
add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
241241
endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
242+
if(CLR_CMAKE_TARGET_ARCH_ARM)
243+
add_definitions(-DFEATURE_64BIT_ALIGNMENT)
244+
endif(CLR_CMAKE_TARGET_ARCH_ARM)
242245

243246
add_definitions(-DFEATURE_CUSTOM_IMPORTS)
244247
add_definitions(-DFEATURE_DYNAMIC_CODE)

src/coreclr/nativeaot/Runtime/EHHelpers.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "rhbinder.h"
2828
#include "MethodTable.h"
2929
#include "MethodTable.inl"
30+
#include "CommonMacros.inl"
3031

3132
COOP_PINVOKE_HELPER(FC_BOOL_RET, RhpEHEnumInitFromStackFrameIterator, (
3233
StackFrameIterator* pFrameIter, void ** pMethodStartAddressOut, EHEnum* pEHEnum))
@@ -327,7 +328,7 @@ static bool InWriteBarrierHelper(uintptr_t faultingIP)
327328
ASSERT(*(uint8_t*)writeBarrierAVLocations[i] != 0xE9); // jmp XXXXXXXX
328329
#endif
329330

330-
if (writeBarrierAVLocations[i] == faultingIP)
331+
if (PCODEToPINSTR(writeBarrierAVLocations[i]) == faultingIP)
331332
return true;
332333
}
333334
#endif // USE_PORTABLE_HELPERS
@@ -368,7 +369,7 @@ static bool InInterfaceDispatchHelper(uintptr_t faultingIP)
368369
ASSERT(*(uint8_t*)interfaceDispatchAVLocations[i] != 0xE9); // jmp XXXXXXXX
369370
#endif
370371

371-
if (interfaceDispatchAVLocations[i] == faultingIP)
372+
if (PCODEToPINSTR(interfaceDispatchAVLocations[i]) == faultingIP)
372373
return true;
373374
}
374375
#endif // USE_PORTABLE_HELPERS
@@ -458,7 +459,7 @@ int32_t __stdcall RhpHardwareExceptionHandler(uintptr_t faultCode, uintptr_t fau
458459
{
459460
*arg0Reg = faultCode;
460461
*arg1Reg = faultingIP;
461-
palContext->SetIp((uintptr_t)&RhpThrowHwEx);
462+
palContext->SetIp(PCODEToPINSTR((PCODE)&RhpThrowHwEx));
462463

463464
return EXCEPTION_CONTINUE_EXECUTION;
464465
}
@@ -542,7 +543,7 @@ int32_t __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs)
542543

543544
if (translateToManagedException)
544545
{
545-
pExPtrs->ContextRecord->SetIp((uintptr_t)&RhpThrowHwEx);
546+
pExPtrs->ContextRecord->SetIp(PCODEToPINSTR((PCODE)&RhpThrowHwEx));
546547
pExPtrs->ContextRecord->SetArg0Reg(faultCode);
547548
pExPtrs->ContextRecord->SetArg1Reg(faultingIP);
548549

src/coreclr/nativeaot/Runtime/StackFrameIterator.cpp

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ void StackFrameIterator::InternalInit(Thread * pThreadToWalk, PInvokeTransitionF
179179
#if !defined(USE_PORTABLE_HELPERS) // @TODO: no portable version of regdisplay
180180
memset(&m_RegDisplay, 0, sizeof(m_RegDisplay));
181181
m_RegDisplay.SetIP((PCODE)pFrame->m_RIP);
182-
m_RegDisplay.SetAddrOfIP((PTR_PCODE)PTR_HOST_MEMBER(PInvokeTransitionFrame, pFrame, m_RIP));
183-
SetControlPC(dac_cast<PTR_VOID>(*(m_RegDisplay.pIP)));
182+
SetControlPC(dac_cast<PTR_VOID>(m_RegDisplay.GetIP()));
184183

185184
PTR_UIntNative pPreservedRegsCursor = (PTR_UIntNative)PTR_HOST_MEMBER(PInvokeTransitionFrame, pFrame, m_PreservedRegs);
186185

@@ -388,7 +387,6 @@ void StackFrameIterator::InternalInit(Thread * pThreadToWalk, PTR_PAL_LIMITED_CO
388387
SetControlPC(dac_cast<PTR_VOID>(pCtx->GetIp()));
389388
m_RegDisplay.SP = pCtx->GetSp();
390389
m_RegDisplay.IP = pCtx->GetIp();
391-
m_RegDisplay.pIP = PTR_TO_MEMBER(PAL_LIMITED_CONTEXT, pCtx, IP);
392390

393391
#ifdef TARGET_ARM
394392
//
@@ -540,8 +538,6 @@ void StackFrameIterator::InternalInit(Thread * pThreadToWalk, NATIVE_CONTEXT* pC
540538

541539
#ifdef TARGET_ARM64
542540

543-
m_RegDisplay.pIP = (PTR_PCODE)PTR_TO_REG(pCtx, Pc);
544-
545541
//
546542
// preserved regs
547543
//
@@ -583,8 +579,6 @@ void StackFrameIterator::InternalInit(Thread * pThreadToWalk, NATIVE_CONTEXT* pC
583579

584580
#elif defined(TARGET_X86) || defined(TARGET_AMD64)
585581

586-
m_RegDisplay.pIP = (PTR_PCODE)PTR_TO_REG(pCtx, Rip);
587-
588582
//
589583
// preserved regs
590584
//
@@ -611,6 +605,19 @@ void StackFrameIterator::InternalInit(Thread * pThreadToWalk, NATIVE_CONTEXT* pC
611605
m_RegDisplay.pR10 = (PTR_UIntNative)PTR_TO_REG(pCtx, R10);
612606
m_RegDisplay.pR11 = (PTR_UIntNative)PTR_TO_REG(pCtx, R11);
613607
#endif // TARGET_AMD64
608+
#elif defined(TARGET_ARM)
609+
610+
m_RegDisplay.pR0 = (PTR_UIntNative)PTR_TO_REG(pCtx, R0);
611+
m_RegDisplay.pR1 = (PTR_UIntNative)PTR_TO_REG(pCtx, R1);
612+
m_RegDisplay.pR4 = (PTR_UIntNative)PTR_TO_REG(pCtx, R4);
613+
m_RegDisplay.pR5 = (PTR_UIntNative)PTR_TO_REG(pCtx, R5);
614+
m_RegDisplay.pR6 = (PTR_UIntNative)PTR_TO_REG(pCtx, R6);
615+
m_RegDisplay.pR7 = (PTR_UIntNative)PTR_TO_REG(pCtx, R7);
616+
m_RegDisplay.pR8 = (PTR_UIntNative)PTR_TO_REG(pCtx, R8);
617+
m_RegDisplay.pR9 = (PTR_UIntNative)PTR_TO_REG(pCtx, R9);
618+
m_RegDisplay.pR10 = (PTR_UIntNative)PTR_TO_REG(pCtx, R10);
619+
m_RegDisplay.pR11 = (PTR_UIntNative)PTR_TO_REG(pCtx, R11);
620+
m_RegDisplay.pLR = (PTR_UIntNative)PTR_TO_REG(pCtx, Lr);
614621
#else
615622
PORTABILITY_ASSERT("StackFrameIterator::InternalInit");
616623
#endif // TARGET_ARM
@@ -779,10 +786,9 @@ void StackFrameIterator::UnwindFuncletInvokeThunk()
779786
#ifdef TARGET_X86
780787
// First, unwind RhpCallFunclet
781788
SP = (PTR_UIntNative)(m_RegDisplay.SP + 0x4); // skip the saved assembly-routine-EBP
782-
m_RegDisplay.SetAddrOfIP(SP);
783789
m_RegDisplay.SetIP(*SP++);
784790
m_RegDisplay.SetSP((uintptr_t)dac_cast<TADDR>(SP));
785-
SetControlPC(dac_cast<PTR_VOID>(*(m_RegDisplay.pIP)));
791+
SetControlPC(dac_cast<PTR_VOID>(m_RegDisplay.GetIP()));
786792

787793
ASSERT(
788794
EQUALS_RETURN_ADDRESS(m_ControlPC, RhpCallCatchFunclet2) ||
@@ -908,12 +914,12 @@ void StackFrameIterator::UnwindFuncletInvokeThunk()
908914

909915
SP = (PTR_UIntNative)d;
910916

917+
// RhpCallCatchFunclet puts a couple of extra things on the stack that aren't put there by the other two
918+
// thunks, but we don't need to know what they are here, so we just skip them.
919+
SP += EQUALS_RETURN_ADDRESS(m_ControlPC, RhpCallCatchFunclet2) ? 3 : 1;
920+
911921
if (!isFilterInvoke)
912922
{
913-
// RhpCallCatchFunclet puts a couple of extra things on the stack that aren't put there by the other two
914-
// thunks, but we don't need to know what they are here, so we just skip them.
915-
SP += EQUALS_RETURN_ADDRESS(m_ControlPC, RhpCallCatchFunclet2) ? 3 : 1;
916-
917923
// Save the preserved regs portion of the REGDISPLAY across the unwind through the C# EH dispatch code.
918924
m_funcletPtrs.pR4 = m_RegDisplay.pR4;
919925
m_funcletPtrs.pR5 = m_RegDisplay.pR5;
@@ -966,7 +972,6 @@ void StackFrameIterator::UnwindFuncletInvokeThunk()
966972

967973
m_RegDisplay.pFP = SP++;
968974

969-
m_RegDisplay.SetAddrOfIP((PTR_PCODE)SP);
970975
m_RegDisplay.SetIP(*SP++);
971976

972977
m_RegDisplay.pX19 = SP++;
@@ -986,12 +991,11 @@ void StackFrameIterator::UnwindFuncletInvokeThunk()
986991
#endif
987992

988993
#if !defined(TARGET_ARM64)
989-
m_RegDisplay.SetAddrOfIP((PTR_PCODE)SP);
990994
m_RegDisplay.SetIP(*SP++);
991995
#endif
992996

993997
m_RegDisplay.SetSP((uintptr_t)dac_cast<TADDR>(SP));
994-
SetControlPC(dac_cast<PTR_VOID>(*(m_RegDisplay.pIP)));
998+
SetControlPC(dac_cast<PTR_VOID>(m_RegDisplay.GetIP()));
995999

9961000
// We expect to be called by the runtime's C# EH implementation, and since this function's notion of how
9971001
// to unwind through the stub is brittle relative to the stub itself, we want to check as soon as we can.
@@ -1170,10 +1174,9 @@ void StackFrameIterator::UnwindUniversalTransitionThunk()
11701174
stackFrame->UnwindNonVolatileRegisters(&m_RegDisplay);
11711175

11721176
PTR_UIntNative addressOfPushedCallerIP = stackFrame->get_AddressOfPushedCallerIP();
1173-
m_RegDisplay.SetAddrOfIP((PTR_PCODE)addressOfPushedCallerIP);
11741177
m_RegDisplay.SetIP(*addressOfPushedCallerIP);
11751178
m_RegDisplay.SetSP((uintptr_t)dac_cast<TADDR>(stackFrame->get_CallerSP()));
1176-
SetControlPC(dac_cast<PTR_VOID>(*(m_RegDisplay.pIP)));
1179+
SetControlPC(dac_cast<PTR_VOID>(m_RegDisplay.GetIP()));
11771180

11781181
// All universal transition cases rely on conservative GC reporting being applied to the
11791182
// full argument set that flowed into the call. Report the lower bound of this range (the
@@ -1262,7 +1265,6 @@ void StackFrameIterator::UnwindThrowSiteThunk()
12621265
ASSERT_UNCONDITIONALLY("NYI for this arch");
12631266
#endif
12641267

1265-
m_RegDisplay.SetAddrOfIP(PTR_TO_MEMBER(PAL_LIMITED_CONTEXT, pContext, IP));
12661268
m_RegDisplay.SetIP(pContext->IP);
12671269
m_RegDisplay.SetSP(pContext->GetSp());
12681270
SetControlPC(dac_cast<PTR_VOID>(pContext->IP));
@@ -1355,7 +1357,7 @@ void StackFrameIterator::NextInternal()
13551357
// if the thread is safe to walk, it better not have a hijack in place.
13561358
ASSERT(!m_pThread->IsHijacked());
13571359

1358-
SetControlPC(dac_cast<PTR_VOID>(*(m_RegDisplay.GetAddrOfIP())));
1360+
SetControlPC(dac_cast<PTR_VOID>(m_RegDisplay.GetIP()));
13591361

13601362
PTR_VOID collapsingTargetFrame = NULL;
13611363

src/coreclr/nativeaot/Runtime/amd64/AsmOffsetsCpu.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,28 @@ PLAT_ASM_OFFSET(90, REGDISPLAY, Xmm)
7171

7272
#else // !UNIX_AMD64_ABI
7373

74-
PLAT_ASM_SIZEOF(1b0, ExInfo)
74+
PLAT_ASM_SIZEOF(1a8, ExInfo)
7575
PLAT_ASM_OFFSET(0, ExInfo, m_pPrevExInfo)
7676
PLAT_ASM_OFFSET(8, ExInfo, m_pExContext)
7777
PLAT_ASM_OFFSET(10, ExInfo, m_exception)
7878
PLAT_ASM_OFFSET(18, ExInfo, m_kind)
7979
PLAT_ASM_OFFSET(19, ExInfo, m_passNumber)
8080
PLAT_ASM_OFFSET(1c, ExInfo, m_idxCurClause)
8181
PLAT_ASM_OFFSET(20, ExInfo, m_frameIter)
82-
PLAT_ASM_OFFSET(1a8, ExInfo, m_notifyDebuggerSP)
82+
PLAT_ASM_OFFSET(1a0, ExInfo, m_notifyDebuggerSP)
8383

8484
PLAT_ASM_OFFSET(0, PInvokeTransitionFrame, m_RIP)
8585
PLAT_ASM_OFFSET(8, PInvokeTransitionFrame, m_FramePointer)
8686
PLAT_ASM_OFFSET(10, PInvokeTransitionFrame, m_pThread)
8787
PLAT_ASM_OFFSET(18, PInvokeTransitionFrame, m_Flags)
8888
PLAT_ASM_OFFSET(20, PInvokeTransitionFrame, m_PreservedRegs)
8989

90-
PLAT_ASM_SIZEOF(188, StackFrameIterator)
90+
PLAT_ASM_SIZEOF(180, StackFrameIterator)
9191
PLAT_ASM_OFFSET(10, StackFrameIterator, m_FramePointer)
9292
PLAT_ASM_OFFSET(18, StackFrameIterator, m_ControlPC)
9393
PLAT_ASM_OFFSET(20, StackFrameIterator, m_RegDisplay)
94-
PLAT_ASM_OFFSET(178, StackFrameIterator, m_OriginalControlPC)
95-
PLAT_ASM_OFFSET(180, StackFrameIterator, m_pPreviousTransitionFrame)
94+
PLAT_ASM_OFFSET(170, StackFrameIterator, m_OriginalControlPC)
95+
PLAT_ASM_OFFSET(178, StackFrameIterator, m_pPreviousTransitionFrame)
9696

9797
PLAT_ASM_SIZEOF(50, PAL_LIMITED_CONTEXT)
9898
PLAT_ASM_OFFSET(0, PAL_LIMITED_CONTEXT, IP)
@@ -108,7 +108,7 @@ PLAT_ASM_OFFSET(38, PAL_LIMITED_CONTEXT, R13)
108108
PLAT_ASM_OFFSET(40, PAL_LIMITED_CONTEXT, R14)
109109
PLAT_ASM_OFFSET(48, PAL_LIMITED_CONTEXT, R15)
110110

111-
PLAT_ASM_SIZEOF(90, REGDISPLAY)
111+
PLAT_ASM_SIZEOF(88, REGDISPLAY)
112112
PLAT_ASM_OFFSET(78, REGDISPLAY, SP)
113113

114114
PLAT_ASM_OFFSET(18, REGDISPLAY, pRbx)

src/coreclr/nativeaot/Runtime/arm/AsmOffsetsCpu.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77
//
88
// NOTE: the offsets MUST be in hex notation WITHOUT the 0x prefix
99

10-
PLAT_ASM_SIZEOF(140, ExInfo)
10+
PLAT_ASM_SIZEOF(138, ExInfo)
1111
PLAT_ASM_OFFSET(0, ExInfo, m_pPrevExInfo)
1212
PLAT_ASM_OFFSET(4, ExInfo, m_pExContext)
1313
PLAT_ASM_OFFSET(8, ExInfo, m_exception)
1414
PLAT_ASM_OFFSET(0c, ExInfo, m_kind)
1515
PLAT_ASM_OFFSET(0d, ExInfo, m_passNumber)
1616
PLAT_ASM_OFFSET(10, ExInfo, m_idxCurClause)
1717
PLAT_ASM_OFFSET(18, ExInfo, m_frameIter)
18-
PLAT_ASM_OFFSET(138, ExInfo, m_notifyDebuggerSP)
18+
PLAT_ASM_OFFSET(130, ExInfo, m_notifyDebuggerSP)
1919

2020
PLAT_ASM_OFFSET(4, PInvokeTransitionFrame, m_RIP)
2121
PLAT_ASM_OFFSET(8, PInvokeTransitionFrame, m_FramePointer)
2222
PLAT_ASM_OFFSET(0c, PInvokeTransitionFrame, m_pThread)
2323
PLAT_ASM_OFFSET(10, PInvokeTransitionFrame, m_Flags)
2424
PLAT_ASM_OFFSET(14, PInvokeTransitionFrame, m_PreservedRegs)
2525

26-
PLAT_ASM_SIZEOF(120, StackFrameIterator)
26+
PLAT_ASM_SIZEOF(118, StackFrameIterator)
2727
PLAT_ASM_OFFSET(08, StackFrameIterator, m_FramePointer)
2828
PLAT_ASM_OFFSET(0c, StackFrameIterator, m_ControlPC)
2929
PLAT_ASM_OFFSET(10, StackFrameIterator, m_RegDisplay)
30-
PLAT_ASM_OFFSET(114, StackFrameIterator, m_OriginalControlPC)
31-
PLAT_ASM_OFFSET(118, StackFrameIterator, m_pPreviousTransitionFrame)
30+
PLAT_ASM_OFFSET(10c, StackFrameIterator, m_OriginalControlPC)
31+
PLAT_ASM_OFFSET(110, StackFrameIterator, m_pPreviousTransitionFrame)
3232

3333
PLAT_ASM_SIZEOF(70, PAL_LIMITED_CONTEXT)
3434
PLAT_ASM_OFFSET(24, PAL_LIMITED_CONTEXT, IP)
@@ -45,7 +45,7 @@ PLAT_ASM_OFFSET(20, PAL_LIMITED_CONTEXT, R11)
4545
PLAT_ASM_OFFSET(28, PAL_LIMITED_CONTEXT, SP)
4646
PLAT_ASM_OFFSET(2c, PAL_LIMITED_CONTEXT, LR)
4747

48-
PLAT_ASM_SIZEOF(88, REGDISPLAY)
48+
PLAT_ASM_SIZEOF(80, REGDISPLAY)
4949
PLAT_ASM_OFFSET(38, REGDISPLAY, SP)
5050

5151
PLAT_ASM_OFFSET(10, REGDISPLAY, pR4)
@@ -56,4 +56,4 @@ PLAT_ASM_OFFSET(20, REGDISPLAY, pR8)
5656
PLAT_ASM_OFFSET(24, REGDISPLAY, pR9)
5757
PLAT_ASM_OFFSET(28, REGDISPLAY, pR10)
5858
PLAT_ASM_OFFSET(2c, REGDISPLAY, pR11)
59-
PLAT_ASM_OFFSET(48, REGDISPLAY, D)
59+
PLAT_ASM_OFFSET(40, REGDISPLAY, D)

src/coreclr/nativeaot/Runtime/arm/ExceptionHandling.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ NESTED_ENTRY RhpThrowHwEx, _TEXT, NoHandler
6262
str r3, [r1, #OFFSETOF__ExInfo__m_pPrevExInfo] // pExInfo->m_pPrevExInfo = m_pExInfoStackHead
6363
str r1, [r0, #OFFSETOF__Thread__m_pExInfoStackHead] // m_pExInfoStackHead = pExInfo
6464

65+
// set the exception context field on the ExInfo
66+
add r2, sp, #rsp_offsetof_Context // r2 <- PAL_LIMITED_CONTEXT*
67+
str r2, [r1, #OFFSETOF__ExInfo__m_pExContext] // pExInfo->m_pExContext = pContext
68+
6569
mov r0, r4 // restore the exception code
6670
// r0 contains the exception code
6771
// r1 contains the address of the ExInfo

src/coreclr/nativeaot/Runtime/arm/GcProbe.S

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
.syntax unified
5+
.thumb
6+
47
#include <unixasmmacros.inc>
58
#include "AsmOffsets.inc"
69

710
.global RhpGcPoll2
811

912
LEAF_ENTRY RhpGcPoll
10-
ldr r0, =RhpTrapThreads
11-
ldr r0, [r0]
13+
PREPARE_EXTERNAL_VAR_INDIRECT RhpTrapThreads, r0
1214
cmp r0, #TrapThreadsFlags_None
1315
bne RhpGcPollRare
1416
bx lr

src/coreclr/nativeaot/Runtime/arm/InteropThunksHelpers.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ NESTED_END RhCommonStub, _TEXT
4242
// IntPtr RhGetCommonStubAddress()
4343
//
4444
LEAF_ENTRY RhGetCommonStubAddress, _TEXT
45-
ldr r0, =C_FUNC(RhCommonStub)
45+
PREPARE_EXTERNAL_VAR RhCommonStub, r0
4646
bx lr
4747
LEAF_END RhGetCommonStubAddress, _TEXT
4848

0 commit comments

Comments
 (0)