summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r--sys/arch/hppa/hppa/fpemu.S9
-rw-r--r--sys/arch/hppa/hppa/locore.S39
-rw-r--r--sys/arch/hppa/hppa/trap.c16
-rw-r--r--sys/arch/hppa/include/cpu.h5
4 files changed, 42 insertions, 27 deletions
diff --git a/sys/arch/hppa/hppa/fpemu.S b/sys/arch/hppa/hppa/fpemu.S
index 5e1fd04b899..964bc024d79 100644
--- a/sys/arch/hppa/hppa/fpemu.S
+++ b/sys/arch/hppa/hppa/fpemu.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpemu.S,v 1.8 2003/04/10 17:27:58 mickey Exp $ */
+/* $OpenBSD: fpemu.S,v 1.9 2004/04/02 20:56:31 mickey Exp $ */
/*
* Copyright (c) 2000,2002 Michael Shalayeff
@@ -31,6 +31,7 @@
*/
#include <machine/asm.h>
+#include <machine/cpu.h>
#include "assym.h"
#define FPEMU_VERSION (1 << 11)
@@ -96,7 +97,7 @@ LEAF_ENTRY(fpu_emulate)
extru,<> arg0, 31, 5, t2
b,n $fpemu_nzt
nop
- comib,=,n 2, t3, $fpemu_exit
+ /*comib,=,n 2, t3, $fpemu_exit*/
nop
$fpemu_nzt
/*
@@ -191,7 +192,7 @@ $fpemu0c_0_5 /* frnd */
FP_TABLE2(frnd,sgl,dbl,invalid,quad)
$fpemu0c_1
- extru t4, 16, 4, r1
+ extru t4, 20, 4, r1
comib,=,n 0, r31, $fpemu0c_1_0
comib,=,n 1, r31, $fpemu0c_1_1
comib,=,n 2, r31, $fpemu0c_1_2
@@ -323,7 +324,7 @@ invalid_fmpy
invalid_fdiv
invalid_frem
bv 0(rp)
- ldi 1, ret0
+ ldi HPPA_FPU_ILL, ret0
EXIT(fpu_emulate)
.end
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S
index bf98f512881..8302fba5935 100644
--- a/sys/arch/hppa/hppa/locore.S
+++ b/sys/arch/hppa/hppa/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.122 2004/03/09 04:43:55 mickey Exp $ */
+/* $OpenBSD: locore.S,v 1.123 2004/04/02 20:56:31 mickey Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -1062,13 +1062,12 @@ ENTRY(TLABEL(excpt),0)
bb,>=,n r1, HPPA_FPU_T_POS, excpt_notrap
ldw 8(r9), r1
extru r1, 5, 6, r1
- comib,<>,n HPPA_FPU_UNMPL, r1, excpt_notrap
+ bb,<,n r1, HPPA_FPU_UNMPL, excpt_notrap
ldw 0(r9), r1
depi 0, HPPA_FPU_T_POS, 1, r1
stw r1, 0(r9)
ldw 8(r9), r1
- stw r0, 8(r9)
.import $fpu_emulate, code
b $fpu_emulate
fdc r0(r9)
@@ -2305,16 +2304,21 @@ ENTRY($fpu_emulate,320)
bv,n 0(t1)
nop
- mfctl cr30, arg0
+ mfctl cr30, r25
ldi 32, r1
- fdc,m r1(arg0)
- fdc,m r1(arg0)
- fdc,m r1(arg0)
- fdc,m r1(arg0)
- fdc,m r1(arg0)
- fdc,m r1(arg0)
- fdc,m r1(arg0)
- fdc r0(arg0)
+
+ ldw 8(r25), r17 /* fpu exception reg 0 */
+ zdep ret0, 5, 6, r17 /* intentionally zero the insn */
+ stw r17, 8(r25)
+
+ fdc,m r1(r25)
+ fdc,m r1(r25)
+ fdc,m r1(r25)
+ fdc,m r1(r25)
+ fdc,m r1(r25)
+ fdc,m r1(r25)
+ fdc,m r1(r25)
+ fdc r0(r25)
sync
ldil L%fpemu_stack, r31
@@ -2356,9 +2360,18 @@ ENTRY($fpu_emulate,320)
ldw TF_R30(r31), r30
ldw TF_R31(r31), r31
- comb,<> r0, r1, TLABEL(all)
+ bb,>=,n r1, 24, $fpu_emulate_done
+
+ b TLABEL(all)
+ ldi T_EMULATION, r1
+
+$fpu_emulate_done
+ comb,=,n r0, r1, $fpu_emulate_done2
+
+ b TLABEL(all)
ldi T_EXCEPTION, r1
+$fpu_emulate_done2
rfir
nop
EXIT($fpu_emulate)
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index b3eefc64b56..e868c03ab48 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.70 2003/12/20 21:49:06 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.71 2004/04/02 20:56:31 mickey Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -263,17 +263,17 @@ trap(type, frame)
flt = 0;
if (i < 7) {
u_int32_t stat = HPPA_FPU_OP(*pex);
- if (stat == HPPA_FPU_UNMPL)
+ if (stat & HPPA_FPU_UNMPL)
flt = FPE_FLTINV;
- else if (stat & HPPA_FPU_V)
+ else if (stat & (HPPA_FPU_V << 1))
flt = FPE_FLTINV;
- else if (stat & HPPA_FPU_Z)
+ else if (stat & (HPPA_FPU_Z << 1))
flt = FPE_FLTDIV;
- else if (stat & HPPA_FPU_I)
+ else if (stat & (HPPA_FPU_I << 1))
flt = FPE_FLTRES;
- else if (stat & HPPA_FPU_O)
+ else if (stat & (HPPA_FPU_O << 1))
flt = FPE_FLTOVF;
- else if (stat & HPPA_FPU_U)
+ else if (stat & (HPPA_FPU_U << 1))
flt = FPE_FLTUND;
/* still left: under/over-flow w/ inexact */
*pex = 0;
@@ -294,7 +294,7 @@ trap(type, frame)
case T_EMULATION | T_USER:
sv.sival_int = va;
- trapsignal(p, SIGILL, type &~ T_USER, ILL_ILLOPC, sv);
+ trapsignal(p, SIGILL, type &~ T_USER, ILL_COPROC, sv);
break;
case T_OVERFLOW | T_USER:
diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h
index 0fa1b4ae3af..41f57f4550f 100644
--- a/sys/arch/hppa/include/cpu.h
+++ b/sys/arch/hppa/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.39 2003/10/15 18:54:55 mickey Exp $ */
+/* $OpenBSD: cpu.h,v 1.40 2004/04/02 20:56:31 mickey Exp $ */
/*
* Copyright (c) 2000-2002 Michael Shalayeff
@@ -83,7 +83,8 @@ extern int cpu_hvers;
#define HPPA_FPUS 0xc0
#define HPPA_FPUVER(w) (((w) & 0x003ff800) >> 11)
#define HPPA_FPU_OP(w) ((w) >> 26)
-#define HPPA_FPU_UNMPL 0x9
+#define HPPA_FPU_UNMPL 0x01 /* exception reg, the rest is << 1 */
+#define HPPA_FPU_ILL 0x80 /* software-only */
#define HPPA_FPU_I 0x01
#define HPPA_FPU_U 0x02
#define HPPA_FPU_O 0x04