From: downsj Date: Tue, 4 Feb 1997 06:21:24 +0000 (+0000) Subject: checkpoint: pull in spl() changes from NetBSD, and more siginfo. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=66d4f9ee3e61f9f0e001f23a826d58fd39337651;p=openbsd checkpoint: pull in spl() changes from NetBSD, and more siginfo. --- diff --git a/sys/arch/hp300/dev/hilreg.h b/sys/arch/hp300/dev/hilreg.h index 0b09598d0b9..453689a2800 100644 --- a/sys/arch/hp300/dev/hilreg.h +++ b/sys/arch/hp300/dev/hilreg.h @@ -1,5 +1,5 @@ -/* $OpenBSD: hilreg.h,v 1.2 1997/01/12 15:12:44 downsj Exp $ */ -/* $NetBSD: hilreg.h,v 1.5 1994/10/26 07:24:15 cgd Exp $ */ +/* $OpenBSD: hilreg.h,v 1.3 1997/02/04 06:21:24 downsj Exp $ */ +/* $NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -94,13 +94,6 @@ struct hil_dev { #define WRITEHILCMD(x, y) ((x)->hil_cmd = ((y) << 24)) #endif -#ifdef hp300 -#define splhil() spl1() -#else -extern int hilspl; -#define splhil() splx(hilspl) -#endif - #define HIL_BUSY 0x02 #define HIL_DATA_RDY 0x01 diff --git a/sys/arch/hp300/dev/ite.c b/sys/arch/hp300/dev/ite.c index 66e5263410e..22c49075407 100644 --- a/sys/arch/hp300/dev/ite.c +++ b/sys/arch/hp300/dev/ite.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ite.c,v 1.7 1997/02/03 04:47:38 downsj Exp $ */ -/* $NetBSD: ite.c,v 1.35 1997/01/30 09:18:56 thorpej Exp $ */ +/* $OpenBSD: ite.c,v 1.8 1997/02/04 06:21:26 downsj Exp $ */ +/* $NetBSD: ite.c,v 1.37 1997/02/02 09:40:31 thorpej Exp $ */ /* * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. @@ -71,13 +71,6 @@ #define set_attr(ip, attr) ((ip)->attribute |= (attr)) #define clr_attr(ip, attr) ((ip)->attribute &= ~(attr)) -/* - * No need to raise SPL above the HIL (the only thing that can - * affect our state. - */ -#include -#define splite() splhil() - /* * # of chars are output in a single itestart() call. * If this is too big, user processes will be blocked out for @@ -174,6 +167,7 @@ iteattach(parent, self, aux) return; } bzero(ite->sc_data, sizeof(struct ite_data)); + ite->sc_data->flags = ITE_ALIVE; } /* @@ -427,12 +421,7 @@ itestart(tp) sc = ite_cd.cd_devs[ITEUNIT(tp->t_dev)]; ip = sc->sc_data; - /* - * (Potentially) lower priority. We only need to protect ourselves - * from keyboard interrupts since that is all that can affect the - * state of our tty (kernel printf doesn't go through this routine). - */ - s = splite(); + s = splkbd(); if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) { splx(s); return; diff --git a/sys/arch/hp300/hp300/genassym.c b/sys/arch/hp300/hp300/genassym.c index 95919bf5208..2c94d54928f 100644 --- a/sys/arch/hp300/hp300/genassym.c +++ b/sys/arch/hp300/hp300/genassym.c @@ -1,5 +1,5 @@ -/* $OpenBSD: genassym.c,v 1.5 1997/01/12 15:13:16 downsj Exp $ */ -/* $NetBSD: genassym.c,v 1.21 1996/10/05 07:11:44 thorpej Exp $ */ +/* $OpenBSD: genassym.c,v 1.6 1997/02/04 06:21:29 downsj Exp $ */ +/* $NetBSD: genassym.c,v 1.22 1997/02/02 07:53:16 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -40,6 +40,10 @@ #define _VA_LIST_ _BSD_VA_LIST_ #define _PTRDIFF_T_ _BSD_PTRDIFF_T_ +#undef _KERNEL /* XXX for errno declaration */ +#include +#define _KERNEL + #include #include #include @@ -62,13 +66,10 @@ #include #endif -#include #include #include #include -extern int errno; - void def(what, val) char *what; @@ -127,6 +128,14 @@ main() def("CPU_68030", CPU_68030); def("CPU_68040", CPU_68040); + /* FPU types */ + def("FPU_NONE", FPU_NONE); + def("FPU_68881", FPU_68881); + def("FPU_68882", FPU_68882); + def("FPU_68040", FPU_68040); + def("FPU_68060", FPU_68060); + def("FPU_UNKNOWN", FPU_UNKNOWN); + /* values for machineid */ def("HP_320", HP_320); def("HP_330", HP_330); diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 59bf97b2687..ae8b4d9a0a3 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.14 1997/02/03 15:54:45 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.15 1997/02/04 06:21:30 downsj Exp $ */ /* $NetBSD: machdep.c,v 1.77 1996/12/11 16:49:23 thorpej Exp $ */ /* @@ -760,7 +760,6 @@ struct hpuxsigcontext { */ struct hpuxsigframe { int hsf_signum; - int hsf_code; struct sigcontext *hsf_scp; int hsf_nothing; struct hpuxsigcontext hsf_sc; @@ -924,7 +923,6 @@ sendsig(catcher, sig, mask, code, type, val) hkfp = (struct hpuxsigframe *)&kfp[1]; hkfp->hsf_signum = bsdtohpuxsig(kfp->sf_signum); - hkfp->hsf_code = kfp->sf_code; hkfp->hsf_scp = (struct sigcontext *) &((struct hpuxsigframe *)(&fp[1]))->hsf_sc; hkfp->hsf_sc.hsc_syscall = 0; /* XXX */ diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c index a2838539496..499c48d8fad 100644 --- a/sys/arch/hp300/hp300/trap.c +++ b/sys/arch/hp300/hp300/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.5 1997/02/03 04:47:59 downsj Exp $ */ +/* $OpenBSD: trap.c,v 1.6 1997/02/04 06:21:32 downsj Exp $ */ /* $NetBSD: trap.c,v 1.47 1996/10/14 20:06:31 thorpej Exp $ */ /* @@ -392,6 +392,7 @@ trap(type, code, v, frame) i = SIGILL; ucode = frame.f_format; /* XXX was ILL_RESAD_FAULT */ typ = ILL_COPROC; + v = frame.f_pc; break; #ifdef FPCOPROC @@ -415,6 +416,7 @@ trap(type, code, v, frame) typ = FPE_FLTRES; ucode = code; i = SIGFPE; + v = frame.f_pc; break; #endif @@ -429,6 +431,7 @@ trap(type, code, v, frame) /* XXX need to FRESTORE */ typ = FPE_FLTINV; i = SIGFPE; + v = frame.f_pc; break; #endif @@ -444,7 +447,9 @@ trap(type, code, v, frame) ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */ typ = ILL_ILLOPC; i = SIGILL; + v = frame.f_pc; break; + case T_PRIVINST|T_USER: /* privileged instruction fault */ #ifdef COMPAT_HPUX if (p->p_emul == &emul_hpux) @@ -454,6 +459,7 @@ trap(type, code, v, frame) ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */ typ = ILL_PRVOPC; i = SIGILL; + v = frame.f_pc; break; case T_ZERODIV|T_USER: /* Divide by zero */ @@ -465,6 +471,7 @@ trap(type, code, v, frame) ucode = frame.f_format; /* XXX was FPE_INTDIV_TRAP */ typ = FPE_INTDIV; i = SIGFPE; + v = frame.f_pc; break; case T_CHKINST|T_USER: /* CHK instruction trap */ @@ -479,6 +486,7 @@ trap(type, code, v, frame) ucode = frame.f_format; /* XXX was FPE_SUBRNG_TRAP */ typ = FPE_FLTSUB; i = SIGFPE; + v = frame.f_pc; break; case T_TRAPVINST|T_USER: /* TRAPV instruction trap */ @@ -491,8 +499,9 @@ trap(type, code, v, frame) } #endif ucode = frame.f_format; /* XXX was FPE_INTOVF_TRAP */ - typ = FPE_FLTOVF; - i = SIGFPE; + typ = ILL_ILLTRP; + i = SIGILL; + v = frame.f_pc; break; /* diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h index d6f4b852f76..a5c8ef1fe01 100644 --- a/sys/arch/hp300/include/param.h +++ b/sys/arch/hp300/include/param.h @@ -1,5 +1,5 @@ -/* $OpenBSD: param.h,v 1.5 1997/01/12 15:13:38 downsj Exp $ */ -/* $NetBSD: param.h,v 1.27 1996/12/09 03:04:48 thorpej Exp $ */ +/* $OpenBSD: param.h,v 1.6 1997/02/04 06:21:33 downsj Exp $ */ +/* $NetBSD: param.h,v 1.28 1997/02/02 09:34:26 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -155,6 +155,16 @@ _spl_r; \ }) +#define _splraise(s) \ +({ \ + register int _spl_r; \ +\ + __asm __volatile ("clrl %0; movew sr,%0;" : "&=d" (_spl_r) : ); \ + if ((_spl_r & PSL_IPL) < ((s) & PSL_IPL)) \ + __asm __volatile ("movew %0,sr;" : : "di" (s)); \ + _spl_r; \ +}) + /* spl0 requires checking for software interrupts */ #define spl1() _spl(PSL_S|PSL_IPL1) #define spl2() _spl(PSL_S|PSL_IPL2) @@ -175,12 +185,17 @@ extern unsigned short hp300_ttyipl; extern unsigned short hp300_impipl; #endif /* _KERNEL && !_LOCORE */ +/* These spl calls are _not_ to be used by machine-independent code. */ +#define splhil() _splraise(PSL_S|PSL_IPL1) +#define splkbd() splhil() + +/* These spl calls are used by machine-independent code. */ #define splsoftclock() spl1() #define splsoftnet() spl1() -#define splbio() _spl(hp300_bioipl) -#define splnet() _spl(hp300_netipl) -#define spltty() _spl(hp300_ttyipl) -#define splimp() _spl(hp300_impipl) +#define splbio() _splraise(hp300_bioipl) +#define splnet() _splraise(hp300_netipl) +#define spltty() _splraise(hp300_ttyipl) +#define splimp() _splraise(hp300_impipl) #define splclock() spl6() #define splstatclock() spl6() #define splvm() spl6()