diff options
-rw-r--r-- | sys/alpha/alpha/ipl_funcs.c | 97 | ||||
-rw-r--r-- | sys/alpha/alpha/swtch.s | 24 | ||||
-rw-r--r-- | sys/alpha/conf/Makefile.alpha | 14 | ||||
-rw-r--r-- | sys/alpha/include/cpu.h | 6 | ||||
-rw-r--r-- | sys/alpha/include/ipl.h | 3 | ||||
-rw-r--r-- | sys/alpha/include/md_var.h | 3 | ||||
-rw-r--r-- | sys/alpha/include/param.h | 4 | ||||
-rw-r--r-- | sys/conf/Makefile.alpha | 14 | ||||
-rw-r--r-- | sys/powerpc/include/md_var.h | 3 |
9 files changed, 101 insertions, 67 deletions
diff --git a/sys/alpha/alpha/ipl_funcs.c b/sys/alpha/alpha/ipl_funcs.c index e038006..a5ef640 100644 --- a/sys/alpha/alpha/ipl_funcs.c +++ b/sys/alpha/alpha/ipl_funcs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ipl_funcs.c,v 1.2 1998/06/11 11:51:26 dfr Exp $ + * $Id: ipl_funcs.c,v 1.3 1998/07/05 12:08:59 dfr Exp $ */ #include <sys/types.h> @@ -33,19 +33,24 @@ #include <net/netisr.h> unsigned int bio_imask; /* XXX */ +unsigned int net_imask; /* XXX */ -unsigned int netisr; void (*netisrs[32]) __P((void)); -u_int64_t ipending; -int cpl; +u_int32_t netisr; +u_int32_t ipending; -static void atomic_setbit(u_int64_t* p, u_int64_t bit) +#define getcpl() (alpha_pal_rdps() & ALPHA_PSL_IPL_MASK) + +static void swi_tty(void); +static void swi_net(void); + +static void atomic_setbit(u_int32_t* p, u_int32_t bit) { - u_int64_t temp; + u_int32_t temp; __asm__ __volatile__ ( - "1:\tldq_l %0,%2\n\t" /* load current mask value, asserting lock */ + "1:\tldl_l %0,%2\n\t" /* load current mask value, asserting lock */ "or %3,%0,%0\n\t" /* add our bits */ - "stq_c %0,%1\n\t" /* attempt to store */ + "stl_c %0,%1\n\t" /* attempt to store */ "beq %0,2f\n\t" /* if the store failed, spin */ "br 3f\n" /* it worked, exit */ "2:\tbr 1b\n" /* *p not updated, loop */ @@ -55,14 +60,14 @@ static void atomic_setbit(u_int64_t* p, u_int64_t bit) : "memory"); } -static u_int64_t atomic_readandclear(u_int64_t* p) +static u_int32_t atomic_readandclear(u_int32_t* p) { - u_int64_t v, temp; + u_int32_t v, temp; __asm__ __volatile__ ( "wmb\n" /* ensure pending writes have drained */ - "1:\tldq_l %0,%3\n\t" /* load current value, asserting lock */ + "1:\tldl_l %0,%3\n\t" /* load current value, asserting lock */ "ldiq %1,0\n\t" /* value to store */ - "stq_c %1,%2\n\t" /* attempt to store */ + "stl_c %1,%2\n\t" /* attempt to store */ "beq %1,2f\n\t" /* if the store failed, spin */ "br 3f\n" /* it worked, exit */ "2:\tbr 1b\n" /* *p not updated, loop */ @@ -73,21 +78,39 @@ static u_int64_t atomic_readandclear(u_int64_t* p) return v; } +static void +swi_tty() +{ + /* XXX no users yet */ +} + +static void +swi_net() +{ + u_int32_t bits = atomic_readandclear(&netisr); + int i; + + for (i = 0; i < 32; i++) { + if (bits & 1) + netisrs[i](); + bits >>= 1; + } +} + void do_sir() { - u_int64_t pend = atomic_readandclear(&ipending); -#if 0 - /* - * Later - no users of these yet. - */ - if (pend & (1 << SWI_TTY)) - swi_tty(); - if (pend & (1 << SWI_NET)) - swi_net(); -#endif - if (pend & (1 << SWI_CLOCK)) - softclock(); + u_int32_t pend; + + splsoft(); + while (pend = atomic_readandclear(&ipending)) { + if (pend & (1 << SWI_TTY)) + swi_tty(); + if (pend & (1 << SWI_NET)) + swi_net(); + if (pend & (1 << SWI_CLOCK)) + softclock(); + } } @@ -105,25 +128,26 @@ GENSETSOFT(setsoftcambio, SWI_CAMBIO) GENSETSOFT(setsoftvm, SWI_VM) GENSETSOFT(setsoftclock, SWI_CLOCK) -#define SPLDOWN(name, pri) \ - \ -int name(void) \ -{ \ - int s = alpha_pal_swpipl(ALPHA_PSL_IPL_##pri); \ - cpl = ALPHA_PSL_IPL_##pri; \ - return s; \ +#define SPLDOWN(name, pri) \ + \ +int name(void) \ +{ \ + int s; \ + s = alpha_pal_swpipl(ALPHA_PSL_IPL_##pri); \ + return s; \ } SPLDOWN(splsoftclock, SOFT) SPLDOWN(splsoftnet, SOFT) +SPLDOWN(splsoft, SOFT) #define SPLUP(name, pri) \ \ int name(void) \ { \ + int cpl = getcpl(); \ if (ALPHA_PSL_IPL_##pri > cpl) { \ int s = alpha_pal_swpipl(ALPHA_PSL_IPL_##pri); \ - cpl = ALPHA_PSL_IPL_##pri; \ return s; \ } else \ return cpl; \ @@ -141,19 +165,18 @@ SPLUP(splhigh, HIGH) void spl0() { - /* XXX soft interrupts here */ + if (ipending) + do_sir(); /* lowers ipl to SOFT */ alpha_pal_swpipl(ALPHA_PSL_IPL_0); - cpl = ALPHA_PSL_IPL_0; } void splx(int s) { - if (s) { + if (s) alpha_pal_swpipl(s); - cpl = s; - } else + else spl0(); } diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s index 712b921..287f771 100644 --- a/sys/alpha/alpha/swtch.s +++ b/sys/alpha/alpha/swtch.s @@ -1,4 +1,4 @@ -/* $Id: swtch.s,v 1.2 1998/06/11 11:51:26 dfr Exp $ */ +/* $Id: swtch.s,v 1.3 1998/06/27 15:37:43 dfr Exp $ */ /* $NetBSD: locore.s,v 1.47 1998/03/22 07:26:32 thorpej Exp $ */ /* @@ -83,7 +83,7 @@ Lsavectx1: LDGP(pv) /**************************************************************************/ IMPORT(whichqs, 4) -IMPORT(want_resched, 8) +IMPORT(want_resched, 4) IMPORT(Lev1map, 8) /* @@ -220,6 +220,11 @@ Lcs6: mov s3, a0 /* swap the context */ SWITCH_CONTEXT + /* XXX remove after implementing ASNs */ + ldiq a0, -2 /* TBIA */ + call_pal PAL_OSF1_tbi + call_pal PAL_imb + Lcs7: /* @@ -229,7 +234,7 @@ Lcs7: * in which case curproc would be NULL. */ stq s2, curproc /* curproc = p */ - stq zero, want_resched /* we've rescheduled */ + stl zero, want_resched /* we've rescheduled */ /* * Now running on the new u struct. @@ -265,6 +270,11 @@ Lcs7: * pointer to the executing process's proc structure. */ LEAF(switch_trampoline, 0) + ldq a0, curproc + ldiq a1, P_SWITCHTIME + addq a0, a1, a0 + CALL(microuptime) + mov s0, pv mov s1, ra mov s2, a0 @@ -278,8 +288,8 @@ LEAF(switch_trampoline, 0) * exception_return: return from trap, exception, or syscall */ -IMPORT(ipending, 8) -IMPORT(astpending, 8) +IMPORT(ipending, 4) +IMPORT(astpending, 4) LEAF(exception_return, 1) /* XXX should be NESTED */ br pv, Ler1 @@ -290,7 +300,7 @@ Ler1: LDGP(pv) bne t0, Lrestoreregs /* != 0: can't do AST or SIR */ /* see if we can do an SIR */ - ldq t1, ipending /* SIR pending? */ + ldl t1, ipending /* SIR pending? */ beq t1, Lchkast /* no, try an AST*/ /* We've got a SIR. */ @@ -303,7 +313,7 @@ Lchkast: and s1, ALPHA_PSL_USERMODE, t0 /* are we returning to user? */ beq t0, Lrestoreregs /* no: just return */ - ldq t2, astpending /* AST pending? */ + ldl t2, astpending /* AST pending? */ beq t2, Lsetfpenable /* no: return & deal with FP */ /* We've got an AST. Handle it. */ diff --git a/sys/alpha/conf/Makefile.alpha b/sys/alpha/conf/Makefile.alpha index 51cb957..66dbfd2 100644 --- a/sys/alpha/conf/Makefile.alpha +++ b/sys/alpha/conf/Makefile.alpha @@ -1,7 +1,7 @@ # Makefile.alpha -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.alpha 7.1 5/10/91 -# $Id: Makefile.alpha,v 1.1 1998/06/10 10:53:59 dfr Exp $ +# $Id: Makefile.alpha,v 1.2 1998/06/14 13:45:03 dfr Exp $ # # Makefile for FreeBSD # @@ -42,7 +42,7 @@ INCLUDES+= -I$S/../include INCLUDES+= -I/usr/include .endif COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h -CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -mno-fp-regs +CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -mno-fp-regs -Wa,-mev56 LOAD_ADDRESS?= 0xfffffc0000230000 DEFINED_PROF= ${PROF} .if defined(PROF) @@ -80,8 +80,8 @@ SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ SYSTEM_OBJS= locore.o setdef0.o vnode_if.o \ ${OBJS} ioconf.o param.o config.o \ setdef1.o -SYSTEM_LD= @${LD} -Bstatic -N -Ttext ${LOAD_ADDRESS} -e locorestart -defsym _DYNAMIC=0 \ - -o $@ -X ${SYSTEM_OBJS} vers.o +SYSTEM_LD= @${LD} --export-dynamic -T$S/alpha/conf/kernel.script -e locorestart \ + -o $@ -X ${SYSTEM_OBJS} vers.o hack.so SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ .endif @@ -130,10 +130,10 @@ setdefs.h: gensetdefs ${OBJS} @./gensetdefs ${OBJS} >setdefs.h gensetdefs: gensetdefs.o - ${HCC} gensetdefs.o -o $@ + ${HCC} -static gensetdefs.o -o $@ gensetdefs.o: ${ALPHA}/alpha/gensetdefs.c - ${HCC} ${CFLAGS} -c ${ALPHA}/alpha/gensetdefs.c + ${HCC} -c ${ALPHA}/alpha/gensetdefs.c # everything potentially depends on the Makefile since everything potentially # depends on the options. Some things are more dependent on the Makefile for @@ -161,7 +161,7 @@ genassym.o: ${ALPHA}/alpha/genassym.c Makefile opt_global.h ${HCC} -c ${COPTS} ${PARAM} -UKERNEL ${ALPHA}/alpha/genassym.c genassym: genassym.o - ${HCC} ${COPTS} ${PARAM} genassym.o -o $@ + ${HCC} -static ${COPTS} ${PARAM} genassym.o -o $@ SYSTEM_OBJS+= __divqu.o __divq.o __divlu.o __divl.o SYSTEM_OBJS+= __remqu.o __remq.o __remlu.o __reml.o diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index 6b0c81f..b63efaf 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -1,4 +1,4 @@ -/* $Id: cpu.h,v 1.1 1998/01/10 10:13:14 jb Exp $ */ +/* $Id: cpu.h,v 1.2 1998/06/10 10:54:45 dfr Exp $ */ /* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ /* @@ -93,8 +93,8 @@ struct clockframe { #define aston() (astpending = 1) #ifdef KERNEL -u_int64_t astpending; /* need to trap before returning to user mode */ -u_int64_t want_resched; /* resched() was called */ +u_int32_t astpending; /* need to trap before returning to user mode */ +u_int32_t want_resched; /* resched() was called */ #endif diff --git a/sys/alpha/include/ipl.h b/sys/alpha/include/ipl.h index 0651283..f727c78 100644 --- a/sys/alpha/include/ipl.h +++ b/sys/alpha/include/ipl.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ipl.h,v 1.1 1998/06/10 10:55:05 dfr Exp $ + * $Id: ipl.h,v 1.2 1998/06/11 11:51:27 dfr Exp $ */ #ifndef _MACHINE_IPL_H_ @@ -39,6 +39,7 @@ #define SWI_VM 4 #define SWI_CLOCK 5 +extern int splsoft(void); extern int splsoftclock(void); extern int splsoftnet(void); extern int splnet(void); diff --git a/sys/alpha/include/md_var.h b/sys/alpha/include/md_var.h index d70c1da..3dfdad2 100644 --- a/sys/alpha/include/md_var.h +++ b/sys/alpha/include/md_var.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: md_var.h,v 1.1 1998/06/10 10:55:11 dfr Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -34,6 +34,7 @@ */ extern char sigcode[]; +extern char esigcode[]; extern int szsigcode; extern int Maxmem; extern void (*netisrs[32]) __P((void)); diff --git a/sys/alpha/include/param.h b/sys/alpha/include/param.h index 63e203c..e5b0e90 100644 --- a/sys/alpha/include/param.h +++ b/sys/alpha/include/param.h @@ -1,4 +1,4 @@ -/* $Id: param.h,v 1.3 1998/06/10 10:55:15 dfr Exp $ */ +/* $Id: param.h,v 1.4 1998/06/14 13:45:13 dfr Exp $ */ /* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */ /* @@ -160,8 +160,6 @@ #define alpha_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) #define alpha_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) -#include <machine/intr.h> - #ifdef _KERNEL #ifndef _LOCORE diff --git a/sys/conf/Makefile.alpha b/sys/conf/Makefile.alpha index 51cb957..66dbfd2 100644 --- a/sys/conf/Makefile.alpha +++ b/sys/conf/Makefile.alpha @@ -1,7 +1,7 @@ # Makefile.alpha -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.alpha 7.1 5/10/91 -# $Id: Makefile.alpha,v 1.1 1998/06/10 10:53:59 dfr Exp $ +# $Id: Makefile.alpha,v 1.2 1998/06/14 13:45:03 dfr Exp $ # # Makefile for FreeBSD # @@ -42,7 +42,7 @@ INCLUDES+= -I$S/../include INCLUDES+= -I/usr/include .endif COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h -CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -mno-fp-regs +CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -mno-fp-regs -Wa,-mev56 LOAD_ADDRESS?= 0xfffffc0000230000 DEFINED_PROF= ${PROF} .if defined(PROF) @@ -80,8 +80,8 @@ SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ SYSTEM_OBJS= locore.o setdef0.o vnode_if.o \ ${OBJS} ioconf.o param.o config.o \ setdef1.o -SYSTEM_LD= @${LD} -Bstatic -N -Ttext ${LOAD_ADDRESS} -e locorestart -defsym _DYNAMIC=0 \ - -o $@ -X ${SYSTEM_OBJS} vers.o +SYSTEM_LD= @${LD} --export-dynamic -T$S/alpha/conf/kernel.script -e locorestart \ + -o $@ -X ${SYSTEM_OBJS} vers.o hack.so SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ .endif @@ -130,10 +130,10 @@ setdefs.h: gensetdefs ${OBJS} @./gensetdefs ${OBJS} >setdefs.h gensetdefs: gensetdefs.o - ${HCC} gensetdefs.o -o $@ + ${HCC} -static gensetdefs.o -o $@ gensetdefs.o: ${ALPHA}/alpha/gensetdefs.c - ${HCC} ${CFLAGS} -c ${ALPHA}/alpha/gensetdefs.c + ${HCC} -c ${ALPHA}/alpha/gensetdefs.c # everything potentially depends on the Makefile since everything potentially # depends on the options. Some things are more dependent on the Makefile for @@ -161,7 +161,7 @@ genassym.o: ${ALPHA}/alpha/genassym.c Makefile opt_global.h ${HCC} -c ${COPTS} ${PARAM} -UKERNEL ${ALPHA}/alpha/genassym.c genassym: genassym.o - ${HCC} ${COPTS} ${PARAM} genassym.o -o $@ + ${HCC} -static ${COPTS} ${PARAM} genassym.o -o $@ SYSTEM_OBJS+= __divqu.o __divq.o __divlu.o __divl.o SYSTEM_OBJS+= __remqu.o __remq.o __remlu.o __reml.o diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h index d70c1da..3dfdad2 100644 --- a/sys/powerpc/include/md_var.h +++ b/sys/powerpc/include/md_var.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: md_var.h,v 1.1 1998/06/10 10:55:11 dfr Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -34,6 +34,7 @@ */ extern char sigcode[]; +extern char esigcode[]; extern int szsigcode; extern int Maxmem; extern void (*netisrs[32]) __P((void)); |