$OpenBSD: patch-Source_JavaScriptCore_heap_MachineStackMarker_cpp,v 1.2 2012/04/03 15:39:35 landry Exp $
--- Source/JavaScriptCore/heap/MachineStackMarker.cpp.orig	Wed Dec 28 09:50:13 2011
+++ Source/JavaScriptCore/heap/MachineStackMarker.cpp	Mon Jan 16 17:54:07 2012
@@ -365,8 +365,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);
@@ -430,7 +432,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;
