diff options
-rw-r--r-- | sys/arch/hppa/hppa/genassym.cf | 3 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/intr.c | 23 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 4 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/trap.c | 22 | ||||
-rw-r--r-- | sys/arch/hppa/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/arch/hppa/include/intr.h | 10 |
7 files changed, 41 insertions, 31 deletions
diff --git a/sys/arch/hppa/hppa/genassym.cf b/sys/arch/hppa/hppa/genassym.cf index f17aecfd78a..79bc995dddf 100644 --- a/sys/arch/hppa/hppa/genassym.cf +++ b/sys/arch/hppa/hppa/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.33 2009/07/29 18:31:11 kettenis Exp $ +# $OpenBSD: genassym.cf,v 1.34 2009/12/31 12:52:35 jsing Exp $ # # Copyright (c) 1982, 1990, 1993 @@ -158,6 +158,7 @@ member fpswtch struct cpu_info member ci_curproc +member ci_cpl # system calls export SYSCALLGATE diff --git a/sys/arch/hppa/hppa/intr.c b/sys/arch/hppa/hppa/intr.c index 7f4ba5f7a9e..516287d74ff 100644 --- a/sys/arch/hppa/hppa/intr.c +++ b/sys/arch/hppa/hppa/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.26 2009/07/30 14:50:20 kettenis Exp $ */ +/* $OpenBSD: intr.c,v 1.27 2009/12/31 12:52:35 jsing Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -61,7 +61,6 @@ struct hppa_iv { } __packed; register_t kpsw = PSL_Q | PSL_P | PSL_C | PSL_D; -volatile int cpu_inintr, cpl = IPL_NESTED; u_long cpu_mask; struct hppa_iv intr_store[8*2*CPU_NINTS] __attribute__ ((aligned(32))), *intr_more = intr_store, *intr_list; @@ -83,9 +82,10 @@ volatile u_long ipending, imask[NIPL] = { void splassert_check(int wantipl, const char *func) { - if (cpl < wantipl) { - splassert_fail(wantipl, cpl, func); - } + struct cpu_info *ci = curcpu(); + + if (ci->ci_cpl < wantipl) + splassert_fail(wantipl, ci->ci_cpl, func); } #endif @@ -282,14 +282,15 @@ fls(u_int mask) void cpu_intr(void *v) { + struct cpu_info *ci = curcpu(); struct trapframe *frame = v; u_long mask; int s; mtctl(0, CR_EIEM); - s = cpl; - if (cpu_inintr++) + s = ci->ci_cpl; + if (ci->ci_in_intr++) frame->tf_flags |= TFF_INTR; while ((mask = ipending & ~imask[s])) { @@ -304,7 +305,7 @@ cpu_intr(void *v) if (iv->flags & HPPA_IV_SOFT) uvmexp.softs++; - cpl = iv->pri; + ci->ci_cpl = iv->pri; mtctl(frame->tf_eiem, CR_EIEM); for (r = iv->flags & HPPA_IV_SOFT; iv && iv->handler; iv = iv->next) @@ -316,14 +317,14 @@ cpu_intr(void *v) } #if 0 /* XXX this does not work, lasi gives us double ints */ if (!r) { - cpl = 0; + ci->ci_cpl = 0; printf("stray interrupt %d\n", bit); } #endif mtctl(0, CR_EIEM); } - cpu_inintr--; - cpl = s; + ci->ci_in_intr--; + ci->ci_cpl = s; mtctl(frame->tf_eiem, CR_EIEM); } diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index 183f5863d8a..da1081a1f33 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.163 2009/12/29 16:37:10 jsing Exp $ */ +/* $OpenBSD: locore.S,v 1.164 2009/12/31 12:52:35 jsing Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -101,6 +101,7 @@ .import panic, code #define curproc (cpu_info_primary + CI_CURPROC) +#define cpl (cpu_info_primary + CI_CPL) #define EMRG_STACKSIZE (1*NBPG) #define FPEMU_STACKSIZE (1*NBPG) @@ -2103,7 +2104,6 @@ intr_ticks #define INTR_PROF_AFT /* */ #endif - .import cpl, data .import ipending, data .import imask, data .import intr_table, data diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index a20d756dede..8da55d1e8c4 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.178 2009/08/11 19:17:16 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.179 2009/12/31 12:52:35 jsing Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -286,6 +286,7 @@ hppa_init(start) { extern u_long cpu_hzticks; extern int kernel_text; + struct cpu_info *ci; int error; pdc_init(); /* init PDC iface, so we can call em easy */ @@ -355,6 +356,9 @@ hppa_init(start) PAGE0->ivec_mempflen = (hppa_pfr_end - hppa_pfr + 1) * 4; } + ci = curcpu(); + ci->ci_cpl = IPL_NESTED; + cpuid(); ptlball(); ficacheall(); diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index ad0b097099d..71a5840a02e 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.103 2009/12/29 13:40:09 jsing Exp $ */ +/* $OpenBSD: trap.c,v 1.104 2009/12/31 12:52:35 jsing Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -156,6 +156,7 @@ trap(type, frame) int type; struct trapframe *frame; { + struct cpu_info *ci = curcpu(); struct proc *p = curproc; vaddr_t va; struct vm_map *map; @@ -168,7 +169,7 @@ trap(type, frame) const char *tts; vm_fault_t fault = VM_FAULT_INVALID; #ifdef DIAGNOSTIC - int oldcpl = cpl; + int oldcpl = ci->ci_cpl; #endif trapnum = type & ~T_USER; @@ -562,13 +563,13 @@ if (kdb_trap (type, va, frame)) } #ifdef DIAGNOSTIC - if (cpl != oldcpl) + if (ci->ci_cpl != oldcpl) printf("WARNING: SPL (%d) NOT LOWERED ON " - "TRAP (%d) EXIT\n", cpl, trapnum); + "TRAP (%d) EXIT\n", ci->ci_cpl, trapnum); #endif if (trapnum != T_INTERRUPT) - splx(cpl); /* process softints */ + splx(ci->ci_cpl); /* process softints */ /* * in case we were interrupted from the syscall gate page @@ -702,12 +703,13 @@ process_sstep(struct proc *p, int sstep) void syscall(struct trapframe *frame) { + struct cpu_info *ci = curcpu(); register struct proc *p = curproc; register const struct sysent *callp; int retq, nsys, code, argsize, argoff, oerror, error; register_t args[8], rval[2]; #ifdef DIAGNOSTIC - int oldcpl = cpl; + int oldcpl = ci->ci_cpl; #endif uvmexp.syscalls++; @@ -848,14 +850,14 @@ syscall(struct trapframe *frame) ktrsysret(p, code, oerror, rval[0]); #endif #ifdef DIAGNOSTIC - if (cpl != oldcpl) { + if (ci->ci_cpl != oldcpl) { printf("WARNING: SPL (0x%x) NOT LOWERED ON " "syscall(0x%x, 0x%x, 0x%x, 0x%x...) EXIT, PID %d\n", - cpl, code, args[0], args[1], args[2], p->p_pid); - cpl = oldcpl; + ci->ci_cpl, code, args[0], args[1], args[2], p->p_pid); + ci->ci_cpl = oldcpl; } #endif - splx(cpl); /* process softints */ + splx(ci->ci_cpl); /* process softints */ } /* diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h index bb6c5f62bbd..e5d686b2d98 100644 --- a/sys/arch/hppa/include/cpu.h +++ b/sys/arch/hppa/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.62 2009/12/29 13:40:09 jsing Exp $ */ +/* $OpenBSD: cpu.h,v 1.63 2009/12/31 12:52:35 jsing Exp $ */ /* * Copyright (c) 2000-2004 Michael Shalayeff @@ -70,6 +70,8 @@ struct cpu_info { struct proc *ci_curproc; + volatile int ci_cpl; + volatile int ci_in_intr; int ci_want_resched; struct schedstate_percpu ci_schedstate; diff --git a/sys/arch/hppa/include/intr.h b/sys/arch/hppa/include/intr.h index 7321850ea8d..8cca16943e8 100644 --- a/sys/arch/hppa/include/intr.h +++ b/sys/arch/hppa/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.26 2009/12/29 13:11:40 jsing Exp $ */ +/* $OpenBSD: intr.h,v 1.27 2009/12/31 12:52:35 jsing Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -57,7 +57,6 @@ #include <machine/atomic.h> -extern volatile int cpl; extern volatile u_long ipending, imask[NIPL]; #ifdef DIAGNOSTIC @@ -91,11 +90,12 @@ spllower(int ncpl) static __inline int splraise(int ncpl) { - int ocpl = cpl; + struct cpu_info *ci = curcpu(); + int ocpl = ci->ci_cpl; if (ocpl < ncpl) - cpl = ncpl; - __asm __volatile ("sync" : "+r" (cpl)); + ci->ci_cpl = ncpl; + __asm __volatile ("sync" : "+r" (ci->ci_cpl)); return (ocpl); } |