diff options
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 52 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/vm_machdep.c | 52 |
3 files changed, 73 insertions, 34 deletions
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index 9d05a718c9b..c71f4dcf2f5 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.23 1999/12/31 09:07:10 mickey Exp $ */ +/* $OpenBSD: locore.S,v 1.24 2000/01/11 20:27:57 mickey Exp $ */ /* * Copyright (c) 1998,1999 Michael Shalayeff @@ -86,7 +86,6 @@ .import bootdev, data .import esym, data .import curproc, data - .import fpu_curproc, data .import want_resched, data .import virtual_avail, data .import proc0, data @@ -101,6 +100,12 @@ pdc_stack .block 3*NBPG kernelmapped /* set when kernel is mapped */ .block 4 + .export fpu_csw, data +fpu_csw + .block 4 + .export fpu_curpcb, data +fpu_curpcb + .block 4 /* * This is the starting location for the kernel @@ -700,9 +705,9 @@ $syscall_return $syscall_return_copy_loop ldw 0(arg0), t1 ldw 4(arg0), t2 - ldo 8(arg0), arg0 stw t1, 0(arg1) stw t2, 4(arg1) + ldo 8(arg0), arg0 comb,<,n arg0, arg2, $syscall_return_copy_loop ldo 8(arg1), arg1 @@ -871,7 +876,7 @@ $ivaaddr ATRAP(privr,T_PRIV_REG) /* 11. privileged register trap */ ATRAP(ovrfl,T_OVERFLOW) /* 12. overflow trap */ ATRAP(cond,T_CONDITION) /* 13. conditional trap */ -#ifdef FPEMUL_notyet +#ifdef FPEMUL CTRAP(excpt,T_EXCEPTION,) /* 14. assist exception trap */ #else ATRAP(excpt,T_EXCEPTION) @@ -952,14 +957,12 @@ TLABEL(emu) mtctl t2, tr3 mtctl t3, tr5 - ldil L%fpu_curproc, t1 - ldw R%fpu_curproc(t1), t1 + ldil L%fpu_curpcb, t1 + ldw R%fpu_curpcb(t1), t1 mfctl ccr, t3 - - ldil L%curproc, t2 - ldw R%curproc(t2), t2 - + mfctl cr30, t2 + /* enable coprocessor */ depi 3, 25, 2, t3 mtctl t3, ccr @@ -967,8 +970,7 @@ TLABEL(emu) comb,=,n t1, t2, $fpusw_done comb,=,n r0, t1, $fpusw_nosave - ldw p_addr(t1), t3 - ldo pcb_fpregs+u_pcb(t3), t3 + /* ldo pcb_fpregs+u_pcb(t1), t1 */ fstds,ma fr0 , 8(t3) /* fr0 must be saved first */ fstds,ma fr1 , 8(t3) @@ -1001,12 +1003,17 @@ TLABEL(emu) fstds,ma fr28, 8(t3) fstds,ma fr29, 8(t3) fstds,ma fr30, 8(t3) - fstds fr31, 8(t3) + fstds fr31, 0(t3) $fpusw_nosave - ldw p_addr(t2), t3 - ldo 31*8+pcb_fpregs+u_pcb(t3), t3 + /* count switches */ + ldil L%fpu_csw, t1 + ldw R%fpu_csw(t1), t3 + ldo 1(t3), t3 + stw t3, R%fpu_csw(t1) + + ldo 31*8+pcb_fpregs+u_pcb(t2), t3 fldds,ma -8(t3), fr31 fldds,ma -8(t3), fr30 @@ -1041,8 +1048,8 @@ $fpusw_nosave fldds,ma -8(t3), fr1 fldds 0(t3), fr0 /* fr0 must be restored last */ - ldil L%fpu_curproc, t1 - stw t2, R%fpu_curproc(t1) + ldil L%fpu_curpcb, t1 + stw t2, R%fpu_curpcb(t1) $fpusw_done mfctl tr5, t3 @@ -1051,7 +1058,7 @@ $fpusw_done rfi nop -#ifdef notyet +#ifdef FPEMUL .export TLABEL(excpt), entry /* * Emulate FPU/SFU if none/disabled @@ -1062,7 +1069,7 @@ TLABEL(excpt) mtctl sp, tr3 mtctl r31, tr2 - .import $fpemu_stack + .import $fpemu_stack, data ldil L%$fpemu_stack, r31 ldo R%$fpemu_stack(r31), r31 ldo R%TF_SIZE+HPPA_FRAME_SIZE(r31), sp @@ -1093,6 +1100,7 @@ TLABEL(excpt) ldil L%fpu_emulate,t1 ldo R%fpu_emulate(t1),t1 mfctl iir, arg0 + /* arg3 -- regs */ .call blr r0,rp bv,n 0(t1) @@ -1125,13 +1133,13 @@ TLABEL(excpt) mfctl tr7, r1 rfi nop -#endif .export $sfu_emu, entry $sfu_emu + bv r0(rp) ldo 1(r0), ret0 /* none supported by now */ - rfi - nop + +#endif /* FPEMUL */ /* Compute the hpt entry ptr */ #define HPTENT \ diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index dee4a372ddb..f6e35cf96bc 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.17 1999/12/31 09:07:13 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.18 2000/01/11 20:27:56 mickey Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -147,7 +147,6 @@ int totalphysmem, resvmem, physmem, esym; * Things for MI glue to stick on. */ struct user *proc0paddr; -struct proc *fpu_curproc; long mem_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)]; struct extent *hppa_ex; diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index 37bc642176e..a6fa790437d 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.11 1999/12/31 09:07:13 mickey Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.12 2000/01/11 20:27:57 mickey Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -135,17 +135,49 @@ void cpu_swapout(p) struct proc *p; { - extern struct proc *fpu_curproc; - struct proc *q = fpu_curproc; + extern paddr_t fpu_curpcb; + paddr_t q = fpu_curpcb; - fpu_curproc = NULL; + fpu_curpcb = 0; /* - * TODO: explicit FPU save state if we own the FPU, - * since user area might get swapped out as well, - * and we won't be able to save it no more + * TODO: determine if we have an fpu */ - if (p == q) { + if (kvtop((caddr_t)&p->p_addr->u_pcb) == q) { + __asm __volatile( + "fstds,ma %%fr0 , 8(%0)\n\t" + "fstds,ma %%fr1 , 8(%0)\n\t" + "fstds,ma %%fr2 , 8(%0)\n\t" + "fstds,ma %%fr3 , 8(%0)\n\t" + "fstds,ma %%fr4 , 8(%0)\n\t" + "fstds,ma %%fr5 , 8(%0)\n\t" + "fstds,ma %%fr6 , 8(%0)\n\t" + "fstds,ma %%fr7 , 8(%0)\n\t" + "fstds,ma %%fr8 , 8(%0)\n\t" + "fstds,ma %%fr9 , 8(%0)\n\t" + "fstds,ma %%fr10, 8(%0)\n\t" + "fstds,ma %%fr11, 8(%0)\n\t" + "fstds,ma %%fr12, 8(%0)\n\t" + "fstds,ma %%fr13, 8(%0)\n\t" + "fstds,ma %%fr14, 8(%0)\n\t" + "fstds,ma %%fr15, 8(%0)\n\t" + "fstds,ma %%fr16, 8(%0)\n\t" + "fstds,ma %%fr17, 8(%0)\n\t" + "fstds,ma %%fr18, 8(%0)\n\t" + "fstds,ma %%fr19, 8(%0)\n\t" + "fstds,ma %%fr20, 8(%0)\n\t" + "fstds,ma %%fr21, 8(%0)\n\t" + "fstds,ma %%fr22, 8(%0)\n\t" + "fstds,ma %%fr23, 8(%0)\n\t" + "fstds,ma %%fr24, 8(%0)\n\t" + "fstds,ma %%fr25, 8(%0)\n\t" + "fstds,ma %%fr26, 8(%0)\n\t" + "fstds,ma %%fr27, 8(%0)\n\t" + "fstds,ma %%fr28, 8(%0)\n\t" + "fstds,ma %%fr29, 8(%0)\n\t" + "fstds,ma %%fr30, 8(%0)\n\t" + "fstds %%fr31, 0(%0)\n\t" + : "+r" (q) :: "memory"); } } @@ -226,13 +258,13 @@ void cpu_exit(p) struct proc *p; { - extern struct proc *fpu_curproc; /* from machdep.c */ + extern paddr_t fpu_curpcb; /* from locore.S */ uvmexp.swtch++; splhigh(); curproc = NULL; - fpu_curproc = NULL; + fpu_curpcb = 0; uvmspace_free(p->p_vmspace); /* XXX should be in the locore? */ |