$OpenBSD: patch-j2sdk1_3_1_src_solaris_hpi_green_threads_include_context_md_bsd_h,v 1.4 2007/07/18 14:19:27 kurt Exp $
--- j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h.orig	Wed Jul 18 09:36:12 2007
+++ j2sdk1.3.1/src/solaris/hpi/green_threads/include/context_md_bsd.h	Wed Jul 18 09:36:14 2007
@@ -26,6 +26,9 @@ typedef struct lj_ucontext {
 	context_jmpbuf_t	jmpbuf;
 #if defined(i386)
 	char		floatbuf[108];
+#elif defined(__arm__) || defined(__sparc__)
+	unsigned int    pc;     /* args for death func are stored here */
+	unsigned int    arg;    /* args for death func are stored here */
 #elif defined(__powerpc__)
 	/* We pretend the fp status & ctl reg (fpscr) is 64 bits */
 	unsigned int    pc;     /* args for death func are stored here */
@@ -65,6 +68,13 @@ typedef struct lj_ucontext {
 #define BSD_SIGNAL_MASK		21
 #define BSD_STACK_POINTER	3
 
+#elif defined(__arm__)
+
+#define BSD_MAGIC		0
+#define BSD_STACK_POINTER	23
+#define BSD_LINK_REGISTER	24
+#define BSD_SIGNAL_MASK		25
+
 #elif defined(__powerpc__)
 
 /* jmpbuf contains sigmask, then r8-31 where r11 is the LR
@@ -78,6 +88,13 @@ typedef struct lj_ucontext {
 #define BSD_STACK_POINTER	3	/* index in sigjmp_buf of SP (r10) */
 #define BSD_LINK_REGISTER	4	/* index in sigjmp_buf of LR (r11) */
 
+#elif defined(__sparc__)
+
+#define BSD_SIGNAL_MASK         1
+#define BSD_STACK_POINTER       2
+#define BSD_PC                  3
+#define BSD_nPC                 4
+
 #else
 #error architecture unsupported
 #endif
@@ -90,7 +107,7 @@ typedef lj_ucontext_t	inner_ucontext_t;
 
 typedef struct {
     unsigned int unix_errno;
-#if defined(__NetBSD__) && defined(__powerpc__)
+#if defined(__powerpc__)
     void *current_sp;
 #endif
     inner_ucontext_t lj_ucontext;
@@ -200,6 +217,21 @@ extern int netbsd_siglongjmp(sigjmp_buf env, int val);
         (contextp)->unix_errno = errno;					\
         reschedule();							\
     }									\
+}
+#elif defined(__arm__) || defined(__sparc__)
+#define getcontext(lj_ucontextp) { 				\
+    sigsetjmp((lj_ucontextp)->jmpbuf, -1); 			\
+}
+
+#define setcontext(lj_ucontextp) {		 		\
+    siglongjmp((lj_ucontextp)->jmpbuf, (int)lj_ucontextp);	\
+}
+
+#define yieldContext(contextp) {				\
+    if (!sigsetjmp((contextp)->lj_ucontext.jmpbuf, -1)) {	\
+	(contextp)->unix_errno = errno;				\
+	reschedule();						\
+    }								\
 }
 #else
 #error architecture unsupported
