Module Name: src Committed By: jym Date: Fri Feb 26 19:25:07 UTC 2010
Modified Files: src/sys/arch/amd64/include: pte.h src/sys/arch/i386/i386: dumpsys.c src/sys/arch/i386/include: pte.h src/sys/arch/i386/pci: elan520.c src/sys/arch/x86/x86: bus_dma.c pmap.c src/sys/arch/xen/x86: x86_xpmap.c Log Message: Fixes regarding paddr_t/pd_entry_t types in MD x86 code, exposed by PAE: - NBPD_* macros are set to the types that better match their architecture (UL for i386 and amd64, ULL for i386 PAE) - will revisit when paddr_t is set to 64 bits for i386 non-PAE. - type fixes in printf/printk messages (Use PRIxPADDR when printing paddr_t values, instead of %lx - paddr_t/pd_entry_t being 64 bits with PAE) - remove casts that are no more needed now that Xen2 support has been dropped Some fixes are from jmorse@ patches for PAE. Compile + tested for i386 GENERIC and XEN3 kernels. Only compile tested for amd64. Reviewed by bou...@. See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/include/pte.h cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/i386/dumpsys.c cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/include/pte.h cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/pci/elan520.c cvs rdiff -u -r1.52 -r1.53 src/sys/arch/x86/x86/bus_dma.c cvs rdiff -u -r1.104 -r1.105 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/x86/x86_xpmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/include/pte.h diff -u src/sys/arch/amd64/include/pte.h:1.5 src/sys/arch/amd64/include/pte.h:1.6 --- src/sys/arch/amd64/include/pte.h:1.5 Thu Jan 28 14:10:54 2010 +++ src/sys/arch/amd64/include/pte.h Fri Feb 26 19:25:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.5 2010/01/28 14:10:54 mbalmer Exp $ */ +/* $NetBSD: pte.h,v 1.6 2010/02/26 19:25:07 jym Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -81,10 +81,10 @@ #define L2_SHIFT 21 #define L3_SHIFT 30 #define L4_SHIFT 39 -#define NBPD_L1 (1ULL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */ -#define NBPD_L2 (1ULL << L2_SHIFT) /* # bytes mapped by L2 ent (2MB) */ -#define NBPD_L3 (1ULL << L3_SHIFT) /* # bytes mapped by L3 ent (1G) */ -#define NBPD_L4 (1ULL << L4_SHIFT) /* # bytes mapped by L4 ent (512G) */ +#define NBPD_L1 (1UL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */ +#define NBPD_L2 (1UL << L2_SHIFT) /* # bytes mapped by L2 ent (2MB) */ +#define NBPD_L3 (1UL << L3_SHIFT) /* # bytes mapped by L3 ent (1G) */ +#define NBPD_L4 (1UL << L4_SHIFT) /* # bytes mapped by L4 ent (512G) */ #define L4_MASK 0x0000ff8000000000 #define L3_MASK 0x0000007fc0000000 Index: src/sys/arch/i386/i386/dumpsys.c diff -u src/sys/arch/i386/i386/dumpsys.c:1.8 src/sys/arch/i386/i386/dumpsys.c:1.9 --- src/sys/arch/i386/i386/dumpsys.c:1.8 Sat Nov 7 07:27:44 2009 +++ src/sys/arch/i386/i386/dumpsys.c Fri Feb 26 19:25:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dumpsys.c,v 1.8 2009/11/07 07:27:44 cegger Exp $ */ +/* $NetBSD: dumpsys.c,v 1.9 2010/02/26 19:25:07 jym Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dumpsys.c,v 1.8 2009/11/07 07:27:44 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dumpsys.c,v 1.9 2010/02/26 19:25:07 jym Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -342,8 +342,7 @@ max_paddr = top; } #ifdef DUMP_DEBUG - printf("dump_misc_init: max_paddr = 0x%lx\n", - (unsigned long)max_paddr); + printf("dump_misc_init: max_paddr = %#" PRIxPADDR "\n", max_paddr); #endif sparse_dump_physmap = (void*)uvm_km_alloc(kernel_map, Index: src/sys/arch/i386/include/pte.h diff -u src/sys/arch/i386/include/pte.h:1.20 src/sys/arch/i386/include/pte.h:1.21 --- src/sys/arch/i386/include/pte.h:1.20 Tue Nov 17 22:35:43 2009 +++ src/sys/arch/i386/include/pte.h Fri Feb 26 19:25:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.20 2009/11/17 22:35:43 dyoung Exp $ */ +/* $NetBSD: pte.h,v 1.21 2010/02/26 19:25:07 jym Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -221,8 +221,8 @@ #else /* PAE */ #define L1_SHIFT 12 #define L2_SHIFT 22 -#define NBPD_L1 (1ULL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */ -#define NBPD_L2 (1ULL << L2_SHIFT) /* # bytes mapped by L2 ent (4MB) */ +#define NBPD_L1 (1UL << L1_SHIFT) /* # bytes mapped by L1 ent (4K) */ +#define NBPD_L2 (1UL << L2_SHIFT) /* # bytes mapped by L2 ent (4MB) */ #define L2_MASK 0xffc00000 #define L1_MASK 0x003ff000 Index: src/sys/arch/i386/pci/elan520.c diff -u src/sys/arch/i386/pci/elan520.c:1.47 src/sys/arch/i386/pci/elan520.c:1.48 --- src/sys/arch/i386/pci/elan520.c:1.47 Wed Feb 24 22:37:55 2010 +++ src/sys/arch/i386/pci/elan520.c Fri Feb 26 19:25:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: elan520.c,v 1.47 2010/02/24 22:37:55 dyoung Exp $ */ +/* $NetBSD: elan520.c,v 1.48 2010/02/26 19:25:07 jym Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: elan520.c,v 1.47 2010/02/24 22:37:55 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: elan520.c,v 1.48 2010/02/26 19:25:07 jym Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -725,8 +725,9 @@ par = bus_space_read_4(memt, memh, MMCR_PAR(pidx)); aprint_debug_dev(self, - "protect kernel text at physical addresses %p - %p\n", - (void *)region0.start, (void *)region0.end); + "protect kernel text at physical addresses " + "%#" PRIxPADDR " - %#" PRIxPADDR "\n", + region0.start, region0.end); nregion = region_paddr_to_par(®ion0, regions, sfkb); if (nregion == 0) { @@ -742,8 +743,9 @@ end_pa = regions[0].end; aprint_debug_dev(self, - "actually protect kernel text at physical addresses %p - %p\n", - (void *)start_pa, (void *)end_pa); + "actually protect kernel text at physical addresses " + "%#" PRIxPADDR " - %#" PRIxPADDR "\n", + start_pa, end_pa); aprint_verbose_dev(self, "%" PRIu32 " bytes of kernel text are unprotected\n", unprotsize); @@ -758,8 +760,9 @@ for (i = 1; i < nregion; i++) { xnregion = region_paddr_to_par(®ions[i], xregions, fkb); if (xnregion == 0) { - aprint_verbose_dev(self, "skip region %p - %p\n", - (void *)regions[i].start, (void *)regions[i].end); + aprint_verbose_dev(self, "skip region " + "%#" PRIxPADDR " - %#" PRIxPADDR "\n", + regions[i].start, regions[i].end); continue; } if ((pidx = elansc_alloc_par(memt, memh)) == -1) { @@ -771,8 +774,9 @@ sc->sc_textpar[tidx++] = pidx; aprint_debug_dev(self, - "protect add'l kernel text at physical addresses %p - %p\n", - (void *)xregions[0].start, (void *)xregions[0].end); + "protect add'l kernel text at physical addresses " + "%#" PRIxPADDR " - %#" PRIxPADDR "\n", + xregions[0].start, xregions[0].end); for (j = 1; j < xnregion; j++) unprotsize += xregions[j].end - xregions[j].start; Index: src/sys/arch/x86/x86/bus_dma.c diff -u src/sys/arch/x86/x86/bus_dma.c:1.52 src/sys/arch/x86/x86/bus_dma.c:1.53 --- src/sys/arch/x86/x86/bus_dma.c:1.52 Fri Nov 6 23:10:10 2009 +++ src/sys/arch/x86/x86/bus_dma.c Fri Feb 26 19:25:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.52 2009/11/06 23:10:10 dsl Exp $ */ +/* $NetBSD: bus_dma.c,v 1.53 2010/02/26 19:25:07 jym Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.52 2009/11/06 23:10:10 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.53 2010/02/26 19:25:07 jym Exp $"); /* * The following is included because _bus_dma_uiomove is derived from @@ -182,7 +182,7 @@ #ifdef DIAGNOSTIC if (curaddr < low || curaddr >= high) { printf("vm_page_alloc_memory returned non-sensical" - " address 0x%lx\n", curaddr); + " address %#" PRIxPADDR "\n", curaddr); panic("_bus_dmamem_alloc_range"); } #endif Index: src/sys/arch/x86/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.104 src/sys/arch/x86/x86/pmap.c:1.105 --- src/sys/arch/x86/x86/pmap.c:1.104 Tue Feb 16 00:48:17 2010 +++ src/sys/arch/x86/x86/pmap.c Fri Feb 26 19:25:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.104 2010/02/16 00:48:17 jym Exp $ */ +/* $NetBSD: pmap.c,v 1.105 2010/02/26 19:25:07 jym Exp $ */ /* * Copyright (c) 2007 Manuel Bouyer. @@ -149,7 +149,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2010/02/16 00:48:17 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.105 2010/02/26 19:25:07 jym Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -1397,11 +1397,10 @@ tlbflush(); } #if defined(DEBUG) - aprint_normal("kernel text is mapped with " - "%lu large pages and %lu normal pages\n", - (unsigned long)howmany(kva - KERNBASE, NBPD_L2), - (unsigned long)howmany((vaddr_t)&__data_start - kva, - NBPD_L1)); + aprint_normal("kernel text is mapped with %" PRIuPSIZE " large " + "pages and %" PRIuPSIZE " normal pages\n", + howmany(kva - KERNBASE, NBPD_L2), + howmany((vaddr_t)&__data_start - kva, NBPD_L1)); #endif /* defined(DEBUG) */ } #endif /* !XEN */ @@ -1416,7 +1415,7 @@ */ early_zerop = (void *)(KERNBASE + NKL2_KIMG_ENTRIES * NBPD_L2); - early_zero_pte = PTE_BASE + pl1_i((unsigned long)early_zerop); + early_zero_pte = PTE_BASE + pl1_i((vaddr_t)early_zerop); } /* @@ -2038,8 +2037,8 @@ ptp = pmap_find_ptp(pmap, va, ppa, 1); #ifdef DIAGNOSTIC if (ptp == NULL) { - printf("va %lx ppa %lx\n", (unsigned long)va, - (unsigned long)ppa); + printf("va %" PRIxVADDR " ppa %" PRIxPADDR "\n", + va, ppa); panic("pmap_get_ptp: unmanaged user PTP"); } #endif @@ -2094,8 +2093,8 @@ * PG_V) value at the right place. */ pdir[PDIR_SLOT_KERN + nkptp[PTP_LEVELS - 1] - 1] = - (unsigned long)-1 & PG_FRAME; -#else /* XEN && __x86_64__*/ + (pd_entry_t)-1 & PG_FRAME; +#else /* XEN && __x86_64__*/ /* zero init area */ memset(pdir, 0, PDIR_SLOT_PTE * sizeof(pd_entry_t)); @@ -2780,7 +2779,7 @@ int i; int s = splvm(); /* don't update the kernel L3 slot */ - for (i = 0 ; i < PDP_SIZE - 1 ; i++, l3_pd += sizeof(pd_entry_t)) { + for (i = 0 ; i < PDP_SIZE - 1; i++, l3_pd += sizeof(pd_entry_t)) { xpq_queue_pte_update(l3_pd, xpmap_ptom(pmap->pm_pdirpa[i]) | PG_V); } @@ -2916,7 +2915,7 @@ pd_entry_t * const *pdes; struct pmap *pmap2; struct cpu_info *ci; - vaddr_t pa; + paddr_t pa; lwp_t *l; bool hard, rv; @@ -3303,7 +3302,7 @@ #if defined(DIAGNOSTIC) && !defined(DOM0OPS) if (PHYS_TO_VM_PAGE(pmap_pte2pa(opte)) != NULL) panic("pmap_remove_ptes: managed page without " - "PG_PVLIST for 0x%lx", startva); + "PG_PVLIST for %#" PRIxVADDR, startva); #endif continue; } @@ -3312,8 +3311,9 @@ #ifdef DIAGNOSTIC if (pg == NULL) panic("pmap_remove_ptes: unmanaged page marked " - "PG_PVLIST, va = 0x%lx, pa = 0x%lx", - startva, (u_long)pmap_pte2pa(opte)); + "PG_PVLIST, va = %#" PRIxVADDR ", " + "pa = %#" PRIxPADDR, + startva, (paddr_t)pmap_pte2pa(opte)); #endif /* sync R/M bits */ @@ -3388,7 +3388,7 @@ #if defined(DIAGNOSTIC) && !defined(DOM0OPS) if (PHYS_TO_VM_PAGE(pmap_pte2pa(opte)) != NULL) panic("pmap_remove_pte: managed page without " - "PG_PVLIST for 0x%lx", va); + "PG_PVLIST for %#" PRIxVADDR, va); #endif return(true); } @@ -3397,8 +3397,8 @@ #ifdef DIAGNOSTIC if (pg == NULL) panic("pmap_remove_pte: unmanaged page marked " - "PG_PVLIST, va = 0x%lx, pa = 0x%lx", va, - (u_long)(pmap_pte2pa(opte))); + "PG_PVLIST, va = %#" PRIxVADDR ", pa = %#" PRIxPADDR, + va, (paddr_t)pmap_pte2pa(opte)); #endif /* sync R/M bits */ @@ -4483,9 +4483,9 @@ for (/* null */; sva < blkendva ; sva += PAGE_SIZE, pte++) { if (!pmap_valid_entry(*pte)) continue; - printf("va %#lx -> pa %#lx (pte=%#lx)\n", - sva, (unsigned long)*pte, - (unsigned long)pmap_pte2pa(*pte)); + printf("va %#" PRIxVADDR " -> pa %#" PRIxPADDR + " (pte=%#" PRIxPADDR ")\n", + sva, (paddr_t)pmap_pte2pa(*pte), (paddr_t)*pte); } } pmap_unmap_ptes(pmap, pmap2); Index: src/sys/arch/xen/x86/x86_xpmap.c diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.18 src/sys/arch/xen/x86/x86_xpmap.c:1.19 --- src/sys/arch/xen/x86/x86_xpmap.c:1.18 Fri Feb 12 01:55:45 2010 +++ src/sys/arch/xen/x86/x86_xpmap.c Fri Feb 26 19:25:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_xpmap.c,v 1.18 2010/02/12 01:55:45 jym Exp $ */ +/* $NetBSD: x86_xpmap.c,v 1.19 2010/02/26 19:25:07 jym Exp $ */ /* * Copyright (c) 2006 Mathieu Ropert <m...@adviseo.fr> @@ -69,7 +69,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.18 2010/02/12 01:55:45 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.19 2010/02/26 19:25:07 jym Exp $"); #include "opt_xen.h" #include "opt_ddb.h" @@ -147,8 +147,8 @@ for (va = base; va < end; va += PAGE_SIZE) { KASSERT(va >= VM_MIN_KERNEL_ADDRESS); ptp = kvtopte(va); - XENPRINTF(("xen_set_ldt %p %d %p\n", (void *)base, - entries, ptp)); + XENPRINTF(("xen_set_ldt %#" PRIxVADDR " %d %p\n", + base, entries, ptp)); pmap_pte_clearbits(ptp, PG_RW); } s = splvm(); @@ -171,15 +171,14 @@ XENPRINTK2(("flush queue %p entries %d\n", xpq_queue, xpq_idx)); for (i = 0; i < xpq_idx; i++) - XENPRINTK2(("%d: %p %08" PRIx64 "\n", i, - (uint64_t)xpq_queue[i].ptr, (uint64_t)xpq_queue[i].val)); + XENPRINTK2(("%d: 0x%08" PRIx64 " 0x%08" PRIx64 "\n", i, + xpq_queue[i].ptr, xpq_queue[i].val)); if (xpq_idx != 0 && HYPERVISOR_mmu_update_self(xpq_queue, xpq_idx, &ok) < 0) { printf("xpq_flush_queue: %d entries \n", xpq_idx); for (i = 0; i < xpq_idx; i++) printf("0x%016" PRIx64 ": 0x%016" PRIx64 "\n", - (uint64_t)xpq_queue[i].ptr, - (uint64_t)xpq_queue[i].val); + xpq_queue[i].ptr, xpq_queue[i].val); panic("HYPERVISOR_mmu_update failed\n"); } xpq_idx = 0; @@ -331,7 +330,7 @@ struct mmuext_op op; xpq_flush_queue(); - XENPRINTK2(("xpq_queue_invlpg %p\n", (void *)va)); + XENPRINTK2(("xpq_queue_invlpg %#" PRIxVADDR "\n", va)); op.cmd = MMUEXT_INVLPG_LOCAL; op.arg1.linear_addr = (va & ~PAGE_MASK); if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) @@ -361,25 +360,22 @@ XENPRINTK2(("idx: %d\n", xpq_idx)); for (i = 0; i < xpq_idx; i++) { snprintf(XBUF, sizeof(XBUF), "%" PRIx64 " %08" PRIx64, - (uint64_t)xpq_queue[i].ptr, (uint64_t)xpq_queue[i].val); + xpq_queue[i].ptr, xpq_queue[i].val); if (++i < xpq_idx) snprintf(XBUF + strlen(XBUF), sizeof(XBUF) - strlen(XBUF), "%" PRIx64 " %08" PRIx64, - (uint64_t)xpq_queue[i].ptr, - (uint64_t)xpq_queue[i].val); + xpq_queue[i].ptr, xpq_queue[i].val); if (++i < xpq_idx) snprintf(XBUF + strlen(XBUF), sizeof(XBUF) - strlen(XBUF), "%" PRIx64 " %08" PRIx64, - (uint64_t)xpq_queue[i].ptr, - (uint64_t)xpq_queue[i].val); + xpq_queue[i].ptr, xpq_queue[i].val); if (++i < xpq_idx) snprintf(XBUF + strlen(XBUF), sizeof(XBUF) - strlen(XBUF), "%" PRIx64 " %08" PRIx64, - (uint64_t)xpq_queue[i].ptr, - (uint64_t)xpq_queue[i].val); + xpq_queue[i].ptr, xpq_queue[i].val); XENPRINTK2(("%d: %s\n", xpq_idx, XBUF)); } } @@ -543,7 +539,8 @@ int i; extern char __data_start; - __PRINTK(("xen_bootstrap_tables(0x%lx, 0x%lx, %d, %d)\n", + __PRINTK(("xen_bootstrap_tables(%#" PRIxVADDR ", %#" PRIxVADDR "," + " %d, %d)\n", old_pgd, new_pgd, old_count, new_count)); text_end = ((vaddr_t)&__data_start) & ~PAGE_MASK; /* @@ -580,8 +577,8 @@ __PRINTK(("xen_bootstrap_tables text_end 0x%lx map_end 0x%lx\n", text_end, map_end)); - __PRINTK(("console 0x%lx ", xen_start_info.console.domU.mfn)); - __PRINTK(("xenstore 0x%lx\n", xen_start_info.store_mfn)); + __PRINTK(("console %#lx ", xen_start_info.console_mfn)); + __PRINTK(("xenstore %#" PRIx32 "\n", xen_start_info.store_mfn)); /* * Create bootstrap page tables @@ -606,9 +603,9 @@ bt_pgd[pl4_pi(KERNTEXTOFF)] = xpmap_ptom_masked(addr) | PG_k | PG_RW | PG_V; - __PRINTK(("L3 va 0x%lx pa 0x%" PRIx64 " entry 0x%" PRIx64 " -> L4[0x%x]\n", - pdtpe, (uint64_t)addr, (uint64_t)bt_pgd[pl4_pi(KERNTEXTOFF)], - pl4_pi(KERNTEXTOFF))); + __PRINTK(("L3 va %#lx pa %#" PRIxPADDR " entry %#" PRIxPADDR + " -> L4[%#x]\n", + pdtpe, addr, bt_pgd[pl4_pi(KERNTEXTOFF)], pl4_pi(KERNTEXTOFF))); #else pdtpe = bt_pgd; #endif /* PTP_LEVELS > 3 */ @@ -622,9 +619,9 @@ addr = ((u_long) pde) - KERNBASE; pdtpe[pl3_pi(KERNTEXTOFF)] = xpmap_ptom_masked(addr) | PG_k | PG_V | PG_RW; - __PRINTK(("L2 va 0x%lx pa 0x%" PRIx64 " entry 0x%" PRIx64 " -> L3[0x%x]\n", - pde, (int64_t)addr, (int64_t)pdtpe[pl3_pi(KERNTEXTOFF)], - pl3_pi(KERNTEXTOFF))); + __PRINTK(("L2 va %#lx pa %#" PRIxPADDR " entry %#" PRIxPADDR + " -> L3[%#x]\n", + pde, addr, pdtpe[pl3_pi(KERNTEXTOFF)], pl3_pi(KERNTEXTOFF))); #elif defined(PAE) /* our PAE-style level 2: 5 contigous pages (4 L2 + 1 shadow) */ pde = (pd_entry_t *) avail; @@ -642,15 +639,15 @@ * itself. */ pdtpe[i] = xpmap_ptom_masked(addr) | PG_k | PG_V; - __PRINTK(("L2 va 0x%lx pa 0x%" PRIx64 " entry 0x%" PRIx64 - " -> L3[0x%x]\n", (vaddr_t)pde + PAGE_SIZE * i, - (int64_t)addr, (int64_t)pdtpe[i], i)); + __PRINTK(("L2 va %#lx pa %#" PRIxPADDR " entry %#" PRIxPADDR + " -> L3[%#x]\n", + (vaddr_t)pde + PAGE_SIZE * i, addr, pdtpe[i], i)); } addr += PAGE_SIZE; pdtpe[3] = xpmap_ptom_masked(addr) | PG_k | PG_V; - __PRINTK(("L2 va 0x%lx pa 0x%" PRIx64 " entry 0x%" PRIx64 - " -> L3[0x%x]\n", (vaddr_t)pde + PAGE_SIZE * 4, - (int64_t)addr, (int64_t)pdtpe[3], 3)); + __PRINTK(("L2 va %#lx pa %#" PRIxPADDR " entry %#" PRIxPADDR + " -> L3[%#x]\n", + (vaddr_t)pde + PAGE_SIZE * 4, addr, pdtpe[3], 3)); #else /* PAE */ pde = bt_pgd; @@ -676,17 +673,17 @@ if (page == (vaddr_t)HYPERVISOR_shared_info) { pte[pl1_pi(page)] = xen_start_info.shared_info; __PRINTK(("HYPERVISOR_shared_info " - "va 0x%lx pte 0x%" PRIx64 "\n", - HYPERVISOR_shared_info, (int64_t)pte[pl1_pi(page)])); + "va %#lx pte %#" PRIxPADDR "\n", + HYPERVISOR_shared_info, pte[pl1_pi(page)])); } if ((xpmap_ptom_masked(page - KERNBASE) >> PAGE_SHIFT) == xen_start_info.console.domU.mfn) { xencons_interface = (void *)page; - pte[pl1_pi(page)] = xen_start_info.console.domU.mfn; + pte[pl1_pi(page)] = xen_start_info.console_mfn; pte[pl1_pi(page)] <<= PAGE_SHIFT; __PRINTK(("xencons_interface " - "va 0x%lx pte 0x%" PRIx64 "\n", - xencons_interface, (int64_t)pte[pl1_pi(page)])); + "va %#lx pte %#" PRIxPADDR "\n", + xencons_interface, pte[pl1_pi(page)])); } if ((xpmap_ptom_masked(page - KERNBASE) >> PAGE_SHIFT) == xen_start_info.store_mfn) { @@ -694,8 +691,8 @@ pte[pl1_pi(page)] = xen_start_info.store_mfn; pte[pl1_pi(page)] <<= PAGE_SHIFT; __PRINTK(("xenstore_interface " - "va 0x%lx pte 0x%" PRIx64 "\n", - xenstore_interface, (int64_t)pte[pl1_pi(page)])); + "va %#lx pte %#" PRIxPADDR "\n", + xenstore_interface, pte[pl1_pi(page)])); } #ifdef DOM0OPS if (page >= (vaddr_t)atdevbase && @@ -723,10 +720,10 @@ if ((page >= old_pgd && page < old_pgd + (old_count * PAGE_SIZE)) || page >= new_pgd) { - __PRINTK(("va 0x%lx pa 0x%lx " - "entry 0x%" PRIx64 " -> L1[0x%x]\n", + __PRINTK(("va %#lx pa %#lx " + "entry 0x%" PRIxPADDR " -> L1[%#x]\n", page, page - KERNBASE, - (int64_t)pte[pl1_pi(page)], pl1_pi(page))); + pte[pl1_pi(page)], pl1_pi(page))); } page += PAGE_SIZE; } @@ -734,9 +731,9 @@ addr = ((u_long) pte) - KERNBASE; pde[pl2_pi(cur_page)] = xpmap_ptom_masked(addr) | PG_k | PG_RW | PG_V; - __PRINTK(("L1 va 0x%lx pa 0x%" PRIx64 " entry 0x%" PRIx64 - " -> L2[0x%x]\n", pte, (int64_t)addr, - (int64_t)pde[pl2_pi(cur_page)], pl2_pi(cur_page))); + __PRINTK(("L1 va %#lx pa %#" PRIxPADDR " entry %#" PRIxPADDR + " -> L2[%#x]\n", + pte, addr, pde[pl2_pi(cur_page)], pl2_pi(cur_page))); /* Mark readonly */ xen_bt_set_readonly((vaddr_t) pte); } @@ -761,9 +758,10 @@ addr = (u_long)pde - KERNBASE; for (i = 0; i < 3; i++, addr += PAGE_SIZE) { pde[PDIR_SLOT_PTE + i] = xpmap_ptom_masked(addr) | PG_k | PG_V; - __PRINTK(("pde[%d] va 0x%lx pa 0x%lx entry 0x%" PRIx64 "\n", - (int)(PDIR_SLOT_PTE + i), pde + PAGE_SIZE * i, (long)addr, - (int64_t)pde[PDIR_SLOT_PTE + i])); + __PRINTK(("pde[%d] va %#" PRIxVADDR " pa %#" PRIxPADDR + " entry %#" PRIxPADDR "\n", + (int)(PDIR_SLOT_PTE + i), pde + PAGE_SIZE * i, + addr, pde[PDIR_SLOT_PTE + i])); } #if 0 addr += PAGE_SIZE; /* point to shadow L2 */ @@ -785,7 +783,7 @@ } if (final) { addr = (u_long)pde - KERNBASE + 3 * PAGE_SIZE; - __PRINTK(("pin L2 %d addr 0x%" PRIx64 "\n", 2, (int64_t)addr)); + __PRINTK(("pin L2 %d addr %#" PRIxPADDR "\n", 2, addr)); xpq_queue_pin_table(xpmap_ptom_masked(addr)); } #if 0 @@ -797,9 +795,9 @@ /* recursive entry in higher-level PD */ bt_pgd[PDIR_SLOT_PTE] = xpmap_ptom_masked(new_pgd - KERNBASE) | PG_k | PG_V; - __PRINTK(("bt_pgd[PDIR_SLOT_PTE] va 0x%lx pa 0x%" PRIx64 - " entry 0x%" PRIx64 "\n", new_pgd, (int64_t)new_pgd - KERNBASE, - (int64_t)bt_pgd[PDIR_SLOT_PTE])); + __PRINTK(("bt_pgd[PDIR_SLOT_PTE] va %#" PRIxVADDR " pa %#" PRIxPADDR + " entry %#" PRIxPADDR "\n", new_pgd, (paddr_t)new_pgd - KERNBASE, + bt_pgd[PDIR_SLOT_PTE])); /* Mark tables RO */ xen_bt_set_readonly((vaddr_t) pde); #endif @@ -828,8 +826,8 @@ /* Switch to new tables */ __PRINTK(("switch to PGD\n")); xpq_queue_pt_switch(xpmap_ptom_masked(new_pgd - KERNBASE)); - __PRINTK(("bt_pgd[PDIR_SLOT_PTE] now entry 0x%" PRIx64 "\n", - (int64_t)bt_pgd[PDIR_SLOT_PTE])); + __PRINTK(("bt_pgd[PDIR_SLOT_PTE] now entry %#" PRIxPADDR "\n", + bt_pgd[PDIR_SLOT_PTE])); #ifdef PAE if (final) { /* now enter kernel's PTE mappings */ @@ -854,12 +852,13 @@ addr = xpmap_mtop(addr); pte = (pd_entry_t *) ((u_long)addr + KERNBASE); pte += pl1_pi(page); - __PRINTK(("*pde 0x%" PRIx64 " addr 0x%" PRIx64 " pte 0x%lx\n", - (int64_t)pde[pl2_pi(page)], (int64_t)addr, (long)pte)); + __PRINTK(("*pde %#" PRIxPADDR " addr %#" PRIxPADDR " pte %#lx\n", + pde[pl2_pi(page)], addr, (long)pte)); while (page < old_pgd + (old_count * PAGE_SIZE) && page < map_end) { addr = xpmap_ptom(((u_long) pte) - KERNBASE); - XENPRINTK(("addr 0x%" PRIx64 " pte 0x%lx *pte 0x%" PRIx64 "\n", - (int64_t)addr, (long)pte, (int64_t)*pte)); + XENPRINTK(("addr %#" PRIxPADDR " pte %#lx " + "*pte %#" PRIxPADDR "\n", + addr, (long)pte, *pte)); xpq_queue_pte_update(addr, *pte | PG_RW); page += PAGE_SIZE; /* @@ -904,7 +903,7 @@ op.arg1.mfn = xpmap_phys_to_machine_mapping[page >> PAGE_SHIFT]; if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) panic("xen_set_user_pgd: failed to install new user page" - " directory %lx", page); + " directory %#" PRIxPADDR, page); splx(s); } #endif /* __x86_64__ */