summaryrefslogtreecommitdiff
path: root/patches/patch-Source_JavaScriptCore_heap_MachineStackMarker_cpp
blob: efa7c1690569d5b89f3637dd15facdb7cf5614be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$OpenBSD: patch-Source_JavaScriptCore_heap_MachineStackMarker_cpp,v 1.4 2014/03/25 06:25:45 landry Exp $
https://bugs.webkit.org/show_bug.cgi?id=129965
--- Source/JavaScriptCore/heap/MachineStackMarker.cpp.orig	Tue Feb  4 17:38:03 2014
+++ Source/JavaScriptCore/heap/MachineStackMarker.cpp	Fri Feb 14 20:41:39 2014
@@ -352,8 +352,10 @@ static size_t getPlatformThreadRegisters(const Platfor
 #elif USE(PTHREADS)
     pthread_attr_init(&regs);
 #if HAVE(PTHREAD_NP_H) || OS(NETBSD)
+#  ifndef __OpenBSD__
     // e.g. on FreeBSD 5.4, neundorf@kde.org
     pthread_attr_get_np(platformThread, &regs);
+#  endif
 #else
     // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
     pthread_getattr_np(platformThread, &regs);
@@ -416,7 +418,14 @@ static inline void* otherThreadStackPointer(const Plat
 #elif USE(PTHREADS)
     void* stackBase = 0;
     size_t stackSize = 0;
+# if defined(__OpenBSD__)
+    stack_t ss;
+    int rc = pthread_stackseg_np(pthread_self(), &ss);
+    stackBase = (void*)((size_t) ss.ss_sp - ss.ss_size);
+    stackSize = ss.ss_size;
+#else
     int rc = pthread_attr_getstack(&regs, &stackBase, &stackSize);
+#endif
     (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
     ASSERT(stackBase);
     return static_cast<char*>(stackBase) + stackSize;