summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1999-05-02 03:42:43 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1999-05-02 03:42:43 +0000
commit4c56d7dfa5abf56ce42dd8c61480baa86f3637ca (patch)
treee4352d021fa8bedb3337ab1886cdb42be820df9f /sys/arch
parent3ab7d051637a5af5166593547d6a16bd5943c863 (diff)
new {s,g}et_psw()
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hppa/hppa/locore.S92
-rw-r--r--sys/arch/hppa/include/cpufunc.h35
-rw-r--r--sys/arch/hppa/include/trap.h4
3 files changed, 76 insertions, 55 deletions
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S
index 3cb203c06a3..1daf747c734 100644
--- a/sys/arch/hppa/hppa/locore.S
+++ b/sys/arch/hppa/hppa/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.6 1999/04/20 20:36:06 mickey Exp $ */
+/* $OpenBSD: locore.S,v 1.7 1999/05/02 03:42:42 mickey Exp $ */
/*
* Copyright (c) 1998,1999 Michael Shalayeff
@@ -140,7 +140,7 @@ s_textsize
*/
ENTRY(__start)
/*
- * start(pdc, boothowto, bootdev, esym bootapiver, argv, argc)
+ * start(pdc, boothowto, bootdev, esym, bootapiver, argv, argc)
*
* pdc - PDC entry point (not used, HP-UX compatibility)
* boothowto - boot flags (see "reboot.h")
@@ -321,22 +321,6 @@ $noddb
/* should never return... */
EXIT(__start)
-ENTRY(set_psw)
- mtctl r0,pcsq
- mtctl r0,pcsq
- ldil L%$set_psw,t1
- ldo R%$set_psw(t1),t1
- mtctl t1,pcoq
- ldo 4(t1),t1
- mtctl t1,pcoq
- mtctl arg0,ipsw
- rfi
- nop
-$set_psw
- bv 0(rp)
- nop
-EXIT(set_psw)
-
/*
* Kernel Gateway Page (must be at known address)
* System Call Gate
@@ -609,7 +593,7 @@ $ivaaddr
CTRAP(itlb,T_ITLBMISS) /* 6. instruction TLB miss fault */
ATRAP(iprot,T_IPROT) /* 7. instruction protection trap */
ATRAP(illegal,T_ILLEGAL)/* 8. Illegal instruction trap */
- ATRAP(ibreak,T_IBREAK) /* 9. break instruction trap */
+ CTRAP(ibreak,T_IBREAK) /* 9. break instruction trap */
ATRAP(privop,T_PRIV_OP) /* 10. privileged operation trap */
ATRAP(privr,T_PRIV_REG) /* 11. privileged register trap */
ATRAP(ovrfl,T_OVERFLOW) /* 12. overflow trap */
@@ -808,6 +792,52 @@ $tlbret
rfir
nop
+ .export TLABEL(ibreak), code
+TLABEL(ibreak)
+ mfctl iir, r16
+ extru r16, 31, 5, r9
+ comib,<>,n HPPA_BREAK_KERNEL, r9, TLABEL(all)
+
+ /* If this was called by a user process then always pass it to trap() */
+ mfctl pcoq, r8
+ extru,= r8, 31, 2, r0
+ b,n TLABEL(all)
+
+ /* don't accept breaks from data segments */
+ .import etext
+ ldil L%etext, r9
+ ldo R%etext(r9), r9
+ comb,<<,n r8, r9, TLABEL(all)
+
+ /* now process all those `break' calls we make */
+ extru r16, 18, 13, r9
+ comib,<>,n HPPA_BREAK_GET_PSW, r9, $ibreak_ngetpsw
+
+ b $ibreak_exit
+ mfctl ipsw, ret0
+
+$ibreak_ngetpsw
+ comib,<>,n HPPA_BREAK_SET_PSW, r9, $ibreak_nsetpsw
+
+ mfctl ipsw, ret0
+ b $ibreak_exit
+ mtctl arg0, ipsw
+
+$ibreak_nsetpsw
+ b TLABEL(all)
+ nop
+
+$ibreak_exit
+ /* skip the break */
+ mfctl pcoq, r8
+ mfctl pcoq, r8
+ mtctl r8, pcoq
+ add r8, 4, r8
+ mtctl r8, pcoq
+ rfir
+ nop
+
+
.export TLABEL(all), code
TLABEL(all)
/* r1 still has trap type */
@@ -1628,22 +1658,16 @@ ENTRY(switch_exit)
EXIT(switch_exit)
ENTRY(switch_trampoline)
- /* TODO */
- bv 0(rp)
- nop
+ /* XXX load curproc here? */
+ bv 0(arg0)
+ copy arg1, arg0
EXIT(switch_trampoline)
-ENTRY(child_return)
- /* TODO */
- bv 0(rp)
- nop
-EXIT(child_return)
-
/*
* Signal "trampoline" code. Invoked from RTE setup by sendsig().
*/
ENTRY(sigcode)
- /* TODO */
+ /* TODO signal trampoline */
ALTENTRY(esigcode)
bv 0(rp)
nop
@@ -1653,18 +1677,10 @@ EXIT(sigcode)
ENTRY(linux_sigcode)
ALTENTRY(linux_esigcode)
- /* TODO */
+ /* TODO linux signal trampoline */
bv 0(rp)
nop
EXIT(linix_esigcode)
#endif /* COMPAT_LINUX */
- /* Leave this down here. It avoids a nasty, hard-to-fix bug in gas. */
- .space $PRIVATE$
-
- .export $global$,data
-$global$
- .word 0
-
.end
-
diff --git a/sys/arch/hppa/include/cpufunc.h b/sys/arch/hppa/include/cpufunc.h
index 4e6b0b89e6c..6dbe1e102d0 100644
--- a/sys/arch/hppa/include/cpufunc.h
+++ b/sys/arch/hppa/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.7 1999/04/20 19:29:12 mickey Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.8 1999/05/02 03:41:45 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -93,22 +93,25 @@ static __inline u_int mtsm(u_int mask) {
return ret;
}
-#if 0
-static __inline void set_psw(u_int psw) {
- __asm __volatile("mtctl %0, %%cr22\n\t"
- "mtctl %%r0, %%cr17\n\t"
- "mtctl %%r0, %%cr17\n\t"
- "ldil L%%., %0\n\t"
- "ldo R%%.+24(%0), %0\n\t"
- "mtctl %0, %%cr18\n\t"
- "ldo 4(%0), %0\n\t"
- "mtctl %0, %%cr18\n\t"
- "rfi\n\tnop\n\tnop"
- :: "r" (psw));
+static __inline register_t get_psw(void)
+{
+ register u_int ret;
+ __asm __volatile("break %1, %2\n\tcopy %%ret0, %0" : "=r" (ret)
+ : "i" (HPPA_BREAK_KERNEL), "i" (HPPA_BREAK_GET_PSW)
+ : "r28");
+ return ret;
}
-#else
-void set_psw __P((u_int psw));
-#endif
+
+static __inline register_t set_psw(register_t psw)
+{
+ register u_int ret;
+ __asm __volatile("copy %0, %%arg0\n\tbreak %1, %2\n\tcopy %%ret0, %0"
+ : "=r" (ret)
+ : "i" (HPPA_BREAK_KERNEL), "i" (HPPA_BREAK_SET_PSW), "0" (psw)
+ : "r26", "r28");
+ return ret;
+}
+
#define fdce(sp,off) __asm __volatile("fdce 0(%0,%1)":: "i" (sp), "r" (off))
#define fice(sp,off) __asm __volatile("fice 0(%0,%1)":: "i" (sp), "r" (off))
diff --git a/sys/arch/hppa/include/trap.h b/sys/arch/hppa/include/trap.h
index ab1a9b70241..5a1a63a98cd 100644
--- a/sys/arch/hppa/include/trap.h
+++ b/sys/arch/hppa/include/trap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.h,v 1.3 1999/02/17 20:40:32 mickey Exp $ */
+/* $OpenBSD: trap.h,v 1.4 1999/05/02 03:41:45 mickey Exp $ */
/*
* Copyright (c) 1988-1994, The University of Utah and
@@ -85,6 +85,8 @@
#define HPPA_BREAK_IVA 7
#define HPPA_BREAK_PDC_IODC_CALL 8
#define HPPA_BREAK_GDB 8 /* Standard GDB breakpoint. */
+#define HPPA_BREAK_GET_PSW 9
+#define HPPA_BREAK_SET_PSW 10
/*
* Tear apart a break instruction to find its type.