summaryrefslogtreecommitdiff
path: root/patches/patch-Source_JavaScriptCore_heap_MachineStackMarker_cpp
blob: 6cc8704bfcd7101f94e7d3b1cc8c7ab93766643b (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
$OpenBSD: patch-Source_JavaScriptCore_heap_MachineStackMarker_cpp,v 1.3 2013/04/13 09:11:02 landry Exp $
--- Source/JavaScriptCore/heap/MachineStackMarker.cpp.orig	Mon Oct  1 15:06:17 2012
+++ Source/JavaScriptCore/heap/MachineStackMarker.cpp	Fri Mar  8 00:56:48 2013
@@ -372,8 +372,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);
@@ -437,7 +439,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;