summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2003-01-05 22:37:03 +0000
committertmm <tmm@FreeBSD.org>2003-01-05 22:37:03 +0000
commit3c69015b4953d089cff489b07ab9ea2bf44e2b6b (patch)
treee65ab68c1e282bfbcc0c1dabe348643a7347a7ef /lib
parent7089000c6ca3697d08856b96bbe0f65eb943e9f5 (diff)
downloadFreeBSD-src-3c69015b4953d089cff489b07ab9ea2bf44e2b6b.zip
FreeBSD-src-3c69015b4953d089cff489b07ab9ea2bf44e2b6b.tar.gz
Add MD definitions for sparc64. This is based on work by des.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/uthread/pthread_private.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h
index 2688914..e8e85b0 100644
--- a/lib/libc_r/uthread/pthread_private.h
+++ b/lib/libc_r/uthread/pthread_private.h
@@ -67,6 +67,7 @@
* address in a jmp_buf context.
*
* XXX - These need to be moved into architecture dependent support files.
+ * XXX - These need to be documented so porters know what's required.
*/
#if defined(__i386__)
#define GET_STACK_JB(jb) ((unsigned long)((jb)[0]._jb[2]))
@@ -101,6 +102,34 @@
(jb)[0]._jb[R_RA + 4] = (long)(ra); \
(jb)[0]._jb[R_T12 + 4] = (long)(ra); \
} while (0)
+#elif defined(__sparc64__)
+#include <machine/frame.h>
+
+#define CCFSZ sizeof (struct frame)
+
+#define GET_STACK_JB(jb) \
+ ((unsigned long)((jb)[0]._jb[_JB_SP]) + SPOFF)
+#define GET_STACK_SJB(sjb) \
+ ((unsigned long)((sjb)[0]._sjb[_JB_SP]) + SPOFF)
+#define GET_STACK_UC(ucp) \
+ ((ucp)->uc_mcontext.mc_sp + SPOFF)
+/*
+ * XXX: sparc64 _longjmp() expects a register window on the stack
+ * at the given position, so we must make sure that the space where
+ * it is expected is readable. Subtracting the frame size here works
+ * because the SET_STACK macros are only used to set up new stacks
+ * or signal stacks, but it is a bit dirty.
+ */
+#define SET_STACK_JB(jb, stk) \
+ (jb)[0]._jb[_JB_SP] = (long)(stk) - SPOFF - CCFSZ
+#define SET_STACK_SJB(sjb, stk) \
+ (sjb)[0]._sjb[_JB_SP] = (long)(stk) - SPOFF - CCFSZ
+#define SET_STACK_UC(ucp, stk) \
+ (ucp)->uc_mcontext.mc_sp = (unsigned long)(stk) - SPOFF - CCFSZ
+#define FP_SAVE_UC(ucp) /* XXX */
+#define FP_RESTORE_UC(ucp) /* XXX */
+#define SET_RETURN_ADDR_JB(jb, ra) \
+ (jb)[0]._jb[_JB_PC] = (long)(ra) - 8
#else
#error "Don't recognize this architecture!"
#endif
OpenPOWER on IntegriCloud