diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2004-02-23 19:09:58 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2004-02-23 19:09:58 +0000 |
commit | 3ded17d373374973a736f4ac489a185eca53518b (patch) | |
tree | 7553d103c7abe033ef823f46c0fb3c276d617d69 /sys | |
parent | c9dc116c74153ca63942692e3cdfffa1ee8205a9 (diff) |
Switch to the 3 arg version of userret to more closely match other OpenBSD
architectures.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm/arm/ast.c | 32 | ||||
-rw-r--r-- | sys/arch/arm/arm/fault.c | 6 | ||||
-rw-r--r-- | sys/arch/arm/arm/syscall.c | 22 | ||||
-rw-r--r-- | sys/arch/arm/arm/undefined.c | 10 | ||||
-rw-r--r-- | sys/arch/arm/include/cpu.h | 4 |
5 files changed, 47 insertions, 27 deletions
diff --git a/sys/arch/arm/arm/ast.c b/sys/arch/arm/arm/ast.c index c10b0d006e9..da700bf2873 100644 --- a/sys/arch/arm/arm/ast.c +++ b/sys/arch/arm/arm/ast.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ast.c,v 1.1 2004/02/01 05:09:48 drahn Exp $ */ +/* $OpenBSD: ast.c,v 1.2 2004/02/23 19:09:57 drahn Exp $ */ /* $NetBSD: ast.c,v 1.6 2003/10/31 16:44:34 cl Exp $ */ /* @@ -72,7 +72,7 @@ int want_resched = 0; extern int astpending; void -userret(struct proc *p) +userret(struct proc *p, u_int32_t pc, quad_t oticks) { int sig; @@ -80,11 +80,27 @@ userret(struct proc *p) while ((sig = (CURSIG(p))) != 0) postsig(sig); - #if 0 - /* XXX */ - curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri; - #endif - pmap_update(p->p_vmspace->vm_map.pmap); /* XXX DSR help stability */ + p->p_priority = p->p_usrpri; + + if (want_resched) { + /* + * We're being preempted. + */ + preempt(NULL); + while ((sig = CURSIG(p)) != 0) + postsig(sig); + } + + /* + * If profiling, charge recent system time to the trapped pc. + */ + if (p->p_flag & P_PROFIL) { + extern int psratio; + + addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio); + } + + curpriority = p->p_priority; } @@ -126,7 +142,7 @@ ast(struct trapframe *tf) if (want_resched) preempt(0); - userret(p); + userret(p, tf->tf_pc, p->p_sticks); /* XXX */ } /* End of ast.c */ diff --git a/sys/arch/arm/arm/fault.c b/sys/arch/arm/arm/fault.c index c685611d9ad..9c55bb25bf7 100644 --- a/sys/arch/arm/arm/fault.c +++ b/sys/arch/arm/arm/fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fault.c,v 1.3 2004/02/03 15:42:19 drahn Exp $ */ +/* $OpenBSD: fault.c,v 1.4 2004/02/23 19:09:57 drahn Exp $ */ /* $NetBSD: fault.c,v 1.46 2004/01/21 15:39:21 skrll Exp $ */ /* @@ -449,7 +449,7 @@ do_trapsignal: out: /* If returning to user mode, make sure to invoke userret() */ if (user) - userret(p); + userret(p, tf->tf_pc, p->p_sticks); } /* @@ -783,7 +783,7 @@ prefetch_abort_handler(trapframe_t *tf) do_trapsignal: out: - userret(p); + userret(p, tf->tf_pc, p->p_sticks); } /* diff --git a/sys/arch/arm/arm/syscall.c b/sys/arch/arm/arm/syscall.c index 5cd4e547631..5b026576e87 100644 --- a/sys/arch/arm/arm/syscall.c +++ b/sys/arch/arm/arm/syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.c,v 1.3 2004/02/12 04:11:42 drahn Exp $ */ +/* $OpenBSD: syscall.c,v 1.4 2004/02/23 19:09:57 drahn Exp $ */ /* $NetBSD: syscall.c,v 1.24 2003/11/14 19:03:17 scw Exp $ */ /*- @@ -117,12 +117,14 @@ swi_handler(trapframe_t *frame) struct proc *p = curproc; u_int32_t insn; union sigval sv; + u_quad_t sticks; /* * Enable interrupts if they were enabled before the exception. * Since all syscalls *should* come from user mode it will always * be safe to enable them, but check anyway. */ + sticks = p->p_sticks; #ifdef acorn26 if ((frame->tf_r15 & R15_IRQ_DISABLE) == 0) int_on(); @@ -143,7 +145,7 @@ swi_handler(trapframe_t *frame) /* Give the user an illegal instruction signal. */ sv.sival_ptr = (u_int32_t *)(u_int32_t)(frame->tf_pc-INSN_SIZE); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - userret(p); + userret(p, frame->tf_pc, p->p_sticks); return; } @@ -176,7 +178,7 @@ swi_handler(trapframe_t *frame) if ((insn & 0x0f000000) != 0x0f000000) { frame->tf_pc -= INSN_SIZE; curcpu()->ci_arm700bugcount.ev_count++; - userret(l); + userret(l, frame->tf_pc, p->p_sticks); return; } #endif /* CPU_ARM7 */ @@ -236,7 +238,7 @@ syscall_plain(struct trapframe *frame, struct proc *p, u_int32_t insn) break; } - userret(p); + userret(p, frame->tf_pc, p->p_sticks); return; case 0x000000: /* Old unofficial NetBSD range. */ case SWI_OS_NETBSD: /* New official NetBSD range. */ @@ -246,7 +248,7 @@ syscall_plain(struct trapframe *frame, struct proc *p, u_int32_t insn) /* Undefined so illegal instruction */ sv.sival_ptr = (u_int32_t *)(frame->tf_pc - INSN_SIZE); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); - userret(p); + userret(p, frame->tf_pc, p->p_sticks); return; } @@ -329,7 +331,7 @@ syscall_plain(struct trapframe *frame, struct proc *p, u_int32_t insn) scdebug_ret(p, code, error, rval); #endif - userret(p); + userret(p, frame->tf_pc, p->p_sticks); } void @@ -359,7 +361,7 @@ syscall_fancy(struct trapframe *frame, struct proc *p, u_int32_t insn) break; } - userret(p); + userret(p, frame->tf_pc, p->p_sticks); return; case 0x000000: /* Old unofficial NetBSD range. */ case SWI_OS_NETBSD: /* New official NetBSD range. */ @@ -369,7 +371,7 @@ syscall_fancy(struct trapframe *frame, struct proc *p, u_int32_t insn) /* Undefined so illegal instruction */ sv.sival_ptr = (u_int32_t *)(frame->tf_pc - INSN_SIZE); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); - userret(p); + userret(p, frame->tf_pc, p->p_sticks); return; } @@ -462,7 +464,7 @@ syscall_fancy(struct trapframe *frame, struct proc *p, u_int32_t insn) #ifdef SYSCALL_DEBUG scdebug_ret(p, code, orig_error, rval); #endif - userret(p); + userret(p, frame->tf_pc, p->p_sticks); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) ktrsysret(p, code, orig_error, rval[0]); @@ -483,7 +485,7 @@ child_return(arg) frame->tf_r15 &= ~R15_FLAG_C; /* carry bit */ #endif - userret(p); + userret(p, frame->tf_pc, 0); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { ktrsysret(p, SYS_fork, 0, 0); diff --git a/sys/arch/arm/arm/undefined.c b/sys/arch/arm/arm/undefined.c index 7a38f631b2e..4a7bd500c9d 100644 --- a/sys/arch/arm/arm/undefined.c +++ b/sys/arch/arm/arm/undefined.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undefined.c,v 1.1 2004/02/01 05:09:48 drahn Exp $ */ +/* $OpenBSD: undefined.c,v 1.2 2004/02/23 19:09:57 drahn Exp $ */ /* $NetBSD: undefined.c,v 1.22 2003/11/29 22:21:29 bjh21 Exp $ */ /* @@ -196,7 +196,7 @@ undefinedinstruction(trapframe_t *frame) /* Give the user an illegal instruction signal. */ sv.sival_int = (u_int32_t) fault_pc; trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - userret(p); + userret(p, fault_pc, p->p_sticks); return; } @@ -233,10 +233,11 @@ undefinedinstruction(trapframe_t *frame) p = &proc0; #ifdef __PROG26 - if ((frame->tf_r15 & R15_MODE) == R15_MODE_USR) { + if ((frame->tf_r15 & R15_MODE) == R15_MODE_USR) #else - if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) { + if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) #endif + { /* * Modify the fault_code to reflect the USR/SVC state at * time of fault. @@ -325,5 +326,6 @@ undefinedinstruction(trapframe_t *frame) #else userret(p); + userret(p, frame->tf_pc, p->p_sticks); #endif } diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h index 22b999ed8fb..e46dfa10336 100644 --- a/sys/arch/arm/include/cpu.h +++ b/sys/arch/arm/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */ +/* $OpenBSD: cpu.h,v 1.2 2004/02/23 19:09:57 drahn Exp $ */ /* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */ /* @@ -282,7 +282,7 @@ struct pcb; void savectx __P((struct pcb *pcb)); /* ast.c */ -void userret __P((register struct proc *p)); +void userret (register struct proc *p, u_int32_t pc, quad_t ticks); /* machdep.h */ void bootsync __P((void)); |