Date: Wed, 14 Jul 2004 20:47:41 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 57356 for review Message-ID: <200407142047.i6EKlfH9019501@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=57356 Change 57356 by rwatson@rwatson_tislabs on 2004/07/14 20:47:13 Integrate netperf_socket from FreeBSD CVS: - Alpha pmap locking. - More kdb cleanup, firewire. - kldunloadf(). - vfs_root() takes a thread. - KSE debugging related pieces. - 4BSD preemption bug fix. - If M_DONTWAIT in socket upcall, defer read to nfsd. - The great floppy disk escapade continues. - A variety of powerpc changes. - UFS1 extattr fix. Loop back rwatson_netperf locking: - ng_eiface, ng_fec, ng_iface, ng_ppp, ng_pppoe, ng_tty global locking. Affected files ... .. //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#11 integrate .. //depot/projects/netperf_socket/sys/alpha/include/ptrace.h#3 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/machdep.c#11 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#19 integrate .. //depot/projects/netperf_socket/sys/amd64/include/pmap.h#11 integrate .. //depot/projects/netperf_socket/sys/arm/arm/db_interface.c#2 integrate .. //depot/projects/netperf_socket/sys/arm/arm/db_trace.c#2 integrate .. //depot/projects/netperf_socket/sys/arm/arm/machdep.c#2 integrate .. //depot/projects/netperf_socket/sys/arm/arm/pmap.c#4 integrate .. //depot/projects/netperf_socket/sys/arm/include/bus_memio.h#1 branch .. //depot/projects/netperf_socket/sys/arm/include/bus_pio.h#1 branch .. //depot/projects/netperf_socket/sys/arm/include/cpufunc.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/db_machdep.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/frame.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/kdb.h#1 branch .. //depot/projects/netperf_socket/sys/arm/include/pcb.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/pmap.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/setjmp.h#2 integrate .. //depot/projects/netperf_socket/sys/compat/freebsd32/freebsd32_proto.h#7 integrate .. //depot/projects/netperf_socket/sys/compat/freebsd32/freebsd32_syscall.h#7 integrate .. //depot/projects/netperf_socket/sys/compat/freebsd32/freebsd32_syscalls.c#7 integrate .. //depot/projects/netperf_socket/sys/compat/freebsd32/freebsd32_sysent.c#7 integrate .. //depot/projects/netperf_socket/sys/compat/freebsd32/syscalls.master#6 integrate .. //depot/projects/netperf_socket/sys/conf/files#40 integrate .. //depot/projects/netperf_socket/sys/conf/files.i386#21 integrate .. //depot/projects/netperf_socket/sys/conf/files.powerpc#5 integrate .. //depot/projects/netperf_socket/sys/contrib/dev/fla/COPYRIGHT#2 delete .. //depot/projects/netperf_socket/sys/contrib/dev/fla/README#2 delete .. //depot/projects/netperf_socket/sys/contrib/dev/fla/fla.c#4 delete .. //depot/projects/netperf_socket/sys/contrib/dev/fla/i386/msysosak.o.uu#2 delete .. //depot/projects/netperf_socket/sys/contrib/dev/fla/msysosak.h#2 delete .. //depot/projects/netperf_socket/sys/contrib/dev/fla/patch.00#2 delete .. //depot/projects/netperf_socket/sys/contrib/dev/fla/prep.fla.sh#2 delete .. //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#31 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_battery.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_cmbat.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci.c#14 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpivar.h#18 integrate .. //depot/projects/netperf_socket/sys/dev/aic7xxx/aic7770.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/dcons/dcons.c#8 integrate .. //depot/projects/netperf_socket/sys/dev/digi/digi.c#12 integrate .. //depot/projects/netperf_socket/sys/dev/fdc/fdc.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/fdc/fdc_isa.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/fdc/fdc_pccard.c#3 integrate .. //depot/projects/netperf_socket/sys/dev/fdc/fdcvar.h#2 integrate .. //depot/projects/netperf_socket/sys/dev/mpt/mpt_debug.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/snp/snp.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/syscons/scvidctl.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/usb/usbdevs#18 integrate .. //depot/projects/netperf_socket/sys/fs/fdescfs/fdesc_vfsops.c#5 integrate .. //depot/projects/netperf_socket/sys/fs/portalfs/portal_vfsops.c#4 integrate .. //depot/projects/netperf_socket/sys/fs/smbfs/smbfs_vfsops.c#3 integrate .. //depot/projects/netperf_socket/sys/geom/label/g_label.c#3 integrate .. //depot/projects/netperf_socket/sys/geom/label/g_label.h#3 integrate .. //depot/projects/netperf_socket/sys/geom/stripe/g_stripe.c#4 integrate .. //depot/projects/netperf_socket/sys/i386/conf/NOTES#22 integrate .. //depot/projects/netperf_socket/sys/i386/conf/OLDCARD#2 integrate .. //depot/projects/netperf_socket/sys/i386/i386/local_apic.c#4 integrate .. //depot/projects/netperf_socket/sys/i386/i386/machdep.c#10 integrate .. //depot/projects/netperf_socket/sys/i386/i386/pmap.c#17 integrate .. //depot/projects/netperf_socket/sys/ia64/ia64/machdep.c#7 integrate .. //depot/projects/netperf_socket/sys/ia64/ia64/pmap.c#11 integrate .. //depot/projects/netperf_socket/sys/kern/init_sysent.c#10 integrate .. //depot/projects/netperf_socket/sys/kern/kern_descrip.c#11 integrate .. //depot/projects/netperf_socket/sys/kern/kern_event.c#6 integrate .. //depot/projects/netperf_socket/sys/kern/kern_exec.c#11 integrate .. //depot/projects/netperf_socket/sys/kern/kern_exit.c#15 integrate .. //depot/projects/netperf_socket/sys/kern/kern_fork.c#12 integrate .. //depot/projects/netperf_socket/sys/kern/kern_kse.c#5 integrate .. //depot/projects/netperf_socket/sys/kern/kern_linker.c#6 integrate .. //depot/projects/netperf_socket/sys/kern/kern_module.c#2 integrate .. //depot/projects/netperf_socket/sys/kern/kern_sig.c#14 integrate .. //depot/projects/netperf_socket/sys/kern/kern_thread.c#18 integrate .. //depot/projects/netperf_socket/sys/kern/link_elf.c#4 integrate .. //depot/projects/netperf_socket/sys/kern/link_elf_obj.c#6 integrate .. //depot/projects/netperf_socket/sys/kern/sched_4bsd.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/sys_process.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/syscalls.c#10 integrate .. //depot/projects/netperf_socket/sys/kern/syscalls.master#10 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#33 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_mount.c#12 integrate .. //depot/projects/netperf_socket/sys/modules/dcons/Makefile#2 integrate .. //depot/projects/netperf_socket/sys/modules/usb/Makefile#3 integrate .. //depot/projects/netperf_socket/sys/net/if_sl.c#8 integrate .. //depot/projects/netperf_socket/sys/net/if_var.h#16 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_eiface.c#6 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_fec.c#6 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_iface.c#7 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_ppp.c#4 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_pppoe.c#5 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_tty.c#5 integrate .. //depot/projects/netperf_socket/sys/netinet/in_pcb.h#5 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_icmp.c#8 integrate .. //depot/projects/netperf_socket/sys/nfsclient/nfs_socket.c#11 integrate .. //depot/projects/netperf_socket/sys/nfsserver/nfs_srvsock.c#7 integrate .. //depot/projects/netperf_socket/sys/pc98/conf/GENERIC#8 integrate .. //depot/projects/netperf_socket/sys/pc98/conf/NOTES#15 integrate .. //depot/projects/netperf_socket/sys/pc98/i386/machdep.c#8 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/clock.c#7 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/fd.c#10 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/fdc_cbus.c#2 integrate .. //depot/projects/netperf_socket/sys/pc98/pc98/fdcvar.h#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/conf/GENERIC#4 integrate .. //depot/projects/netperf_socket/sys/powerpc/include/cpufunc.h#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/include/db_machdep.h#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/include/kdb.h#1 branch .. //depot/projects/netperf_socket/sys/powerpc/include/pcb.h#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/include/pcpu.h#3 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/db_interface.c#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/db_trace.c#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/genassym.c#4 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/locore.S#3 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/machdep.c#4 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/trap.c#4 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/trap_subr.S#3 integrate .. //depot/projects/netperf_socket/sys/sparc64/sparc64/machdep.c#5 integrate .. //depot/projects/netperf_socket/sys/sys/event.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/eventvar.h#2 integrate .. //depot/projects/netperf_socket/sys/sys/kse.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/linker.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/module.h#2 integrate .. //depot/projects/netperf_socket/sys/sys/proc.h#17 integrate .. //depot/projects/netperf_socket/sys/sys/ptrace.h#4 integrate .. //depot/projects/netperf_socket/sys/sys/signalvar.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/socketvar.h#22 integrate .. //depot/projects/netperf_socket/sys/sys/syscall.h#10 integrate .. //depot/projects/netperf_socket/sys/sys/syscall.mk#10 integrate .. //depot/projects/netperf_socket/sys/sys/sysproto.h#10 integrate .. //depot/projects/netperf_socket/sys/ufs/ffs/ffs_vfsops.c#8 integrate Differences ... ==== //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#11 (text+ko) ==== @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.154 2004/07/08 07:44:55 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.157 2004/07/14 05:49:44 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -745,11 +745,18 @@ vm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va) { - pt_entry_t* pte = pmap_lev3pte(pmap, va); - if (pte) - return alpha_ptob(ALPHA_PTE_TO_PFN(*pte)); - else - return 0; + pt_entry_t *pte; + vm_paddr_t pa; + + pa = 0; + if (pmap == NULL) + return (pa); + PMAP_LOCK(pmap); + pte = pmap_lev3pte(pmap, va); + if (pte != NULL) + pa = alpha_ptob(ALPHA_PTE_TO_PFN(*pte)); + PMAP_UNLOCK(pmap); + return (pa); } /* @@ -1529,6 +1536,7 @@ { register pt_entry_t *ptq; + PMAP_LOCK_ASSERT(pmap, MA_OWNED); ptq = pmap_lev3pte(pmap, va); /* @@ -1560,8 +1568,12 @@ if (pmap == NULL) return; + /* + * Perform an unsynchronized read. This is, however, safe. + */ if (pmap->pm_stats.resident_count == 0) return; + PMAP_LOCK(pmap); /* * special handling of removing one page. a very @@ -1570,7 +1582,7 @@ */ if (sva + PAGE_SIZE == eva) { pmap_remove_page(pmap, sva); - return; + goto out; } for (va = sva; va < eva; va = nva) { @@ -1587,6 +1599,8 @@ pmap_remove_page(pmap, va); nva = va + PAGE_SIZE; } +out: + PMAP_UNLOCK(pmap); } /* @@ -2185,7 +2199,6 @@ pt_entry_t *pte, tpte; vm_page_t m; pv_entry_t pv, npv; - int s; #ifdef PMAP_REMOVE_PAGES_CURPROC_ONLY if (!curthread || (pmap != vmspace_pmap(curthread->td_proc->p_vmspace))) { @@ -2194,7 +2207,7 @@ } #endif - s = splvm(); + vm_page_lock_queues(); PMAP_LOCK(pmap); for(pv = TAILQ_FIRST(&pmap->pm_pvlist); pv; @@ -2228,6 +2241,10 @@ pv->pv_pmap->pm_stats.resident_count--; + if ((tpte & PG_FOW) == 0) + if (pmap_track_modified(pv->pv_va)) + vm_page_dirty(m); + npv = TAILQ_NEXT(pv, pv_plist); TAILQ_REMOVE(&pv->pv_pmap->pm_pvlist, pv, pv_plist); @@ -2240,9 +2257,9 @@ pmap_unuse_pt(pv->pv_pmap, pv->pv_va, pv->pv_ptem); free_pv_entry(pv); } - splx(s); pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); + vm_page_unlock_queues(); } /* @@ -2378,21 +2395,25 @@ { pv_entry_t pv; pt_entry_t *pte; + boolean_t rv; + rv = FALSE; if (!pmap_initialized || (m->flags & PG_FICTITIOUS)) - return FALSE; + return (rv); /* * A page is modified if any mapping has had its PG_FOW flag * cleared. */ TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + PMAP_LOCK(pv->pv_pmap); pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va); - if (!(*pte & PG_FOW)) - return 1; + rv = !(*pte & PG_FOW); + PMAP_UNLOCK(pv->pv_pmap); + if (rv) + break; } - - return 0; + return (rv); } /* @@ -2405,14 +2426,17 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) { pt_entry_t *pte; + boolean_t rv; - if (!pmap_pte_v(pmap_lev1pte(pmap, addr)) || - !pmap_pte_v(pmap_lev2pte(pmap, addr))) - return (FALSE); - pte = vtopte(addr); - if (*pte) - return (FALSE); - return (TRUE); + rv = FALSE; + PMAP_LOCK(pmap); + if (pmap_pte_v(pmap_lev1pte(pmap, addr)) && + pmap_pte_v(pmap_lev2pte(pmap, addr))) { + pte = vtopte(addr); + rv = *pte == 0; + } + PMAP_UNLOCK(pmap); + return (rv); } /* @@ -2611,30 +2635,30 @@ pmap_t pmap; vm_offset_t addr; { - pt_entry_t *pte; + pt_entry_t *ptep, pte; int val = 0; - pte = pmap_lev3pte(pmap, addr); - if (pte == 0) { - return 0; - } + PMAP_LOCK(pmap); + ptep = pmap_lev3pte(pmap, addr); + pte = (ptep != NULL) ? *ptep : 0; + PMAP_UNLOCK(pmap); - if (pmap_pte_v(pte)) { + if (pte & PG_V) { vm_page_t m; vm_offset_t pa; val = MINCORE_INCORE; - if ((*pte & PG_MANAGED) == 0) + if ((pte & PG_MANAGED) == 0) return val; - pa = pmap_pte_pa(pte); + pa = alpha_ptob(ALPHA_PTE_TO_PFN(pte)); m = PHYS_TO_VM_PAGE(pa); /* * Modified by us */ - if ((*pte & PG_FOW) == 0) + if ((pte & PG_FOW) == 0) val |= MINCORE_MODIFIED|MINCORE_MODIFIED_OTHER; else { /* @@ -2648,7 +2672,7 @@ /* * Referenced by us */ - if ((*pte & (PG_FOR | PG_FOE)) == 0) + if ((pte & (PG_FOR | PG_FOE)) == 0) val |= MINCORE_REFERENCED|MINCORE_REFERENCED_OTHER; else { /* ==== //depot/projects/netperf_socket/sys/alpha/include/ptrace.h#3 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)ptrace.h 8.1 (Berkeley) 6/11/93 - * $FreeBSD: src/sys/alpha/include/ptrace.h,v 1.11 2004/04/05 21:00:50 imp Exp $ + * $FreeBSD: src/sys/alpha/include/ptrace.h,v 1.12 2004/07/13 16:11:04 kensmith Exp $ */ #ifndef _MACHINE_PTRACE_H_ @@ -35,7 +35,6 @@ #ifdef _KERNEL #define FIX_SSTEP(p) ptrace_clear_single_step(p) -int ptrace_clear_single_step(struct thread *_p); #endif #endif ==== //depot/projects/netperf_socket/sys/amd64/amd64/machdep.c#11 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.613 2004/07/10 22:39:17 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.614 2004/07/13 07:22:54 davidxu Exp $"); #include "opt_atalk.h" #include "opt_atpic.h" @@ -1303,6 +1303,13 @@ } int +ptrace_clear_single_step(struct thread *td) +{ + td->td_frame->tf_rflags &= ~PSL_T; + return (0); +} + +int fill_regs(struct thread *td, struct reg *regs) { struct pcb *pcb; ==== //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#19 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.482 2004/07/07 16:47:58 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.484 2004/07/14 07:13:33 peter Exp $"); /* * Manages physical address maps. @@ -207,17 +207,17 @@ static pv_entry_t get_pv_entry(void); static void pmap_clear_ptes(vm_page_t m, int bit); -static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva); +static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, + vm_offset_t sva, pd_entry_t ptepde); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, - vm_offset_t va); -static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, - vm_page_t mpte, vm_page_t m); + vm_offset_t va, pd_entry_t ptepde); +static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va); static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex); -static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t); +static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t); static vm_offset_t pmap_kmem_choose(vm_offset_t addr); CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t)); @@ -334,12 +334,37 @@ } +static __inline pt_entry_t * +pmap_pte_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *ptepde) +{ + pd_entry_t *pde; + pt_entry_t *pte; + + pde = pmap_pde(pmap, va); + if (pde == NULL || (*pde & PG_V) == 0) + return NULL; + *ptepde = *pde; + if ((*pde & PG_PS) != 0) /* compat with i386 pmap_pte() */ + return ((pt_entry_t *)pde); + pte = (pt_entry_t *)PHYS_TO_DMAP(*pde & PG_FRAME); + return (&pte[pmap_pte_index(va)]); +} + + PMAP_INLINE pt_entry_t * vtopte(vm_offset_t va) { u_int64_t mask = ((1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + NPML4EPGSHIFT)) - 1); - return (PTmap + (amd64_btop(va) & mask)); + return (PTmap + ((va >> PAGE_SHIFT) & mask)); +} + +static __inline pd_entry_t * +vtopde(vm_offset_t va) +{ + u_int64_t mask = ((1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + NPML4EPGSHIFT)) - 1); + + return (PDmap + ((va >> PDRSHIFT) & mask)); } static u_int64_t @@ -1034,12 +1059,16 @@ * conditionally free the page, and manage the hold/wire counts. */ static int -pmap_unuse_pt(pmap_t pmap, vm_offset_t va, vm_page_t mpte) +pmap_unuse_pt(pmap_t pmap, vm_offset_t va, pd_entry_t ptepde) { + vm_page_t mpte; if (va >= VM_MAXUSER_ADDRESS) return 0; - +/* XXX this should be an error, all cases should be caught now */ + if (ptepde == 0) + ptepde = *pmap_pde(pmap, va); + mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME); return pmap_unwire_pte_hold(pmap, va, mpte); } @@ -1437,7 +1466,7 @@ static int -pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) +pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va, pd_entry_t ptepde) { pv_entry_t pv; int rtval; @@ -1458,7 +1487,7 @@ rtval = 0; if (pv) { - rtval = pmap_unuse_pt(pmap, va, pv->pv_ptem); + rtval = pmap_unuse_pt(pmap, va, ptepde); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); m->md.pv_list_count--; if (TAILQ_FIRST(&m->md.pv_list) == NULL) @@ -1476,14 +1505,13 @@ * (pmap, va). */ static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m) +pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) { pv_entry_t pv; pv = get_pv_entry(); pv->pv_va = va; pv->pv_pmap = pmap; - pv->pv_ptem = mpte; vm_page_lock_queues(); TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); @@ -1496,10 +1524,10 @@ * pmap_remove_pte: do the things to unmap a page in a process */ static int -pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va) +pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, pd_entry_t ptepde) { pt_entry_t oldpte; - vm_page_t m, mpte; + vm_page_t m; PMAP_LOCK_ASSERT(pmap, MA_OWNED); oldpte = pte_load_clear(ptq); @@ -1527,10 +1555,9 @@ } if (oldpte & PG_A) vm_page_flag_set(m, PG_REFERENCED); - return pmap_remove_entry(pmap, m, va); + return pmap_remove_entry(pmap, m, va, ptepde); } else { - mpte = PHYS_TO_VM_PAGE(*pmap_pde(pmap, va) & PG_FRAME); - return pmap_unuse_pt(pmap, va, mpte); + return pmap_unuse_pt(pmap, va, ptepde); } } @@ -1540,13 +1567,14 @@ static void pmap_remove_page(pmap_t pmap, vm_offset_t va) { + pd_entry_t ptepde; pt_entry_t *pte; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - pte = pmap_pte(pmap, va); + pte = pmap_pte_pde(pmap, va, &ptepde); if (pte == NULL || (*pte & PG_V) == 0) return; - pmap_remove_pte(pmap, pte, va); + pmap_remove_pte(pmap, pte, va, ptepde); pmap_invalidate_page(pmap, va); } @@ -1649,7 +1677,7 @@ if (pte == NULL || *pte == 0) continue; anyvalid = 1; - if (pmap_remove_pte(pmap, pte, sva)) + if (pmap_remove_pte(pmap, pte, sva, ptpaddr)) break; } } @@ -1677,6 +1705,7 @@ { register pv_entry_t pv; pt_entry_t *pte, tpte; + pd_entry_t ptepde; #if defined(PMAP_DIAGNOSTIC) /* @@ -1691,7 +1720,7 @@ while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { PMAP_LOCK(pv->pv_pmap); pv->pv_pmap->pm_stats.resident_count--; - pte = pmap_pte(pv->pv_pmap, pv->pv_va); + pte = pmap_pte_pde(pv->pv_pmap, pv->pv_va, &ptepde); tpte = pte_load_clear(pte); if (tpte & PG_W) pv->pv_pmap->pm_stats.wired_count--; @@ -1716,7 +1745,7 @@ TAILQ_REMOVE(&pv->pv_pmap->pm_pvlist, pv, pv_plist); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); m->md.pv_list_count--; - pmap_unuse_pt(pv->pv_pmap, pv->pv_va, pv->pv_ptem); + pmap_unuse_pt(pv->pv_pmap, pv->pv_va, ptepde); PMAP_UNLOCK(pv->pv_pmap); free_pv_entry(pv); } @@ -1849,6 +1878,7 @@ vm_paddr_t pa; register pt_entry_t *pte; vm_paddr_t opa; + pd_entry_t ptepde; pt_entry_t origpte, newpte; vm_page_t mpte; @@ -1882,7 +1912,7 @@ } #endif - pte = pmap_pte(pmap, va); + pte = pmap_pte_pde(pmap, va, &ptepde); /* * Page Directory table entry not valid, we need a new PT page @@ -1948,7 +1978,7 @@ int err; vm_page_lock_queues(); PMAP_LOCK(pmap); - err = pmap_remove_pte(pmap, pte, va); + err = pmap_remove_pte(pmap, pte, va, ptepde); PMAP_UNLOCK(pmap); vm_page_unlock_queues(); if (err) @@ -1962,7 +1992,7 @@ */ if (pmap_initialized && (m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) == 0) { - pmap_insert_entry(pmap, va, mpte, m); + pmap_insert_entry(pmap, va, m); pa |= PG_MANAGED; } @@ -2080,7 +2110,7 @@ * called at interrupt time. */ if ((m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) == 0) - pmap_insert_entry(pmap, va, mpte, m); + pmap_insert_entry(pmap, va, m); /* * Increment counters @@ -2331,8 +2361,7 @@ m = PHYS_TO_VM_PAGE(ptetemp & PG_FRAME); *dst_pte = ptetemp & ~(PG_M | PG_A); dst_pmap->pm_stats.resident_count++; - pmap_insert_entry(dst_pmap, addr, - dstmpte, m); + pmap_insert_entry(dst_pmap, addr, m); } else { vm_page_lock_queues(); pmap_unwire_pte_hold(dst_pmap, addr, dstmpte); @@ -2459,7 +2488,7 @@ return; } #endif - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_queues(); PMAP_LOCK(pmap); for (pv = TAILQ_FIRST(&pmap->pm_pvlist); pv; pv = npv) { @@ -2516,11 +2545,12 @@ if (TAILQ_EMPTY(&m->md.pv_list)) vm_page_flag_clear(m, PG_WRITEABLE); - pmap_unuse_pt(pmap, pv->pv_va, pv->pv_ptem); + pmap_unuse_pt(pmap, pv->pv_va, *vtopde(pv->pv_va)); free_pv_entry(pv); } pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); + vm_page_unlock_queues(); } /* ==== //depot/projects/netperf_socket/sys/amd64/include/pmap.h#11 (text+ko) ==== @@ -39,7 +39,7 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.120 2004/06/19 14:58:34 bde Exp $ + * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.121 2004/07/14 07:13:35 peter Exp $ */ #ifndef _MACHINE_PMAP_H_ @@ -256,7 +256,6 @@ vm_offset_t pv_va; /* virtual address for mapping */ TAILQ_ENTRY(pv_entry) pv_list; TAILQ_ENTRY(pv_entry) pv_plist; - vm_page_t pv_ptem; /* VM page for pte */ } *pv_entry_t; #ifdef _KERNEL ==== //depot/projects/netperf_socket/sys/arm/arm/db_interface.c#2 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/db_interface.c,v 1.1 2004/05/14 11:46:42 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/db_interface.c,v 1.2 2004/07/12 21:25:01 cognet Exp $"); #include "opt_ddb.h" #include <sys/param.h> @@ -62,36 +62,33 @@ #include <ddb/db_sym.h> #include <sys/cons.h> -static int nil; +static int nil = 0; -db_regs_t ddb_regs; int db_access_und_sp (struct db_variable *, db_expr_t *, int); int db_access_abt_sp (struct db_variable *, db_expr_t *, int); int db_access_irq_sp (struct db_variable *, db_expr_t *, int); -u_int db_fetch_reg (int, db_regs_t *); -int db_trapper __P((u_int, u_int, trapframe_t *, int)); - +#define DB_OFFSET(x) (db_expr_t *)offsetof(struct trapframe, x) struct db_variable db_regs[] = { - { "spsr", (int *)&DDB_REGS->tf_spsr, FCN_NULL, }, - { "r0", (int *)&DDB_REGS->tf_r0, FCN_NULL, }, - { "r1", (int *)&DDB_REGS->tf_r1, FCN_NULL, }, - { "r2", (int *)&DDB_REGS->tf_r2, FCN_NULL, }, - { "r3", (int *)&DDB_REGS->tf_r3, FCN_NULL, }, - { "r4", (int *)&DDB_REGS->tf_r4, FCN_NULL, }, - { "r5", (int *)&DDB_REGS->tf_r5, FCN_NULL, }, - { "r6", (int *)&DDB_REGS->tf_r6, FCN_NULL, }, - { "r7", (int *)&DDB_REGS->tf_r7, FCN_NULL, }, - { "r8", (int *)&DDB_REGS->tf_r8, FCN_NULL, }, - { "r9", (int *)&DDB_REGS->tf_r9, FCN_NULL, }, - { "r10", (int *)&DDB_REGS->tf_r10, FCN_NULL, }, - { "r11", (int *)&DDB_REGS->tf_r11, FCN_NULL, }, - { "r12", (int *)&DDB_REGS->tf_r12, FCN_NULL, }, - { "usr_sp", (int *)&DDB_REGS->tf_usr_sp, FCN_NULL, }, - { "usr_lr", (int *)&DDB_REGS->tf_usr_lr, FCN_NULL, }, - { "svc_sp", (int *)&DDB_REGS->tf_svc_sp, FCN_NULL, }, - { "svc_lr", (int *)&DDB_REGS->tf_svc_lr, FCN_NULL, }, - { "pc", (int *)&DDB_REGS->tf_pc, FCN_NULL, }, + { "spsr", DB_OFFSET(tf_spsr), FCN_NULL, }, + { "r0", DB_OFFSET(tf_r0), FCN_NULL, }, + { "r1", DB_OFFSET(tf_r1), FCN_NULL, }, + { "r2", DB_OFFSET(tf_r2), FCN_NULL, }, + { "r3", DB_OFFSET(tf_r3), FCN_NULL, }, + { "r4", DB_OFFSET(tf_r4), FCN_NULL, }, + { "r5", DB_OFFSET(tf_r5), FCN_NULL, }, + { "r6", DB_OFFSET(tf_r6), FCN_NULL, }, + { "r7", DB_OFFSET(tf_r7), FCN_NULL, }, + { "r8", DB_OFFSET(tf_r8), FCN_NULL, }, + { "r9", DB_OFFSET(tf_r9), FCN_NULL, }, + { "r10", DB_OFFSET(tf_r10), FCN_NULL, }, + { "r11", DB_OFFSET(tf_r11), FCN_NULL, }, + { "r12", DB_OFFSET(tf_r12), FCN_NULL, }, + { "usr_sp", DB_OFFSET(tf_usr_sp), FCN_NULL, }, + { "usr_lr", DB_OFFSET(tf_usr_lr), FCN_NULL, }, + { "svc_sp", DB_OFFSET(tf_svc_sp), FCN_NULL, }, + { "svc_lr", DB_OFFSET(tf_svc_lr), FCN_NULL, }, + { "pc", DB_OFFSET(tf_pc), FCN_NULL, }, { "und_sp", &nil, db_access_und_sp, }, { "abt_sp", &nil, db_access_abt_sp, }, { "irq_sp", &nil, db_access_irq_sp, }, @@ -99,8 +96,6 @@ struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); -int db_active = 0; - int db_access_und_sp(struct db_variable *vp, db_expr_t *valp, int rw) { @@ -128,39 +123,6 @@ return(0); } -#ifdef DDB -/* - * kdb_trap - field a TRACE or BPT trap - */ -int -kdb_trap(int type, db_regs_t *regs) -{ - int s; - - switch (type) { - case T_BREAKPOINT: /* breakpoint */ - case -1: /* keyboard interrupt */ - break; - default: - break; - } - - /* Should switch to kdb`s own stack here. */ - - ddb_regs = *regs; - - s = splhigh(); - db_active++; - db_trap(type, 0/*code*/); - db_active--; - splx(s); - - *regs = ddb_regs; - - return (1); -} -#endif - void db_show_mdpcpu(struct pcpu *pc) { @@ -188,7 +150,7 @@ /* * Read bytes from kernel address space for debugger. */ -void +int db_read_bytes(addr, size, data) vm_offset_t addr; size_t size; @@ -198,32 +160,33 @@ if (db_validate_address((u_int)src)) { db_printf("address %p is invalid\n", src); - return; + return (-1); } if (size == 4 && (addr & 3) == 0 && ((uintptr_t)data & 3) == 0) { *((int*)data) = *((int*)src); - return; + return (0); } if (size == 2 && (addr & 1) == 0 && ((uintptr_t)data & 1) == 0) { *((short*)data) = *((short*)src); - return; + return (0); } while (size-- > 0) { if (db_validate_address((u_int)src)) { db_printf("address %p is invalid\n", src); - return; + return (-1); } *data++ = *src++; } + return (0); } /* * Write bytes to kernel address space for debugger. */ -void +int db_write_bytes(vm_offset_t addr, size_t size, char *data) { char *dst; @@ -231,13 +194,13 @@ /* If any part is in kernel text, use db_write_text() */ if (addr >= (vm_offset_t) btext && addr < (vm_offset_t) etext) { - return; + return (-1); } dst = (char *)addr; if (db_validate_address((u_int)dst)) { db_printf("address %p is invalid\n", dst); - return; + return (0); } if (size == 4 && (addr & 3) == 0 && ((uintptr_t)data & 3) == 0) @@ -250,7 +213,7 @@ while (loop-- > 0) { if (db_validate_address((u_int)dst)) { db_printf("address %p is invalid\n", dst); - return; + return (-1); } *dst++ = *data++; } @@ -262,73 +225,8 @@ /* In case the current page tables have been modified ... */ cpu_tlb_flushID(); cpu_cpwait(); -} - -#ifdef DDB -void -Debugger(const char *msg) -{ - db_printf("Debugger(\"%s\")\n", msg); - __asm(".word 0xe7ffffff"); -} - -int -db_trapper(u_int addr, u_int inst, trapframe_t *frame, int fault_code) -{ - - if (fault_code == 0) { - if ((inst & ~INSN_COND_MASK) == (BKPT_INST & ~INSN_COND_MASK)) - kdb_trap(T_BREAKPOINT, frame); - else - kdb_trap(-1, frame); - } else - return (1); return (0); } -extern u_int end; - -#endif -u_int -db_fetch_reg(int reg, db_regs_t *db_regs) -{ - - switch (reg) { - case 0: - return (db_regs->tf_r0); - case 1: - return (db_regs->tf_r1); - case 2: - return (db_regs->tf_r2); - case 3: - return (db_regs->tf_r3); - case 4: - return (db_regs->tf_r4); - case 5: - return (db_regs->tf_r5); - case 6: - return (db_regs->tf_r6); - case 7: - return (db_regs->tf_r7); - case 8: - return (db_regs->tf_r8); - case 9: - return (db_regs->tf_r9); - case 10: - return (db_regs->tf_r10); - case 11: - return (db_regs->tf_r11); - case 12: - return (db_regs->tf_r12); - case 13: - return (db_regs->tf_svc_sp); - case 14: - return (db_regs->tf_svc_lr); - case 15: - return (db_regs->tf_pc); - default: - panic("db_fetch_reg: botch"); - } -} ==== //depot/projects/netperf_socket/sys/arm/arm/db_trace.c#2 (text+ko) ==== @@ -30,12 +30,13 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/db_trace.c,v 1.1 2004/05/14 11:46:42 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/db_trace.c,v 1.2 2004/07/12 21:25:01 cognet Exp $"); #include <sys/param.h> #include <sys/proc.h> #include <sys/user.h> >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407142047.i6EKlfH9019501>