From owner-p4-projects@FreeBSD.ORG Mon Apr 21 13:28:44 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E4A3437B404; Mon, 21 Apr 2003 13:28:43 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C86D37B401 for ; Mon, 21 Apr 2003 13:28:43 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 25A0043FB1 for ; Mon, 21 Apr 2003 13:28:43 -0700 (PDT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h3LKSg0U082843 for ; Mon, 21 Apr 2003 13:28:42 -0700 (PDT) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3LKSg2v082838 for perforce@freebsd.org; Mon, 21 Apr 2003 13:28:42 -0700 (PDT) Date: Mon, 21 Apr 2003 13:28:42 -0700 (PDT) Message-Id: <200304212028.h3LKSg2v082838@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 29365 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2003 20:28:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=29365 Change 29365 by marcel@marcel_nfs on 2003/04/21 13:27:48 Use a non-trapping implementation for pmap_kextract. This has been deliberately made non-inlined for now to help profiling, debugging and whatsnot. Be extra careful (probably over-correctingly so :-) with the address passed to us, because it may be an address given to use from user space. Note that an inlined or partially inlined version should be used eventually. It appears that UMA is a regular user of pmap_kextract and rudimentary testing showed that it's mostly for direct mapped KVAs. Doing the test for direct mapped KVAs inlined will probably be worth it. Valuable insights by: jake Affected files ... .. //depot/projects/ia64_epc/sys/ia64/ia64/pmap.c#6 edit .. //depot/projects/ia64_epc/sys/ia64/include/pmap.h#4 edit Differences ... ==== //depot/projects/ia64_epc/sys/ia64/ia64/pmap.c#6 (text+ko) ==== @@ -125,6 +125,9 @@ #include #include +/* XXX move to a header. */ +extern u_int64_t ia64_gateway_page[]; + MALLOC_DEFINE(M_PMAP, "PMAP", "PMAP Structures"); #ifndef KSTACK_MAX_PAGES @@ -1309,6 +1312,37 @@ } /* + * Extract the physical page address associated with a kernel + * virtual address. + */ +vm_paddr_t +pmap_kextract(vm_offset_t va) +{ + struct ia64_lpte *pte; + vm_offset_t gwpage; + + KASSERT(va >= IA64_RR_BASE(5), ("Must be kernel VA")); + + /* Regions 6 and 7 are direct mapped. */ + if (va >= IA64_RR_BASE(6)) + return (IA64_RR_MASK(va)); + + /* EPC gateway page? */ + gwpage = (vm_offset_t)ia64_get_k5(); + if (va >= gwpage && va < gwpage + PAGE_SIZE) + return (IA64_RR_MASK((vm_offset_t)ia64_gateway_page)); + + /* Bail out if the virtual address is beyond our limits. */ + if (IA64_RR_MASK(va) >= nkpt * PAGE_SIZE * NKPTEPG) + return (0); + + pte = pmap_find_kpte(va); + if (!pte->pte_p) + return (0); + return ((pte->pte_ppn << 12) | (va & PAGE_MASK)); +} + +/* * Add a list of wired pages to the kva * this routine is only used for temporary * kernel mappings that do not need to have ==== //depot/projects/ia64_epc/sys/ia64/include/pmap.h#4 (text+ko) ==== @@ -59,14 +59,6 @@ #endif #define MAXKPT (PAGE_SIZE/sizeof(vm_offset_t)) -/* - * Routine: pmap_kextract - * Function: - * Extract the physical page address associated - * kernel virtual address. - */ -#define pmap_kextract ia64_tpa - #define vtophys(va) pmap_kextract(((vm_offset_t) (va))) #endif /* _KERNEL */ @@ -127,6 +119,7 @@ vm_offset_t pmap_steal_memory(vm_size_t); void pmap_bootstrap(void); void pmap_kenter(vm_offset_t va, vm_offset_t pa); +vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void pmap_setdevram(unsigned long long basea, vm_offset_t sizea); int pmap_uses_prom_console(void);