diff options
author | Takuya ASADA <syuu@cvs.openbsd.org> | 2009-12-30 01:18:00 +0000 |
---|---|---|
committer | Takuya ASADA <syuu@cvs.openbsd.org> | 2009-12-30 01:18:00 +0000 |
commit | aa7de489180ed4045ec2895ebc106d3ff4b9955e (patch) | |
tree | 3447368dc908ebc97232029e8733f3ac5db7adc4 | |
parent | 6ad3e0960226d6ca2e0e2c45c1dd135f61dc1c75 (diff) |
curcpu()->ci_curpmap added. ok miod@
-rw-r--r-- | sys/arch/mips64/include/cpu.h | 29 | ||||
-rw-r--r-- | sys/arch/mips64/include/pmap.h | 3 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/pmap.c | 17 |
3 files changed, 23 insertions, 26 deletions
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h index 66ddd69cd42..57d14b39b81 100644 --- a/sys/arch/mips64/include/cpu.h +++ b/sys/arch/mips64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.49 2009/12/28 06:55:27 syuu Exp $ */ +/* $OpenBSD: cpu.h,v 1.50 2009/12/30 01:17:59 syuu Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -369,22 +369,23 @@ struct cpu_info { struct cpu_info *ci_self; /* pointer to this structure */ struct cpu_info *ci_next; /* next cpu */ struct proc *ci_curproc; - struct user *ci_curprocpaddr; + struct user *ci_curprocpaddr; struct schedstate_percpu - ci_schedstate; - int ci_want_resched; /* need_resched() invoked */ - cpuid_t ci_cpuid; /* our CPU ID */ - uint32_t ci_randseed; /* per cpu random seed */ - int ci_ipl; /* software IPL */ - uint32_t ci_softpending; /* pending soft interrupts */ - int ci_clock_started; - u_int32_t ci_cpu_counter_last; - u_int32_t ci_cpu_counter_interval; - u_int32_t ci_pendingticks; + ci_schedstate; + int ci_want_resched; /* need_resched() invoked */ + cpuid_t ci_cpuid; /* our CPU ID */ + uint32_t ci_randseed; /* per cpu random seed */ + int ci_ipl; /* software IPL */ + uint32_t ci_softpending; /* pending soft interrupts */ + int ci_clock_started; + u_int32_t ci_cpu_counter_last; + u_int32_t ci_cpu_counter_interval; + u_int32_t ci_pendingticks; + struct pmap *ci_curpmap; #ifdef MULTIPROCESSOR - u_long ci_flags; /* flags; see below */ - struct intrhand ci_ipiih; + u_long ci_flags; /* flags; see below */ + struct intrhand ci_ipiih; #endif }; diff --git a/sys/arch/mips64/include/pmap.h b/sys/arch/mips64/include/pmap.h index 98006ad6889..f1778730471 100644 --- a/sys/arch/mips64/include/pmap.h +++ b/sys/arch/mips64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.17 2009/12/28 06:55:27 syuu Exp $ */ +/* $OpenBSD: pmap.h,v 1.18 2009/12/30 01:17:59 syuu Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -100,7 +100,6 @@ typedef struct pmap { struct pmap_statistics pm_stats; /* pmap statistics */ u_int pm_tlbpid[MAXCPUS]; /* address space tag */ u_int pm_tlbgen[MAXCPUS]; /* TLB PID generation number */ - int pm_active; struct segtab *pm_segtab; /* pointers to pages of PTEs */ } *pmap_t; diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c index 5c26847c1a0..2bfde56729c 100644 --- a/sys/arch/mips64/mips64/pmap.c +++ b/sys/arch/mips64/mips64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.44 2009/12/28 07:18:39 syuu Exp $ */ +/* $OpenBSD: pmap.c,v 1.45 2009/12/30 01:17:59 syuu Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -193,7 +193,7 @@ pmap_invalidate_user_page(pmap_t pmap, vaddr_t va) unsigned int m = 1 << i; if (pmap->pm_tlbgen[i] != tlbpid_gen[i]) continue; - else if (!(pmap->pm_active & m)) { + else if (ci->ci_curpmap != pmap) { pmap->pm_tlbgen[i] = 0; continue; } @@ -265,7 +265,7 @@ pmap_update_user_page(pmap_t pmap, vaddr_t va, pt_entry_t entry) unsigned int m = 1 << i; if (pmap->pm_tlbgen[i] != tlbpid_gen[i]) continue; - else if (!(pmap->pm_active & m)) { + else if (ci->ci_curpmap != pmap) { pmap->pm_tlbgen[i] = 0; continue; } @@ -586,10 +586,9 @@ void pmap_activate(struct proc *p) { pmap_t pmap = p->p_vmspace->vm_map.pmap; - unsigned int cpuid = cpu_number(); - unsigned int cpumask = (1 << cpuid); + struct cpu_info *ci = curcpu(); - atomic_setbits_int(&pmap->pm_active, cpumask); + ci->ci_curpmap = pmap; p->p_addr->u_pcb.pcb_segtab = pmap->pm_segtab; pmap_alloc_tlbpid(p); } @@ -600,11 +599,9 @@ pmap_activate(struct proc *p) void pmap_deactivate(struct proc *p) { - pmap_t pmap = p->p_vmspace->vm_map.pmap; - unsigned int cpuid = cpu_number(); - unsigned int cpumask = (1 << cpuid); + struct cpu_info *ci = curcpu(); - atomic_clearbits_int(&pmap->pm_active, cpumask); + ci->ci_curpmap = NULL; } /* |