aboutsummaryrefslogtreecommitdiff
path: root/devel/electron13/files/patch-base_profiler_register__context.h
diff options
context:
space:
mode:
Diffstat (limited to 'devel/electron13/files/patch-base_profiler_register__context.h')
-rw-r--r--devel/electron13/files/patch-base_profiler_register__context.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/devel/electron13/files/patch-base_profiler_register__context.h b/devel/electron13/files/patch-base_profiler_register__context.h
new file mode 100644
index 000000000000..d3567c52cfc2
--- /dev/null
+++ b/devel/electron13/files/patch-base_profiler_register__context.h
@@ -0,0 +1,60 @@
+--- base/profiler/register_context.h.orig 2021-01-07 00:36:18 UTC
++++ base/profiler/register_context.h
+@@ -17,7 +17,7 @@
+ #include <windows.h>
+ #elif defined(OS_APPLE)
+ #include <mach/machine/thread_status.h>
+-#elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
++#elif defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_BSD)
+ #include <sys/ucontext.h>
+ #endif
+
+@@ -190,6 +190,48 @@ inline uintptr_t& RegisterContextInstructionPointer(mc
+ }
+
+ #endif // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS)
++
++#elif defined(OS_FREEBSD)
++
++using RegisterContext = mcontext_t;
++
++#if defined(ARCH_CPU_X86_64)
++inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_rsp);
++}
++
++inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_rbp);
++}
++
++inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_rip);
++}
++#elif defined(ARCH_CPU_X86)
++inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_esp);
++}
++
++inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_ebp);
++}
++
++inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_eip);
++}
++#elif defined(ARCH_CPU_ARM64)
++inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_gpregs.gp_sp);
++}
++
++inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_gpregs.gp_x[29]);
++}
++
++inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) {
++ return AsUintPtr(&context->mc_gpregs.gp_elr);
++}
++#endif
+
+ #else // #if defined(OS_WIN)
+