diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2012-11-01 21:09:18 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2012-11-01 21:09:18 +0000 |
commit | da485459fb7dc182f620713525573b046db4e188 (patch) | |
tree | 02cb6b79f3b1f7d4b112e4683810353fb3463896 | |
parent | 5fb77fc211900ec373a25d705a8901cab6582053 (diff) |
Switch alpha to per-process astpending.
-rw-r--r-- | sys/arch/alpha/alpha/genassym.cf | 5 | ||||
-rw-r--r-- | sys/arch/alpha/alpha/ipifuncs.c | 5 | ||||
-rw-r--r-- | sys/arch/alpha/alpha/locore.s | 12 | ||||
-rw-r--r-- | sys/arch/alpha/alpha/machdep.c | 8 | ||||
-rw-r--r-- | sys/arch/alpha/alpha/trap.c | 22 | ||||
-rw-r--r-- | sys/arch/alpha/include/cpu.h | 37 | ||||
-rw-r--r-- | sys/arch/alpha/include/proc.h | 5 |
7 files changed, 31 insertions, 63 deletions
diff --git a/sys/arch/alpha/alpha/genassym.cf b/sys/arch/alpha/alpha/genassym.cf index d8393934035..8b6b91c3e89 100644 --- a/sys/arch/alpha/alpha/genassym.cf +++ b/sys/arch/alpha/alpha/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.11 2007/10/10 15:53:51 art Exp $ +# $OpenBSD: genassym.cf,v 1.12 2012/11/01 21:09:17 miod Exp $ # Copyright (c) 1994, 1995 Gordon W. Ross # Copyright (c) 1993 Adam Glass @@ -106,7 +106,7 @@ struct proc member p_addr member p_vmspace member p_stat -member P_MD_FLAGS p_md.md_flags +member P_MD_ASTPENDING p_md.md_astpending member P_MD_PCBPADDR p_md.md_pcbpaddr member p_cpu @@ -157,4 +157,3 @@ member FPCURPROC ci_fpcurproc member CURPCB ci_curpcb member IDLE_PCB_PADDR ci_idle_pcb_paddr member WANT_RESCHED ci_want_resched -member ASTPENDING ci_astpending diff --git a/sys/arch/alpha/alpha/ipifuncs.c b/sys/arch/alpha/alpha/ipifuncs.c index 725d2a7a3c3..e1622f8c4b2 100644 --- a/sys/arch/alpha/alpha/ipifuncs.c +++ b/sys/arch/alpha/alpha/ipifuncs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipifuncs.c,v 1.2 2008/06/26 05:42:08 ray Exp $ */ +/* $OpenBSD: ipifuncs.c,v 1.3 2012/11/01 21:09:17 miod Exp $ */ /* $NetBSD: ipifuncs.c,v 1.9 1999/12/02 01:09:11 thorpej Exp $ */ /*- @@ -169,6 +169,5 @@ alpha_ipi_imb() void alpha_ipi_ast() { - - aston(curcpu()); + cpu_unidle(curcpu()); } diff --git a/sys/arch/alpha/alpha/locore.s b/sys/arch/alpha/alpha/locore.s index c6b2461ca33..67170c1883c 100644 --- a/sys/arch/alpha/alpha/locore.s +++ b/sys/arch/alpha/alpha/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.34 2008/07/28 19:08:43 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.35 2012/11/01 21:09:17 miod Exp $ */ /* $NetBSD: locore.s,v 1.94 2001/04/26 03:10:44 ross Exp $ */ /*- @@ -151,7 +151,7 @@ bootstack: * __start: Kernel start. * * Arguments: - * a0 is the first free page frame number (PFN) + * a0 is the first free page frame number (PFN) (no longer used) * a1 is the page table base register (PTBR) * a2 is the bootinfo magic number * a3 is the pointer to the bootinfo structure @@ -166,15 +166,13 @@ Lstart1: LDGP(pv) lda sp,bootstack /* Load KGP with current GP. */ - or a0,zero,s0 /* save pfn */ or gp,zero,a0 call_pal PAL_OSF1_wrkgp /* clobbers a0, t0, t8-t11 */ - or s0,zero,a0 /* restore pfn */ /* * Call alpha_init() to do pre-main initialization. * alpha_init() gets the arguments we were called with, - * which are already in a0, a1, a2, a3 and a4. + * which are already in a0 (destroyed), a1, a2, a3 and a4. */ CALL(alpha_init) @@ -322,7 +320,8 @@ LEAF(exception_return, 1) /* XXX should be NESTED */ /* GET_CPUINFO clobbers v0, t0, t8...t11. */ GET_CPUINFO - ldq t2, CPU_INFO_ASTPENDING(v0) /* AST pending? */ + ldq t1, CPU_INFO_CURPROC(v0) + ldl t2, P_MD_ASTPENDING(t1) /* AST pending? */ bne t2, 6f /* yes */ /* no: return & deal with FP */ @@ -331,7 +330,6 @@ LEAF(exception_return, 1) /* XXX should be NESTED */ * the current proc is fpcurproc. v0 already contains the cpu_info * pointer from above. */ - ldq t1, CPU_INFO_CURPROC(v0) ldq t2, CPU_INFO_FPCURPROC(v0) cmpeq t1, t2, t1 mov zero, a0 diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 381a6b73597..264180a6993 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.138 2012/10/20 19:08:38 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.139 2012/11/01 21:09:17 miod Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -214,8 +214,8 @@ phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX]; /* low size bits overloaded */ int mem_cluster_cnt; void -alpha_init(pfn, ptb, bim, bip, biv) - u_long pfn; /* first free PFN number */ +alpha_init(unused, ptb, bim, bip, biv) + u_long unused; u_long ptb; /* PFN of current level 1 page table */ u_long bim; /* bootinfo magic */ u_long bip; /* bootinfo pointer */ @@ -788,11 +788,11 @@ nobootinfo: */ hz = hwrpb->rpb_intr_freq >> 12; if (!(60 <= hz && hz <= 10240)) { - hz = 1024; #ifdef DIAGNOSTIC printf("WARNING: unbelievable rpb_intr_freq: %ld (%d hz)\n", hwrpb->rpb_intr_freq, hz); #endif + hz = 1024; } } diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c index 2963ebf0a25..96ca595c100 100644 --- a/sys/arch/alpha/alpha/trap.c +++ b/sys/arch/alpha/alpha/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.61 2012/08/07 05:16:53 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.62 2012/11/01 21:09:17 miod Exp $ */ /* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */ /*- @@ -244,17 +244,8 @@ trap(a0, a1, a2, entry, framep) ucode = 0; v = 0; user = (framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0; - if (user) { + if (user) p->p_md.md_tf = framep; -#if 0 -/* This is to catch some weird stuff on the UDB (mj) */ - if (framep->tf_regs[FRAME_PC] > 0 && - framep->tf_regs[FRAME_PC] < 0x120000000) { - printf("PC Out of Whack\n"); - printtrap(a0, a1, a2, entry, framep, 1, user); - } -#endif - } switch (entry) { case ALPHA_KENTRY_UNA: @@ -692,12 +683,11 @@ void ast(framep) struct trapframe *framep; { - struct proc *p; - - curcpu()->ci_astpending = 0; + struct cpu_info *ci = curcpu(); + struct proc *p = ci->ci_curproc; - p = curproc; p->p_md.md_tf = framep; + p->p_md.md_astepending = 0; #ifdef DIAGNOSTIC if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) == 0) @@ -710,7 +700,7 @@ ast(framep) ADDUPROF(p); } - if (curcpu()->ci_want_resched) + if (ci->ci_want_resched) preempt(NULL); /* Do any deferred user pmap operations. */ diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h index b449f836859..24c3f2c755f 100644 --- a/sys/arch/alpha/include/cpu.h +++ b/sys/arch/alpha/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.44 2012/06/26 01:59:47 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.45 2012/11/01 21:09:17 miod Exp $ */ /* $NetBSD: cpu.h,v 1.45 2000/08/21 02:03:12 thorpej Exp $ */ /*- @@ -196,7 +196,6 @@ struct cpu_info { paddr_t ci_idle_pcb_paddr; /* PA of idle PCB */ struct cpu_softc *ci_softc; /* pointer to our device */ u_long ci_want_resched; /* preempt current process */ - u_long ci_astpending; /* AST is pending */ u_long ci_intrdepth; /* interrupt trap depth */ struct trapframe *ci_db_regs; /* registers for debuggers */ #if defined(MULTIPROCESSOR) @@ -281,47 +280,29 @@ struct clockframe { * Preempt the current process if in interrupt from user mode, * or after the current trap/syscall if in system mode. */ -#ifdef MULTIPROCESSOR #define need_resched(ci) \ do { \ - ci->ci_want_resched = 1; \ - aston(curcpu()); \ + (ci)->ci_want_resched = 1; \ + if ((ci)->ci_curproc != NULL) \ + aston((ci)->ci_curproc); \ } while (/*CONSTCOND*/0) #define clear_resched(ci) (ci)->ci_want_resched = 0 -#else -#define need_resched(ci) \ -do { \ - curcpu()->ci_want_resched = 1; \ - aston(curcpu()); \ -} while (/*CONSTCOND*/0) -#define clear_resched(ci) curcpu()->ci_want_resched = 0 -#endif /* * Give a profiling tick to the current process when the user profiling * buffer pages are invalid. On the Alpha, request an AST to send us * through trap, marking the proc as needing a profiling tick. */ -#ifdef notyet -#define need_proftick(p) \ -do { \ - aston((p)->p_cpu); \ -} while (/*CONSTCOND*/0) -#else -#define need_proftick(p) \ -do { \ - aston(curcpu()); \ -} while (/*CONSTCOND*/0) -#endif +#define need_proftick(p) aston(p) /* * Notify the current process (p) that it has a signal pending, * process as soon as possible. */ -#ifdef notyet -#define signotify(p) aston((p)->p_cpu) +#ifdef MULTIPROCESSOR +#define signotify(p) do { aston(p); cpu_unidle((p)->p_cpu); } while (0) #else -#define signotify(p) aston(curcpu()) +#define signotify(p) aston(p) #endif /* @@ -330,7 +311,7 @@ do { \ * it sees a normal kernel entry? I guess letting it happen later * follows the `asynchronous' part of the name... */ -#define aston(ci) ((ci)->ci_astpending = 1) +#define aston(p) (p)->p_md.md_astpending = 1 #endif /* _KERNEL */ /* diff --git a/sys/arch/alpha/include/proc.h b/sys/arch/alpha/include/proc.h index 611c2dfd3cf..b75d3bbe9e4 100644 --- a/sys/arch/alpha/include/proc.h +++ b/sys/arch/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.10 2006/03/17 21:43:29 miod Exp $ */ +/* $OpenBSD: proc.h,v 1.11 2012/11/01 21:09:17 miod Exp $ */ /* $NetBSD: proc.h,v 1.2 1995/03/24 15:01:36 cgd Exp $ */ /* @@ -39,7 +39,8 @@ struct mdbpt { }; struct mdproc { - u_long md_flags; + u_int md_flags; + volatile u_int md_astpending; /* AST pending for this process */ struct trapframe *md_tf; /* trap/syscall registers */ struct pcb *md_pcbpaddr; /* phys addr of the pcb */ struct mdbpt md_sstep[2]; /* two breakpoints for sstep */ |