summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/include
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-11-08 15:39:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-11-08 15:39:51 +0000
commite3f3dc7c6c03937f695d0e394d3291387c63c2d5 (patch)
tree2efbf55aa5d854ced823fecbe194a6f8cf81488d /sys/arch/hppa/include
parentaa4956993ac4858cc877fcb324981d74d9235b6d (diff)
Save and restore cr27 and add the necessary glue to use it as the userland
thread register. ok guenther@, jsing@
Diffstat (limited to 'sys/arch/hppa/include')
-rw-r--r--sys/arch/hppa/include/frame.h5
-rw-r--r--sys/arch/hppa/include/proc.h4
-rw-r--r--sys/arch/hppa/include/tcb.h17
3 files changed, 21 insertions, 5 deletions
diff --git a/sys/arch/hppa/include/frame.h b/sys/arch/hppa/include/frame.h
index 29957c8fbaa..bc759615426 100644
--- a/sys/arch/hppa/include/frame.h
+++ b/sys/arch/hppa/include/frame.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: frame.h,v 1.16 2004/04/07 18:24:19 mickey Exp $ */
+/* $OpenBSD: frame.h,v 1.17 2011/11/08 15:39:50 kettenis Exp $ */
/*
* Copyright (c) 1999-2004 Michael Shalayeff
@@ -129,10 +129,11 @@ struct trapframe {
unsigned tf_ccr; /* cr10 */
unsigned tf_eirr; /* cr23 - DDB */
unsigned tf_vtop; /* cr25 - DDB */
+ unsigned tf_cr27;
unsigned tf_cr28; /* - DDB */
unsigned tf_cr30; /* uaddr */
- unsigned tf_pad[4]; /* pad to 256 bytes */
+ unsigned tf_pad[3]; /* pad to 256 bytes */
};
#endif /* !_LOCORE */
diff --git a/sys/arch/hppa/include/proc.h b/sys/arch/hppa/include/proc.h
index ff5e79338eb..5f6a93a82bb 100644
--- a/sys/arch/hppa/include/proc.h
+++ b/sys/arch/hppa/include/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.4 2009/12/29 13:11:40 jsing Exp $ */
+/* $OpenBSD: proc.h,v 1.5 2011/11/08 15:39:50 kettenis Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -43,5 +43,7 @@ struct mdproc {
u_int md_bpsave[2];
};
+#define __HAVE_MD_TCB
+
/* md_flags */
diff --git a/sys/arch/hppa/include/tcb.h b/sys/arch/hppa/include/tcb.h
index 1305f9fb96d..171787caf4c 100644
--- a/sys/arch/hppa/include/tcb.h
+++ b/sys/arch/hppa/include/tcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcb.h,v 1.1 2011/10/27 04:01:17 guenther Exp $ */
+/* $OpenBSD: tcb.h,v 1.2 2011/11/08 15:39:50 kettenis Exp $ */
/*
* Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
@@ -21,13 +21,26 @@
#ifdef _KERNEL
-#error "not yet"
+#define TCB_GET(p) \
+ ((void *)(p)->p_md.md_regs->tf_cr27)
+#define TCB_SET(p, addr) \
+ ((p)->p_md.md_regs->tf_cr27 = (unsigned)(addr))
#else /* _KERNEL */
/* ELF TLS ABI calls for small TCB, with static TLS data after it */
#define TLS_VARIANT 1
+/* Get a pointer to the TCB itself */
+static inline void *
+__hppa_get_tcb(void)
+{
+ void *val;
+ __asm__ ("mfctl %%cr27, %0" : "=r" (val));
+ return val;
+}
+#define TCB_GET() __hppa_get_tcb()
+
#endif /* _KERNEL */
#endif /* _MACHINE_TCB_H_ */