summaryrefslogtreecommitdiff
path: root/src/pal/src/exception/seh-unwind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/src/exception/seh-unwind.cpp')
-rw-r--r--src/pal/src/exception/seh-unwind.cpp30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index 322515ad5e..c69c3e1504 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -209,28 +209,6 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
#endif
}
-static DWORD64 GetPc(CONTEXT *context)
-{
-#if defined(_AMD64_)
- return context->Rip;
-#elif defined(_ARM64_) || defined(_ARM_)
- return context->Pc;
-#else
-#error don't know how to get the program counter for this architecture
-#endif
-}
-
-static void SetPc(CONTEXT *context, DWORD64 pc)
-{
-#if defined(_AMD64_)
- context->Rip = pc;
-#elif defined(_ARM64_) || defined(_ARM_)
- context->Pc = pc;
-#else
-#error don't know how to set the program counter for this architecture
-#endif
-}
-
BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
int st;
@@ -250,7 +228,7 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
// So we compensate it by incrementing the PC before passing it to the unwinder.
// Without it, the unwinder would not find unwind info if the hardware exception
// happened in the first instruction of a function.
- SetPc(context, GetPc(context) + 1);
+ SetProgramCounterOnCONTEXT(context, GetProgramCounterFromCONTEXT(context) + 1);
}
#if UNWIND_CONTEXT_IS_UCONTEXT_T
@@ -282,7 +260,7 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
// The behaviour of libunwind from nongnu.org is to null the PC
// So we bank the original PC here, so we can compare it after
// the step
- curPc = GetPc(context);
+ curPc = GetProgramCounterFromCONTEXT(context);
#endif
st = unw_step(&cursor);
@@ -307,9 +285,9 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
//
UnwindContextToWinContext(&cursor, context);
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_ARM64_)
- if (st == 0 && GetPc(context) == curPc)
+ if (st == 0 && GetProgramCounterFromCONTEXT(context) == curPc)
{
- SetPc(context, 0);
+ SetProgramCounterOnCONTEXT(context, 0);
}
#endif