Module Name: src Committed By: skrll Date: Fri Apr 6 12:21:59 UTC 2012
Modified Files: src/sys/arch/hp700/conf: GENERIC src/sys/arch/hp700/dev: cpu.c src/sys/arch/hp700/hp700: locore.S src/sys/arch/hppa/hppa: fpu.c trap.S trap.c Log Message: unifdef FPEMUL. All our supported systems have an FPU. To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/sys/arch/hp700/conf/GENERIC cvs rdiff -u -r1.22 -r1.23 src/sys/arch/hp700/dev/cpu.c cvs rdiff -u -r1.59 -r1.60 src/sys/arch/hp700/hp700/locore.S cvs rdiff -u -r1.23 -r1.24 src/sys/arch/hppa/hppa/fpu.c cvs rdiff -u -r1.65 -r1.66 src/sys/arch/hppa/hppa/trap.S cvs rdiff -u -r1.99 -r1.100 src/sys/arch/hppa/hppa/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hp700/conf/GENERIC diff -u src/sys/arch/hp700/conf/GENERIC:1.112 src/sys/arch/hp700/conf/GENERIC:1.113 --- src/sys/arch/hp700/conf/GENERIC:1.112 Sat Mar 10 21:51:52 2012 +++ src/sys/arch/hp700/conf/GENERIC Fri Apr 6 12:21:58 2012 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.112 2012/03/10 21:51:52 joerg Exp $ +# $NetBSD: GENERIC,v 1.113 2012/04/06 12:21:58 skrll Exp $ # # GENERIC machine description file # @@ -23,7 +23,7 @@ include "arch/hp700/conf/std.hp700" options INCLUDE_CONFIG_FILE # embed config file in kernel binary options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel -#ident "GENERIC-$Revision: 1.112 $" +#ident "GENERIC-$Revision: 1.113 $" maxusers 32 # estimated number of users @@ -40,7 +40,6 @@ options HP8600_CPU # PCX-W+ (in 32bit options HP8700_CPU # PCX-W2 (in 32bit mode) # CPU-related options. -options FPEMUL # floating point emulation XXX DO NOT REMOVE options USELEDS # blink 'em # delay between "rebooting ..." message and hardware reset, in milliseconds Index: src/sys/arch/hp700/dev/cpu.c diff -u src/sys/arch/hp700/dev/cpu.c:1.22 src/sys/arch/hp700/dev/cpu.c:1.23 --- src/sys/arch/hp700/dev/cpu.c:1.22 Thu Apr 5 21:00:29 2012 +++ src/sys/arch/hp700/dev/cpu.c Fri Apr 6 12:21:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.22 2012/04/05 21:00:29 skrll Exp $ */ +/* $NetBSD: cpu.c,v 1.23 2012/04/06 12:21:58 skrll Exp $ */ /* $OpenBSD: cpu.c,v 1.29 2009/02/08 18:33:28 miod Exp $ */ @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.22 2012/04/05 21:00:29 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.23 2012/04/06 12:21:58 skrll Exp $"); #include "opt_multiprocessor.h" @@ -146,23 +146,14 @@ cpuattach(device_t parent, device_t self aprint_normal(", %u/%u D/I BTLBs", pdc_btlb.finfo.num_i, pdc_btlb.finfo.num_d); } + aprint_normal("\n"); /* * Describe the floating-point support. */ -#ifndef FPEMUL - if (!fpu_present) - aprint_normal("\n%s: no floating point support", - self->dv_xname); - else -#endif /* !FPEMUL */ - { - aprint_normal("\n%s: %s floating point, rev %d", self->dv_xname, - hppa_mod_info(HPPA_TYPE_FPU, (fpu_version >> 16) & 0x1f), - (fpu_version >> 11) & 0x1f); - } - - aprint_normal("\n"); + aprint_normal("%s: %s floating point, rev %d\n", self->dv_xname, + hppa_mod_info(HPPA_TYPE_FPU, (fpu_version >> 16) & 0x1f), + (fpu_version >> 11) & 0x1f); /* sanity against luser amongst config editors */ if (ca->ca_irq != 31) { Index: src/sys/arch/hp700/hp700/locore.S diff -u src/sys/arch/hp700/hp700/locore.S:1.59 src/sys/arch/hp700/hp700/locore.S:1.60 --- src/sys/arch/hp700/hp700/locore.S:1.59 Thu Apr 5 19:42:13 2012 +++ src/sys/arch/hp700/hp700/locore.S Fri Apr 6 12:21:59 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.59 2012/04/05 19:42:13 skrll Exp $ */ +/* $NetBSD: locore.S,v 1.60 2012/04/06 12:21:59 skrll Exp $ */ /* $OpenBSD: locore.S,v 1.158 2008/07/28 19:08:46 miod Exp $ */ /* @@ -1034,13 +1034,6 @@ switch_exited: ldw HPPA_FRAME_ARG(0)(%r3), %arg0 noras: - /* - * As an optimization, hppa_fpu_bootstrap - * replaces this branch instruction with a - * nop if there is a hardware FPU. - */ -ALTENTRY(hppa_fpu_nop1) - b,n switch_return /* * We do have a hardware FPU. If the LWP Index: src/sys/arch/hppa/hppa/fpu.c diff -u src/sys/arch/hppa/hppa/fpu.c:1.23 src/sys/arch/hppa/hppa/fpu.c:1.24 --- src/sys/arch/hppa/hppa/fpu.c:1.23 Sun Jan 23 09:44:59 2011 +++ src/sys/arch/hppa/hppa/fpu.c Fri Apr 6 12:21:59 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu.c,v 1.23 2011/01/23 09:44:59 skrll Exp $ */ +/* $NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.23 2011/01/23 09:44:59 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,7 +82,8 @@ u_int fpu_csw; void hppa_fpu_swapout(struct pcb *); void hppa_fpu_swap(struct fpreg *, struct fpreg *); -#ifdef FPEMUL +static int hppa_fpu_ls(struct trapframe *, struct lwp *); + /* * Given a trapframe and a general register number, the * FRAME_REG macro returns a pointer to that general @@ -131,7 +132,6 @@ const int _frame_reg_positions[32] = { _FRAME_POSITION(tf_sp), /* r30 */ _FRAME_POSITION(tf_r31), }; -#endif /* FPEMUL */ /* * Bootstraps the FPU. @@ -141,69 +141,43 @@ hppa_fpu_bootstrap(u_int ccr_enable) { uint32_t junk[2]; uint32_t vers[2]; - extern u_int hppa_fpu_nop0; - extern u_int hppa_fpu_nop1; /* See if we have a present and functioning hardware FPU. */ fpu_present = (ccr_enable & HPPA_FPUS) == HPPA_FPUS; + KASSERT(fpu_present); /* Initialize the FPU and get its version. */ - if (fpu_present) { - /* - * To somewhat optimize the emulation - * assist trap handling and context - * switching (to save them from having - * to always load and check fpu_present), - * there are two instructions in locore.S - * that are replaced with nops when - * there is a hardware FPU. - */ - hppa_fpu_nop0 = OPCODE_NOP; - hppa_fpu_nop1 = OPCODE_NOP; - fcacheall(); - - /* - * We track what process has the FPU, - * and how many times we have to swap - * in and out. - */ - - /* - * The PA-RISC 1.1 Architecture manual is - * pretty clear that the copr,0,0 must be - * wrapped in double word stores of fr0, - * otherwise its operation is undefined. - */ - __asm volatile( - " ldo %0, %%r22 \n" - " fstds %%fr0, 0(%%r22) \n" - " ldo %1, %%r22 \n" - " copr,0,0 \n" - " fstds %%fr0, 0(%%r22) \n" - : "=m" (junk), "=m" (vers) : : "r22"); - - /* - * Now mark that no process has the FPU, - * and disable it, so the first time it - * gets used the process' state gets - * swapped in. - */ - fpu_csw = 0; - curcpu()->ci_fpu_state = 0; - mtctl(ccr_enable & (CCR_MASK ^ HPPA_FPUS), CR_CCR); - } -#ifdef FPEMUL - else - /* - * XXX This is a hack - to avoid - * having to set up the emulator so - * it can work for one instruction for - * proc0, we dispatch the copr,0,0 opcode - * into the emulator directly. - */ - decode_0c(OPCODE_COPR_0_0, 0, 0, vers); -#endif /* FPEMUL */ + /* + * We track what process has the FPU, + * and how many times we have to swap + * in and out. + */ + + /* + * The PA-RISC 1.1 Architecture manual is + * pretty clear that the copr,0,0 must be + * wrapped in double word stores of fr0, + * otherwise its operation is undefined. + */ + __asm volatile( + " ldo %0, %%r22 \n" + " fstds %%fr0, 0(%%r22) \n" + " ldo %1, %%r22 \n" + " copr,0,0 \n" + " fstds %%fr0, 0(%%r22) \n" + : "=m" (junk), "=m" (vers) : : "r22"); + + /* + * Now mark that no process has the FPU, + * and disable it, so the first time it + * gets used the process' state gets + * swapped in. + */ + fpu_csw = 0; + curcpu()->ci_fpu_state = 0; + mtctl(ccr_enable & (CCR_MASK ^ HPPA_FPUS), CR_CCR); + fpu_version = vers[0]; } @@ -218,12 +192,10 @@ hppa_fpu_flush(struct lwp *l) struct pcb *pcb = lwp_getpcb(l); struct cpu_info *ci = curcpu(); - if (!fpu_present) - return; + KASSERT(fpu_present); /* - * If we have a hardware FPU, and this process' - * state is currently in it, swap it out. + * If this process' state is currently in hardware, swap it out. */ if (ci->ci_fpu_state == 0 || @@ -235,12 +207,9 @@ hppa_fpu_flush(struct lwp *l) ci->ci_fpu_state = 0; } -#ifdef FPEMUL - /* * This emulates a coprocessor load/store instruction. */ -static int hppa_fpu_ls(struct trapframe *, struct lwp *); static int hppa_fpu_ls(struct trapframe *frame, struct lwp *l) { @@ -448,5 +417,3 @@ hppa_fpu_emulate(struct trapframe *frame trapsignal(l, &ksi); } } - -#endif /* FPEMUL */ Index: src/sys/arch/hppa/hppa/trap.S diff -u src/sys/arch/hppa/hppa/trap.S:1.65 src/sys/arch/hppa/hppa/trap.S:1.66 --- src/sys/arch/hppa/hppa/trap.S:1.65 Thu Apr 5 19:44:29 2012 +++ src/sys/arch/hppa/hppa/trap.S Fri Apr 6 12:21:59 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.S,v 1.65 2012/04/05 19:44:29 skrll Exp $ */ +/* $NetBSD: trap.S,v 1.66 2012/04/06 12:21:59 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -267,7 +267,6 @@ syscall_entry: /* We can now set the frame pointer */ copy %t3, %r3 -#if defined(DDB) || defined(KGDB) || defined(FPEMUL) stw %r4 , TF_R4 -TRAPFRAME_SIZEOF(%sr1, %t3) stw %r5 , TF_R5 -TRAPFRAME_SIZEOF(%sr1, %t3) stw %r6 , TF_R6 -TRAPFRAME_SIZEOF(%sr1, %t3) @@ -283,7 +282,7 @@ syscall_entry: stw %r16, TF_R16-TRAPFRAME_SIZEOF(%sr1, %t3) stw %r17, TF_R17-TRAPFRAME_SIZEOF(%sr1, %t3) stw %r18, TF_R18-TRAPFRAME_SIZEOF(%sr1, %t3) -#endif /* DDB || KGDB || FPEMUL */ + stw %r0, 0(%sr1, %t3) /* terminate frame */ copy %r0 , %r3 stw %r0, HPPA_FRAME_PSP(%sr1, %sp) @@ -445,11 +444,11 @@ syscall_return: ldw TF_R1(%t3), %r1 ldw TF_R2(%t3), %r2 ldw TF_R3(%t3), %r3 + /* * See the comment in the trap handling code below about why we need to * save and restore all general registers under these cases. */ -#if defined(DDB) || defined(KGDB) || defined(FPEMUL) ldw TF_R4(%t3), %r4 ldw TF_R5(%t3), %r5 ldw TF_R6(%t3), %r6 @@ -465,7 +464,7 @@ syscall_return: ldw TF_R16(%t3), %r16 ldw TF_R17(%t3), %r17 ldw TF_R18(%t3), %r18 -#endif /* DDB || KGDB || FPEMUL */ + ldw TF_R19(%t3), %t4 /* %r20(%t3) is used as a temporary and will be restored later */ /* %r21(%t2) is used as a temporary and will be restored later */ @@ -900,7 +899,7 @@ LEAF_ENTRY_NOPROFILE(TLABEL(emu)) */ extru %arg0, 5, 6, %r1 comib,=,n 4, %r1, L$emulate_sfu - comib,=,n 0xe, %r1, hppa_fpu_nop0 + comib,=,n 0xe, %r1, hppa_fpu_emulate /* * If the uid field in the instruction is not zero or one, indicating a @@ -932,8 +931,7 @@ LEAF_ENTRY_NOPROFILE(TLABEL(emu)) * * Otherwise, this is the branch to emulate an FPU coprocessor. */ -ALTENTRY(hppa_fpu_nop0) - b,n L$emulate_fpu +hppa_fpu_emulate: /* * We have a hardware FPU. If it is enabled, branch to emulate the @@ -2160,7 +2158,6 @@ trapnowvirt: * * See similar #ifdefs in the syscall entry and exit code. */ -#if defined(DDB) || defined(KGDB) || defined(FPEMUL) stw %r4, TF_R4(%t3) stw %r5, TF_R5(%t3) stw %r6, TF_R6(%t3) @@ -2176,7 +2173,7 @@ trapnowvirt: stw %r16, TF_R16(%t3) stw %r17, TF_R17(%t3) stw %r18, TF_R18(%t3) -#endif /* DDB || KGDB || FPEMUL */ + stw %t4, TF_R19(%t3) stw %r23,TF_R23(%t3) stw %r24,TF_R24(%t3) Index: src/sys/arch/hppa/hppa/trap.c diff -u src/sys/arch/hppa/hppa/trap.c:1.99 src/sys/arch/hppa/hppa/trap.c:1.100 --- src/sys/arch/hppa/hppa/trap.c:1.99 Wed Mar 7 22:07:13 2012 +++ src/sys/arch/hppa/hppa/trap.c Fri Apr 6 12:21:59 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.99 2012/03/07 22:07:13 skrll Exp $ */ +/* $NetBSD: trap.c,v 1.100 2012/04/06 12:21:59 skrll Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.99 2012/03/07 22:07:13 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.100 2012/04/06 12:21:59 skrll Exp $"); /* #define INTRDEBUG */ /* #define TRAPDEBUG */ @@ -631,21 +631,7 @@ trap(int type, struct trapframe *frame) #endif case T_EMULATION | T_USER: -#ifdef FPEMUL hppa_fpu_emulate(frame, l, opcode); -#else /* !FPEMUL */ - /* - * We don't have FPU emulation, so signal the - * process with a SIGFPE. - */ - - KSI_INIT_TRAP(&ksi); - ksi.ksi_signo = SIGFPE; - ksi.ksi_code = SI_NOINFO; - ksi.ksi_trap = type; - ksi.ksi_addr = (void *)frame->tf_iioq_head; - trapsignal(l, &ksi); -#endif /* !FPEMUL */ break; case T_DATALIGN: