summaryrefslogtreecommitdiff
path: root/sys
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
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')
-rw-r--r--sys/arch/hppa/hppa/genassym.cf3
-rw-r--r--sys/arch/hppa/hppa/locore.S14
-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
5 files changed, 32 insertions, 11 deletions
diff --git a/sys/arch/hppa/hppa/genassym.cf b/sys/arch/hppa/hppa/genassym.cf
index 40acae0a2c1..39975a728fd 100644
--- a/sys/arch/hppa/hppa/genassym.cf
+++ b/sys/arch/hppa/hppa/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.43 2011/06/06 14:23:26 jsing Exp $
+# $OpenBSD: genassym.cf,v 1.44 2011/11/08 15:39:50 kettenis Exp $
#
# Copyright (c) 1982, 1990, 1993
@@ -126,6 +126,7 @@ member TF_CR21 tf_ior
member TF_CR22 tf_ipsw
member TF_CR23 tf_eirr
member TF_CR25 tf_vtop
+member tf_cr27
member tf_cr28
member tf_cr30
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S
index fd008f3c99d..c016365e85f 100644
--- a/sys/arch/hppa/hppa/locore.S
+++ b/sys/arch/hppa/hppa/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.187 2011/10/12 18:30:09 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.188 2011/11/08 15:39:50 kettenis Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -773,8 +773,10 @@ $syscall_return
#endif
ldw TF_CR0(sr3, t3), t1
mtctl t1, rctr
- ldw TF_CR30(sr3, t3), t1
- mtctl t1, cr30
+ ldw TF_CR27(sr3, t3), t1
+ ldw TF_CR30(sr3, t3), t2
+ mtctl t1, cr27
+ mtctl t2, cr30
/*
* clear the system mask, this puts us back into physical mode.
@@ -1790,8 +1792,10 @@ $trapnowvirt
mfctl cr28, t2
stw t2, TF_CR28(t3)
#endif
- mfctl cr30, t1
- stw t1, TF_CR30(t3)
+ mfctl cr27, t1
+ mfctl cr30, t2
+ stw t1, TF_CR27(t3)
+ stw t2, TF_CR30(t3)
/*
* load the global pointer for the kernel
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_ */