summaryrefslogtreecommitdiff
path: root/src/pal/src/thread/context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/src/thread/context.cpp')
-rw-r--r--src/pal/src/thread/context.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/pal/src/thread/context.cpp b/src/pal/src/thread/context.cpp
index 98867c9554..04a6fe5aaf 100644
--- a/src/pal/src/thread/context.cpp
+++ b/src/pal/src/thread/context.cpp
@@ -617,6 +617,35 @@ LPVOID GetNativeContextPC(const native_context_t *context)
/*++
Function :
+ GetNativeContextSP
+
+ Returns the stack pointer from the native context.
+
+Parameters :
+ const native_context_t *native : native context
+
+Return value :
+ The stack pointer from the native context.
+
+--*/
+LPVOID GetNativeContextSP(const native_context_t *context)
+{
+#ifdef _AMD64_
+ return (LPVOID)MCREG_Rsp(context->uc_mcontext);
+#elif defined(_X86_)
+ return (LPVOID) MCREG_Esp(context->uc_mcontext);
+#elif defined(_ARM_)
+ return (LPVOID) MCREG_Sp(context->uc_mcontext);
+#elif defined(_ARM64_)
+ return (LPVOID) MCREG_Sp(context->uc_mcontext);
+#else
+# error implement me for this architecture
+#endif
+}
+
+
+/*++
+Function :
CONTEXTGetExceptionCodeForSignal
Translates signal and context information to a Win32 exception code.