diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2011-04-06 14:45:24 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2011-04-06 14:45:24 +0000 |
commit | a5e0218e967719742d76ea571cbcafb03fffa027 (patch) | |
tree | 2748b5b294f4bb91158b974ae853e2a16cf6b5d5 /sys/arch/hppa64 | |
parent | 722c45c21727f1ca6a8c03a926aa8fdc10ce362c (diff) |
Move CPL to struct cpu_info.
ok kettenis@
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r-- | sys/arch/hppa64/hppa64/genassym.cf | 3 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/locore.S | 23 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/trap.c | 30 | ||||
-rw-r--r-- | sys/arch/hppa64/include/cpu.h | 3 |
5 files changed, 32 insertions, 36 deletions
diff --git a/sys/arch/hppa64/hppa64/genassym.cf b/sys/arch/hppa64/hppa64/genassym.cf index bed7034674a..bf233c26b95 100644 --- a/sys/arch/hppa64/hppa64/genassym.cf +++ b/sys/arch/hppa64/hppa64/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.6 2011/04/05 16:05:51 jsing Exp $ +# $OpenBSD: genassym.cf,v 1.7 2011/04/06 14:45:23 jsing Exp $ # # Copyright (c) 1982, 1990, 1993 @@ -130,6 +130,7 @@ member pcb_space struct cpu_info member ci_trap_save member ci_psw +member ci_cpl member ci_curproc struct uvm diff --git a/sys/arch/hppa64/hppa64/locore.S b/sys/arch/hppa64/hppa64/locore.S index 7f4871d5544..9ab89bc3f95 100644 --- a/sys/arch/hppa64/hppa64/locore.S +++ b/sys/arch/hppa64/hppa64/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.16 2011/04/05 16:05:51 jsing Exp $ */ +/* $OpenBSD: locore.S,v 1.17 2011/04/06 14:45:23 jsing Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -45,9 +45,6 @@ .data .align 16 - .export cpl, data -cpl - .word IPL_HIGH BSS(pdc_stack, 8) /* temp stack for PDC call */ BSS(emrg_stack, 8) /* stack for HPMC/TOC/PWRF */ @@ -98,6 +95,8 @@ $start ldil L%(PSL_W|PSL_Q|PSL_P|PSL_C|PSL_D|PSL_S|PSL_O), %r8 ldo R%(PSL_W|PSL_Q|PSL_P|PSL_C|PSL_D|PSL_S|PSL_O)(%r8), %r8 stw %r8, CI_PSW(%r1) + ldi IPL_HIGH, %r8 + stw %r8, CI_CPL(%r1) ldil L%pdc, %r1 std %arg0, R%pdc(%r1) @@ -1771,8 +1770,8 @@ switch_tramp_p .dword switch_trampoline ENTRY(switch_trampoline,0) - ldil L%cpl, %r1 - stw %r0, R%cpl(%r1) + mfctl %cr24, %r1 + stw %r0, CI_CPL(%r1) /* ldd 0x18(%arg3), %r19 but we know we are in kernel! */ ldd 0x10(%arg3), %arg3 @@ -1839,14 +1838,14 @@ splraise_ok sync mfctl %eiem, %arg2 mtctl %r0, %eiem - ldil L%cpl, %r1 - ldw R%cpl(%r1), %ret0 + mfctl %cr24, %r1 + ldw CI_CPL(%r1), %ret0 ldil L%imask, %arg3 ldo R%imask(%arg3), %arg3 sub,<= %arg0, %ret0, %r0 ldd,s %arg0(%arg3), %arg2 sub,<= %arg0, %ret0, %r0 - stw %arg0, R%cpl(%r1) + stw %arg0, CI_CPL(%r1) sync bv %r0(%rp) mtctl %arg2, %eiem @@ -1873,14 +1872,14 @@ spllower_ok sync mfctl %eiem, %arg2 mtctl %r0, %eiem - ldil L%cpl, %r1 - ldw R%cpl(%r1), %ret0 + mfctl %cr24, %r1 + ldw CI_CPL(%r1), %ret0 ldil L%imask, %arg3 ldo R%imask(%arg3), %arg3 sub,>= %arg0, %ret0, %r0 ldd,s %arg0(%arg3), %arg2 sub,>= %arg0, %ret0, %r0 - stw %arg0, R%cpl(%r1) + stw %arg0, CI_CPL(%r1) sync bv %r0(%rp) mtctl %arg2, %eiem diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c index c3bb292d979..bea912da981 100644 --- a/sys/arch/hppa64/hppa64/machdep.c +++ b/sys/arch/hppa64/hppa64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.32 2011/04/05 15:46:53 jsing Exp $ */ +/* $OpenBSD: machdep.c,v 1.33 2011/04/06 14:45:23 jsing Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -1033,10 +1033,9 @@ consinit(void) void splassert_check(int wantipl, const char *func) { - extern int cpl; /* from locoore.s */ + struct cpu_info *ci = curcpu(); - if (cpl < wantipl) { - splassert_fail(wantipl, cpl, func); - } + if (ci->ci_cpl < wantipl) + splassert_fail(wantipl, ci->ci_cpl, func); } #endif diff --git a/sys/arch/hppa64/hppa64/trap.c b/sys/arch/hppa64/hppa64/trap.c index d006a91d8d5..c57327376dd 100644 --- a/sys/arch/hppa64/hppa64/trap.c +++ b/sys/arch/hppa64/hppa64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.16 2011/04/03 14:56:28 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.17 2011/04/06 14:45:23 jsing Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -161,11 +161,8 @@ userret(struct proc *p, register_t pc, u_quad_t oticks) } void -trap(type, frame) - int type; - struct trapframe *frame; +trap(int type, struct trapframe *frame) { - extern int cpl; /* from locore.o */ struct proc *p = curproc; vaddr_t va; struct vm_map *map; @@ -178,7 +175,7 @@ trap(type, frame) const char *tts; vm_fault_t fault = VM_FAULT_INVALID; #ifdef DIAGNOSTIC - long oldcpl = cpl; + long oldcpl = curcpu()->ci_cpl; #endif trapnum = type & ~T_USER; @@ -529,13 +526,13 @@ printf("eirr 0x%08x\n", mfctl(CR_EIRR)); } #ifdef DIAGNOSTIC - if (cpl != oldcpl) + if (curcpu()->ci_cpl != oldcpl) printf("WARNING: SPL (%d) NOT LOWERED ON " - "TRAP (%d) EXIT\n", cpl, trapnum); + "TRAP (%d) EXIT\n", curcpu()->ci_cpl, trapnum); #endif if (trapnum != T_INTERRUPT) - splx(cpl); /* process softints */ + splx(curcpu()->ci_cpl); /* process softints */ /* * in case we were interrupted from the syscall gate page @@ -549,8 +546,7 @@ printf("eirr 0x%08x\n", mfctl(CR_EIRR)); } void -child_return(arg) - void *arg; +child_return(void *arg) { struct proc *p = (struct proc *)arg; struct trapframe *tf = p->p_md.md_regs; @@ -580,13 +576,12 @@ void syscall(struct trapframe *frame); void syscall(struct trapframe *frame) { - extern int cpl; /* from locore.o */ 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 - long oldcpl = cpl; + long oldcpl = curcpu()->ci_cpl; #endif /* TODO syscall */ @@ -722,12 +717,13 @@ syscall(struct trapframe *frame) ktrsysret(p, code, oerror, rval[0]); #endif #ifdef DIAGNOSTIC - if (cpl != oldcpl) { + if (curcpu()->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; + curcpu()->ci_cpl, code, args[0], args[1], args[2], + p->p_pid); + curcpu()->ci_cpl = oldcpl; } #endif - splx(cpl); /* process softints */ + splx(curcpu()->ci_cpl); /* process softints */ } diff --git a/sys/arch/hppa64/include/cpu.h b/sys/arch/hppa64/include/cpu.h index aa88b02be8a..e988c564e86 100644 --- a/sys/arch/hppa64/include/cpu.h +++ b/sys/arch/hppa64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.21 2011/04/05 16:05:51 jsing Exp $ */ +/* $OpenBSD: cpu.h,v 1.22 2011/04/06 14:45:23 jsing Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -124,6 +124,7 @@ struct cpu_info { volatile u_long ci_trap_save[16]; volatile int ci_psw; + volatile int ci_cpl; struct proc *ci_curproc; struct pcb *ci_cpcb; |