diff options
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/include/intr.h | 10 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/locore.h | 8 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/eh.S | 45 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore_c_routines.c | 157 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 35 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/trap.c | 63 |
6 files changed, 88 insertions, 230 deletions
diff --git a/sys/arch/mvme88k/include/intr.h b/sys/arch/mvme88k/include/intr.h index 19bc04f86d5..8c2754c8b77 100644 --- a/sys/arch/mvme88k/include/intr.h +++ b/sys/arch/mvme88k/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.11 2003/01/04 02:14:45 miod Exp $ */ +/* $OpenBSD: intr.h,v 1.12 2003/01/13 20:12:16 miod Exp $ */ /* * Copyright (C) 2000 Steve Murphree, Jr. * All rights reserved. @@ -83,9 +83,6 @@ extern int intrcnt[M88K_NIRQ]; #ifdef _KERNEL #ifndef _LOCORE unsigned setipl(unsigned level); -#ifdef DDB -unsigned db_setipl(unsigned level); -#endif int spl0(void); /* needs major cleanup - XXX nivas */ @@ -138,10 +135,5 @@ above... #define splx(x) ((x) ? setipl((x)) : spl0()) -#ifdef DDB -#define db_splx(x) db_setipl((x)) -#define db_splhigh() db_setipl(IPL_HIGH) -#endif /* DDB */ - #endif /* _KERNEL */ #endif /* _MVME88K_INTR_H_ */ diff --git a/sys/arch/mvme88k/include/locore.h b/sys/arch/mvme88k/include/locore.h index cd6edf459ca..c3d2c7b2262 100644 --- a/sys/arch/mvme88k/include/locore.h +++ b/sys/arch/mvme88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.16 2002/03/14 01:26:39 millert Exp $ */ +/* $OpenBSD: locore.h,v 1.17 2003/01/13 20:12:16 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -50,13 +50,7 @@ void dae_print(unsigned *eframe); void data_access_emulation(unsigned *eframe); #endif -unsigned spl(void); unsigned getipl(void); -#ifdef DDB -unsigned db_spl(void); -unsigned db_getipl(void); -#endif - /* machdep.c */ diff --git a/sys/arch/mvme88k/mvme88k/eh.S b/sys/arch/mvme88k/mvme88k/eh.S index 7f796a5f439..37067c04a3c 100644 --- a/sys/arch/mvme88k/mvme88k/eh.S +++ b/sys/arch/mvme88k/mvme88k/eh.S @@ -1,4 +1,4 @@ -/* $OpenBSD: eh.S,v 1.27 2002/12/14 07:42:13 fgsch Exp $ */ +/* $OpenBSD: eh.S,v 1.28 2003/01/13 20:12:18 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -365,7 +365,7 @@ Lbadcpupanic: set FLAGS, FLAGS, 1<FLAG_FROM_KERNEL> ; \ ; \ /* get a stack (exception frame) */ ; \ - 1: bsr setup_phase_one ; \ +1: bsr setup_phase_one ; \ ; \ /* TMP2 now free -- use to set EF_VECTOR */ ; \ or TMP2, r0, NUM ; \ @@ -394,13 +394,13 @@ Lbadcpupanic: /* the bsr later clobbers r1, so save now */ ; \ stcr r1, SR2 /* r1 now free */ ; \ /* set or clear the FLAG_FROM_KERNEL bit */ ; \ -1: ldcr r1, EPSR ; \ + ldcr r1, EPSR ; \ bb0.n PSR_SUPERVISOR_MODE_BIT, r1, 1f ; \ clr FLAGS, FLAGS, 1<FLAG_FROM_KERNEL> ; \ set FLAGS, FLAGS, 1<FLAG_FROM_KERNEL> ; \ ; \ /* get a stack (exception frame) */ ; \ - 1: bsr m88110_setup_phase_one ; \ +1: bsr m88110_setup_phase_one ; \ ; \ /* TMP2 now free -- use to set EF_VECTOR */ ; \ or TMP2, r0, NUM ; \ @@ -1820,6 +1820,10 @@ ASGLOBAL(fpu_enable) or r20, r20, lo16(0x12345678) st r20, r31, GENREG_OFF(0) #endif + + /* get and save IPL */ + bsr _C_LABEL(getipl) + st r2, r31, REG_OFF(EF_MASK) /***************** REGISTER STATUS BLOCK ***********************\ * SR0: current thread * @@ -1979,9 +1983,8 @@ ENTRY(proc_do_uret) addu r3,r3,PCB_USER_STATE /* p->p_addr.u_pcb.user_state */ st r3,r31,0 /* put it on the stack */ br return_from_exception_handler - + ASGLOBAL(return_from_exception_handler) -GLOBAL(return_from_main) /* * Regs r1-r30 are free. R31 is pointing at the word * on the kernel stack where our pointer to the exception frame @@ -2008,7 +2011,7 @@ GLOBAL(return_from_main) #define FPTR r14 ld FPTR, r31, 0 /* grab exception frame pointer */ ld r3, FPTR, REG_OFF(EF_DMT0) - bb0 DMT_VALID_BIT, r3, _check_ast /*[Oh well, nothing to do here] */ + bb0 DMT_VALID_BIT, r3, check_ast /*[Oh well, nothing to do here] */ #if 1 /* @@ -2064,7 +2067,7 @@ GLOBAL(return_from_main) /* clear the dmt0 word in the E.F. */ st r0 , FPTR, REG_OFF(EF_DMT0) 2: - br _check_ast + br check_ast #endif /* m88100 */ #ifdef M88110 @@ -2118,7 +2121,7 @@ ASLOCAL(m88110_return_code) * interrupts. * If returning to user land, look for ASTs */ -GLOBAL(check_ast) +ASLOCAL(check_ast) ld r2, FPTR, REG_OFF(EF_EPSR) /* get pre-exception PSR */ bb1 PSR_INTERRUPT_DISABLE_BIT, r2, 1f /* skip if ints off */ @@ -2150,12 +2153,16 @@ GLOBAL(check_ast) /* * trap(AST,...) will service ast's. */ -#ifdef M88110 +#if defined(M88110) && defined(M88100) or.u r2, r0, hi16(_C_LABEL(cputyp)) ld r3, r2, lo16(_C_LABEL(cputyp)) cmp r2, r3, CPU_88110 bb0 eq, r2, 2f +#endif +#if defined(M88110) CALL(_C_LABEL(m88110_trap), T_ASTFLT, FPTR) +#endif +#if defined(M88110) && defined(M88100) br no_ast 2: #endif @@ -2163,16 +2170,7 @@ GLOBAL(check_ast) CALL(_C_LABEL(m88100_trap), T_ASTFLT, FPTR) #endif -#if 0 - /* assert that ipl is 0; if going back to user, it should be 0 */ - - bsr _C_LABEL(getipl) - bcnd eq0, r2, 3f - bsr _C_LABEL(panic) -3: -#endif - -ASGLOBAL(no_ast) +ASLOCAL(no_ast) /* disable interrupts */ ldcr r1, PSR @@ -2181,9 +2179,9 @@ ASGLOBAL(no_ast) stcr r1, PSR /* now ready to return....*/ - ld r2, FPTR, REG_OFF(EF_MASK) /* get pre-exception ipl */ - bsr.n _C_LABEL(setipl) subu r31, r31, 40 + bsr.n _C_LABEL(setipl) + ld r2, FPTR, REG_OFF(EF_MASK) /* get pre-exception ipl */ addu r31, r31, 40 /* @@ -2255,9 +2253,8 @@ ASGLOBAL(no_ast) ld r1, r31, GENREG_OFF(1) ld.d r30, r31, GENREG_OFF(30) -ASGLOBAL(return_from_exception) RTE - + #ifdef M88110 /*#########################################################################*/ /*#### THE ACTUAL EXCEPTION HANDLER ENTRY POINTS - MVME197 ################*/ diff --git a/sys/arch/mvme88k/mvme88k/locore_c_routines.c b/sys/arch/mvme88k/mvme88k/locore_c_routines.c index 28c036f6713..3f3be2de94d 100644 --- a/sys/arch/mvme88k/mvme88k/locore_c_routines.c +++ b/sys/arch/mvme88k/mvme88k/locore_c_routines.c @@ -1,4 +1,4 @@ -/* $OpenBSD: locore_c_routines.c,v 1.25 2002/03/14 01:26:40 millert Exp $ */ +/* $OpenBSD: locore_c_routines.c,v 1.26 2003/01/13 20:12:18 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -32,7 +32,6 @@ #include <sys/types.h> #include <sys/systm.h> -#include <machine/cpu_number.h> /* cpu_number() */ #include <machine/board.h> /* m188 bit defines */ #include <machine/cmmu.h> /* DMT_VALID */ #include <machine/asm.h> /* END_OF_VECTOR_LIST, etc. */ @@ -102,10 +101,7 @@ static char *bytes[] = #define DAE_DEBUG(stuff) #endif -void setlevel(int); -#ifdef DDB -void db_setlevel(int); -#endif +void setlevel(unsigned int); #ifdef M88100 void @@ -379,10 +375,10 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) #ifdef MVME188 #if 0 -unsigned int int_mask_shadow[MAX_CPUS] = {0,0,0,0}; +unsigned int int_mask_shadow[MAX_CPUS] = {0, 0, 0, 0}; unsigned int blocked_interrupts_mask; #endif -unsigned int m188_curspl[MAX_CPUS] = {0,0,0,0}; +unsigned int m188_curspl[MAX_CPUS] = {0, 0, 0, 0}; unsigned int int_mask_val[INT_LEVEL] = { MASK_LVL_0, @@ -406,18 +402,20 @@ safe_level(mask, curlevel) register int i; for (i = curlevel; i < 8; i++) - if (! (int_mask_val[i] & mask)) + if (!(int_mask_val[i] & mask)) return i; + panic("safe_level: no safe level for mask 0x%08x level %d found", mask, curlevel); /* NOTREACHED */ } void -setlevel(int level) +setlevel(unsigned int level) { - register unsigned int mask; - register int cpu = cpu_number(); + unsigned int mask; + int cpu = cpu_number(); + if (level > 7) { panic("setlevel: bad level 0x%x", level); } @@ -428,7 +426,6 @@ setlevel(int level) #if 0 mask &= ISR_SOFTINT_EXCEPT_MASK(cpu); - mask &= ~blocked_interrupts_mask; #endif @@ -439,168 +436,59 @@ setlevel(int level) m188_curspl[cpu] = level; } -#ifdef DDB -void -db_setlevel(int level) -{ - register unsigned int mask; - register int cpu = cpu_number(); - - mask = int_mask_val[level]; - - if (cpu != master_cpu) - mask &= SLAVE_MASK; -#if 0 - mask &= ISR_SOFTINT_EXCEPT_MASK(cpu); - - mask &= ~blocked_interrupts_mask; -#endif - - *int_mask_reg[cpu] = mask; -#if 0 - int_mask_shadow[cpu] = mask; -#endif - - m188_curspl[cpu] = level; -} -#endif /* DDB */ - #endif /* MVME188 */ unsigned -spl(void) +getipl(void) { unsigned curspl; m88k_psr_type psr; /* proccessor status register */ -#ifdef MVME188 - int cpu = 0; /* prevent warning */ -#endif - psr = disable_interrupts_return_psr(); - switch (brdtyp) { -#ifdef MVME188 - case BRD_188: - cpu = cpu_number(); - curspl = m188_curspl[cpu]; - break; -#endif /* MVME188 */ -#if defined(MVME187) || defined(MVME197) - case BRD_187: - case BRD_197: - curspl = *md.intr_mask; - break; -#endif /* defined(MVME187) || defined(MVME197) */ - } - set_psr(psr); - return curspl; -} - -#if DDB -unsigned -db_spl(void) -{ - unsigned curspl; - m88k_psr_type psr; /* proccessor status register */ -#ifdef MVME188 - int cpu = 0; /* prevent warning */ -#endif psr = disable_interrupts_return_psr(); switch (brdtyp) { #ifdef MVME188 case BRD_188: - cpu = cpu_number(); - curspl = m188_curspl[cpu]; + curspl = m188_curspl[cpu_number()]; break; #endif /* MVME188 */ #if defined(MVME187) || defined(MVME197) case BRD_187: case BRD_197: - curspl = *md.intr_mask; + curspl = *md.intr_mask & 0x07; break; #endif /* defined(MVME187) || defined(MVME197) */ } set_psr(psr); return curspl; } -#endif /* DDB */ - -unsigned -getipl(void) -{ - return (spl()); -} - -#if DDB -unsigned -db_getipl(void) -{ - return (db_spl()); -} -#endif /* DDB */ unsigned setipl(unsigned level) { unsigned curspl; m88k_psr_type psr; /* proccessor status register */ -#ifdef MVME188 - int cpu = 0; /* prevent warning */ -#endif + +#ifdef DIAGNOSTIC if (level > 7) { - level = 0; /* XXX assume this for the time being */ +#ifdef DEBUG + printf("setipl: invoked with invalid level %x\n", level); +#endif + level &= 0x07; /* and pray it will work */ } +#endif psr = disable_interrupts_return_psr(); switch (brdtyp) { #ifdef MVME188 case BRD_188: - cpu = cpu_number(); - curspl = m188_curspl[cpu]; + curspl = m188_curspl[cpu_number()]; setlevel(level); break; #endif /* MVME188 */ #if defined(MVME187) || defined(MVME197) case BRD_187: case BRD_197: - curspl = *md.intr_mask; - *md.intr_mask = level; - break; -#endif /* defined(MVME187) || defined(MVME197) */ - } - - flush_pipeline(); - - /* The flush pipeline is required to make sure the above write gets - * through the data pipe and to the hardware; otherwise, the next - * bunch of instructions could execute at the wrong spl protection - */ - set_psr(psr); - return curspl; -} - -#ifdef DDB -unsigned -db_setipl(unsigned level) -{ - unsigned curspl; - m88k_psr_type psr; /* proccessor status register */ -#ifdef MVME188 - int cpu = 0; /* prevent warning */ -#endif - - psr = disable_interrupts_return_psr(); - switch (brdtyp) { -#ifdef MVME188 - case BRD_188: - cpu = cpu_number(); - curspl = m188_curspl[cpu]; - db_setlevel(level); - break; -#endif /* MVME188 */ -#if defined(MVME187) || defined(MVME197) - case BRD_187: - case BRD_197: - curspl = *md.intr_mask; + curspl = *md.intr_mask & 0x07; *md.intr_mask = level; break; #endif /* defined(MVME187) || defined(MVME197) */ @@ -615,7 +503,6 @@ db_setipl(unsigned level) set_psr(psr); return curspl; } -#endif /* DDB */ #if NCPUS > 1 #include <sys/simplelock.h> diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 6d479b7f3a1..399df42ddbc 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.99 2003/01/04 23:13:51 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.100 2003/01/13 20:12:18 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -180,7 +180,7 @@ int longformat = 1; /* for regdump() */ * safepri is a safe priority for sleep to set for a spin-wait * during autoconfiguration or after a panic. */ -int safepri = PSR_SUPERVISOR; +int safepri = IPL_NONE; struct vm_map *exec_map = NULL; struct vm_map *phys_map = NULL; @@ -1738,7 +1738,7 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) * Restore the mask level to what it was when the interrupt * was taken. */ - setipl((u_char)eframe->mask); + setipl(eframe->mask); flush_pipeline(); } @@ -1763,8 +1763,8 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) u_char vec; /* get level and mask */ - mask = *md.intr_mask; - level = *md.intr_ipl; + mask = *md.intr_mask & 0x07; + level = *md.intr_ipl & 0x07; /* * It is really bizarre for the mask and level to the be the same. @@ -1787,16 +1787,12 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) } /* and block interrupts at level or lower */ - setipl((u_char)level); + setipl(level); /* and stash it away in the trap frame */ eframe->mask = mask; uvmexp.intrs++; - if (level > 7 || (char)level < 0) { - panic("int level (%x) is not between 0 and 7", level); - } - /* generate IACK and get the vector */ flush_pipeline(); if (guarded_access(ivec[level], 1, &vec) == EFAULT) { @@ -1806,7 +1802,7 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) flush_pipeline(); flush_pipeline(); - if (vec > 0xFF) { + if (vec > 0xff) { panic("interrupt vector %x greater than 255", vec); } @@ -1859,13 +1855,14 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) data_access_emulation((unsigned *)eframe); eframe->dmt0 &= ~DMT_VALID; } + mask = eframe->mask; /* * Restore the mask level to what it was when the interrupt * was taken. */ - setipl((u_char)mask); + setipl(mask); } #endif /* MVME187 */ @@ -1879,7 +1876,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) u_char vec; /* get src and mask */ - mask = *md.intr_mask; + mask = *md.intr_mask & 0x07; src = *md.intr_src; if (v == T_NON_MASK) { @@ -1888,7 +1885,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) vec = BS_ABORTVEC; } else { /* get level */ - level = *md.intr_ipl; + level = *md.intr_ipl & 0x07; } /* @@ -1901,16 +1898,12 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) } /* and block interrupts at level or lower */ - setipl((u_char)level); + setipl(level); /* and stash it away in the trap frame */ eframe->mask = mask; uvmexp.intrs++; - if (level > 7 || (char)level < 0) { - panic("int level (%x) is not between 0 and 7", level); - } - if (v != T_NON_MASK) { /* generate IACK and get the vector */ flush_pipeline(); @@ -1922,7 +1915,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) flush_pipeline(); } - if (vec > 0xFF) { + if (vec > 0xff) { panic("interrupt vector %x greater than 255", vec); } @@ -1971,7 +1964,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) * Restore the mask level to what it was when the interrupt * was taken. */ - setipl((u_char)mask); + setipl(mask); } #endif diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c index 350a6d2ff6d..f7c168c4bc5 100644 --- a/sys/arch/mvme88k/mvme88k/trap.c +++ b/sys/arch/mvme88k/mvme88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.38 2003/01/09 22:27:10 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.39 2003/01/13 20:12:18 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -251,34 +251,34 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) /*FALLTHRU*/ case T_KDB_BREAK+T_USER: { - int s = db_splhigh(); + int s = splhigh(); db_enable_interrupt(); ddb_break_trap(T_KDB_BREAK,(db_regs_t*)frame); db_disable_interrupt(); - db_splx(s); + splx(s); return; } case T_KDB_ENTRY: /*FALLTHRU*/ case T_KDB_ENTRY+T_USER: { - int s = db_splhigh(); + int s = splhigh(); db_enable_interrupt(); ddb_entry_trap(T_KDB_ENTRY,(db_regs_t*)frame); db_disable_interrupt(); - db_splx(s); + splx(s); return; } #if 0 case T_ILLFLT: { - int s = db_splhigh(); + int s = splhigh(); db_enable_interrupt(); ddb_error_trap(type == T_ILLFLT ? "unimplemented opcode" : "error fault", (db_regs_t*)frame); db_disable_interrupt(); - db_splx(s); + splx(s); return; } #endif /* 0 */ @@ -746,49 +746,44 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) /*NOTREACHED*/ #if defined(DDB) case T_KDB_TRACE: - frame->mask = spl(); /* get current spl for reg dump */ - s = db_splhigh(); + s = splhigh(); db_enable_interrupt(); ddb_break_trap(T_KDB_TRACE,(db_regs_t*)frame); db_disable_interrupt(); - db_splx(s); + splx(s); return; case T_KDB_BREAK: /*FALLTHRU*/ case T_KDB_BREAK+T_USER: - frame->mask = spl(); /* get current spl for reg dump */ - s = db_splhigh(); - db_enable_interrupt(); - ddb_break_trap(T_KDB_BREAK,(db_regs_t*)frame); - db_disable_interrupt(); - db_splx(s); - return; + s = splhigh(); + db_enable_interrupt(); + ddb_break_trap(T_KDB_BREAK,(db_regs_t*)frame); + db_disable_interrupt(); + splx(s); + return; case T_KDB_ENTRY: /*FALLTHRU*/ case T_KDB_ENTRY+T_USER: - frame->mask = spl(); /* get current spl for reg dump */ - s = db_splhigh(); - db_enable_interrupt(); - ddb_entry_trap(T_KDB_ENTRY,(db_regs_t*)frame); - db_disable_interrupt(); + s = splhigh(); + db_enable_interrupt(); + ddb_entry_trap(T_KDB_ENTRY,(db_regs_t*)frame); + db_disable_interrupt(); if (frame->enip) { frame->exip = frame->enip; } else { frame->exip += 4; } - db_splx(s); - return; + splx(s); + return; #if 0 case T_ILLFLT: - { - int s = db_splhigh(); - db_enable_interrupt(); - ddb_error_trap(type == T_ILLFLT ? "unimplemented opcode" : - "error fault", (db_regs_t*)frame); - db_disable_interrupt(); - db_splx(s); - return; - } + s = splhigh(); + db_enable_interrupt(); + ddb_error_trap(type == T_ILLFLT ? "unimplemented opcode" : + "error fault", (db_regs_t*)frame); + db_disable_interrupt(); + splx(s); + return; #endif /* 0 */ #endif /* DDB */ case T_ILLFLT: @@ -1811,7 +1806,7 @@ splassert_check(int wantipl, const char *func) { int oldipl; - oldipl = spl(); + oldipl = getipl(); if (oldipl < wantipl) { splassert_fail(wantipl, oldipl, func); |