Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 May 2003 09:46:11 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 32012 for review
Message-ID:  <200305291646.h4TGkBJa041773@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=32012

Change 32012 by jhb@jhb_laptop on 2003/05/29 09:45:54

	IFC @32008.

Affected files ...

.. //depot/projects/smpng/sys/alpha/alpha/busdma_machdep.c#15 integrate
.. //depot/projects/smpng/sys/alpha/include/bus.h#9 integrate
.. //depot/projects/smpng/sys/amd64/amd64/busdma_machdep.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/genassym.c#5 integrate
.. //depot/projects/smpng/sys/amd64/amd64/identcpu.c#3 integrate
.. //depot/projects/smpng/sys/amd64/amd64/locore.S#3 integrate
.. //depot/projects/smpng/sys/amd64/amd64/machdep.c#7 integrate
.. //depot/projects/smpng/sys/amd64/amd64/mem.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/nexus.c#3 integrate
.. //depot/projects/smpng/sys/amd64/amd64/pmap.c#3 integrate
.. //depot/projects/smpng/sys/amd64/amd64/trap.c#5 integrate
.. //depot/projects/smpng/sys/amd64/amd64/vm_machdep.c#3 integrate
.. //depot/projects/smpng/sys/amd64/ia32/ia32_signal.c#2 integrate
.. //depot/projects/smpng/sys/amd64/ia32/ia32_sysvec.c#3 integrate
.. //depot/projects/smpng/sys/amd64/ia32/ia32_util.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/asm.h#3 integrate
.. //depot/projects/smpng/sys/amd64/include/bus_amd64.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/bus_dma.h#3 integrate
.. //depot/projects/smpng/sys/amd64/include/param.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/pmap.h#3 integrate
.. //depot/projects/smpng/sys/amd64/include/reg.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/vmparam.h#2 integrate
.. //depot/projects/smpng/sys/conf/kern.mk#5 integrate
.. //depot/projects/smpng/sys/contrib/dev/acpica/dsmethod.c#13 integrate
.. //depot/projects/smpng/sys/contrib/dev/acpica/nsalloc.c#12 integrate
.. //depot/projects/smpng/sys/dev/advansys/advansys.c#5 integrate
.. //depot/projects/smpng/sys/dev/advansys/adwcam.c#5 integrate
.. //depot/projects/smpng/sys/dev/aha/aha.c#8 integrate
.. //depot/projects/smpng/sys/dev/ahb/ahb.c#6 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx.c#11 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx.h#9 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx.reg#10 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx.seq#9 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx_inline.h#9 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx_osm.c#9 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx_osm.h#7 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic79xx_pci.c#10 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx.c#14 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx.h#8 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx.reg#8 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx.seq#8 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx_inline.h#7 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx_osm.c#9 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx_osm.h#8 integrate
.. //depot/projects/smpng/sys/dev/aic7xxx/aic7xxx_pci.c#10 integrate
.. //depot/projects/smpng/sys/dev/amd/amd.c#3 integrate
.. //depot/projects/smpng/sys/dev/buslogic/bt.c#8 integrate
.. //depot/projects/smpng/sys/dev/cardbus/cardbus_cis.c#14 integrate
.. //depot/projects/smpng/sys/dev/dpt/dpt_scsi.c#6 integrate
.. //depot/projects/smpng/sys/dev/fb/vga.c#14 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwdma.h#2 integrate
.. //depot/projects/smpng/sys/dev/fxp/if_fxp.c#36 integrate
.. //depot/projects/smpng/sys/dev/ida/ida.c#10 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpt_freebsd.c#6 integrate
.. //depot/projects/smpng/sys/dev/pci/pci_pci.c#15 integrate
.. //depot/projects/smpng/sys/dev/trm/trm.c#6 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinum.c#12 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinumconfig.c#12 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinumext.h#9 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinumioctl.c#14 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinumlock.c#3 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinummemory.c#6 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinumobj.h#5 integrate
.. //depot/projects/smpng/sys/dev/vinum/vinumvar.h#5 integrate
.. //depot/projects/smpng/sys/geom/geom_disk.c#26 integrate
.. //depot/projects/smpng/sys/i386/i386/busdma_machdep.c#17 integrate
.. //depot/projects/smpng/sys/i386/include/bus_dma.h#5 integrate
.. //depot/projects/smpng/sys/ia64/ia64/busdma_machdep.c#15 integrate
.. //depot/projects/smpng/sys/ia64/ia64/context.s#2 integrate
.. //depot/projects/smpng/sys/ia64/ia64/exception.s#25 integrate
.. //depot/projects/smpng/sys/ia64/ia64/locore.s#19 integrate
.. //depot/projects/smpng/sys/ia64/ia64/machdep.c#56 integrate
.. //depot/projects/smpng/sys/ia64/ia64/pmap.c#45 integrate
.. //depot/projects/smpng/sys/ia64/ia64/support.s#12 integrate
.. //depot/projects/smpng/sys/ia64/ia64/syscall.s#2 integrate
.. //depot/projects/smpng/sys/ia64/ia64/trap.c#48 integrate
.. //depot/projects/smpng/sys/ia64/ia64/unaligned.c#4 integrate
.. //depot/projects/smpng/sys/ia64/ia64/unwind.c#7 integrate
.. //depot/projects/smpng/sys/ia64/include/bus.h#9 integrate
.. //depot/projects/smpng/sys/ia64/include/cpu.h#13 integrate
.. //depot/projects/smpng/sys/ia64/include/cpufunc.h#17 integrate
.. //depot/projects/smpng/sys/kern/kern_alq.c#3 integrate
.. //depot/projects/smpng/sys/kern/kern_switch.c#30 integrate
.. //depot/projects/smpng/sys/kern/kern_umtx.c#2 integrate
.. //depot/projects/smpng/sys/kern/subr_sbuf.c#11 integrate
.. //depot/projects/smpng/sys/kern/vfs_cluster.c#24 integrate
.. //depot/projects/smpng/sys/kern/vfs_subr.c#54 integrate
.. //depot/projects/smpng/sys/net/if_loop.c#18 integrate
.. //depot/projects/smpng/sys/nfsserver/nfs.h#9 integrate
.. //depot/projects/smpng/sys/nfsserver/nfs_serv.c#28 integrate
.. //depot/projects/smpng/sys/nfsserver/nfs_srvsubs.c#15 integrate
.. //depot/projects/smpng/sys/pci/agp_intel.c#10 integrate
.. //depot/projects/smpng/sys/pci/agpreg.h#6 integrate
.. //depot/projects/smpng/sys/powerpc/include/bus.h#10 integrate
.. //depot/projects/smpng/sys/powerpc/powerpc/busdma_machdep.c#11 integrate
.. //depot/projects/smpng/sys/sparc64/include/bus.h#14 integrate
.. //depot/projects/smpng/sys/sparc64/include/iommuvar.h#10 integrate
.. //depot/projects/smpng/sys/sparc64/pci/psycho.c#21 integrate
.. //depot/projects/smpng/sys/sparc64/sbus/sbus.c#10 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/bus_machdep.c#16 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/iommu.c#16 integrate
.. //depot/projects/smpng/sys/sys/stat.h#14 integrate

Differences ...

==== //depot/projects/smpng/sys/alpha/alpha/busdma_machdep.c#15 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/alpha/alpha/busdma_machdep.c,v 1.35 2003/04/10 23:03:32 mux Exp $
+ * $FreeBSD: src/sys/alpha/alpha/busdma_machdep.c,v 1.37 2003/05/27 04:59:56 scottl Exp $
  */
 
 #include <sys/param.h>
@@ -350,18 +350,14 @@
  * A dmamap to for use with dmamap_load is also allocated.
  */
 int
-bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
-		      bus_dmamap_t *mapp, bus_size_t size)
+bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
+		 bus_dmamap_t *mapp)
 {
-
-	if (size > dmat->maxsize)
-		return (ENOMEM);
-
 	/* If we succeed, no mapping/bouncing will be required */
 	*mapp = &nobounce_dmamap;
 
-	if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) {
-		*vaddr = malloc(size, M_DEVBUF,
+	if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) {
+		*vaddr = malloc(dmat->maxsize, M_DEVBUF,
 				(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
 	} else {
 		/*
@@ -370,7 +366,7 @@
 		 *     multi-seg allocations yet though.
 		 */
 		mtx_lock(&Giant);
-		*vaddr = contigmalloc(size, M_DEVBUF,
+		*vaddr = contigmalloc(dmat->maxsize, M_DEVBUF,
 		    (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
 		    0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
 		    dmat->boundary);
@@ -381,20 +377,12 @@
 	return (0);
 }
 
-int
-bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
-		 bus_dmamap_t *mapp)
-{
-	return (bus_dmamem_alloc_size(dmat, vaddr, flags, mapp, dmat->maxsize));
-}
-
 /*
  * Free a piece of memory and it's allociated dmamap, that was allocated
  * via bus_dmamem_alloc.
  */
 void
-bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
-		     bus_size_t size)
+bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 	/*
 	 * dmamem does not need to be bounced, so the map should be
@@ -402,21 +390,15 @@
 	 */
 	if (map != &nobounce_dmamap)
 		panic("bus_dmamem_free: Invalid map freed\n");
-	if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem))
+	if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem))
 		free(vaddr, M_DEVBUF);
 	else {
 		mtx_lock(&Giant);
-		contigfree(vaddr, size, M_DEVBUF);
+		contigfree(vaddr, dmat->maxsize, M_DEVBUF);
 		mtx_unlock(&Giant);
 	}
 }
 
-void
-bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
-{
-	bus_dmamem_free_size(dmat, vaddr, map, dmat->maxsize);
-}
-
 #define BUS_DMAMAP_NSEGS ((64 * 1024 / PAGE_SIZE) + 1)
 
 /*
@@ -787,7 +769,7 @@
 }
 
 void
-_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, int op)
+_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
 {
 	struct bounce_page *bpage;
 

==== //depot/projects/smpng/sys/alpha/include/bus.h#9 (text+ko) ====

@@ -67,7 +67,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/* $FreeBSD: src/sys/alpha/include/bus.h,v 1.18 2003/04/10 23:03:32 mux Exp $ */
+/* $FreeBSD: src/sys/alpha/include/bus.h,v 1.20 2003/05/27 04:59:56 scottl Exp $ */
 
 #ifndef _ALPHA_BUS_H_
 #define _ALPHA_BUS_H_
@@ -482,6 +482,7 @@
 /*
  *	Operations performed by bus_dmamap_sync().
  */
+typedef int bus_dmasync_op_t;
 #define	BUS_DMASYNC_PREREAD	1
 #define	BUS_DMASYNC_POSTREAD	2
 #define	BUS_DMASYNC_PREWRITE	4
@@ -567,9 +568,6 @@
  * bus device space based on the constraints lited in the dma tag.
  * A dmamap to for use with dmamap_load is also allocated.
  */
-int bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
-			  bus_dmamap_t *mapp, bus_size_t size);
-
 int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
 		     bus_dmamap_t *mapp);
 
@@ -577,9 +575,6 @@
  * Free a piece of memory and it's allociated dmamap, that was allocated
  * via bus_dmamem_alloc.
  */
-void bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
-			  bus_size_t size);
-
 void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
 
 /*
@@ -621,7 +616,7 @@
 /*
  * Perform a syncronization operation on the given map.
  */
-void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, int);
+void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t);
 #define bus_dmamap_sync(dmat, dmamap, op) 		\
 	if ((dmamap) != NULL)				\
 		_bus_dmamap_sync(dmat, dmamap, op)

==== //depot/projects/smpng/sys/amd64/amd64/busdma_machdep.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.43 2003/04/15 03:11:03 mux Exp $
+ * $FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.45 2003/05/27 04:59:56 scottl Exp $
  */
 
 #include <sys/param.h>
@@ -338,19 +338,15 @@
  * A dmamap to for use with dmamap_load is also allocated.
  */
 int
-bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
-		      bus_dmamap_t *mapp, bus_size_t size)
+bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
+		 bus_dmamap_t *mapp)
 {
-
-	if (size > dmat->maxsize)
-		return (ENOMEM);
-
 	/* If we succeed, no mapping/bouncing will be required */
 	*mapp = NULL;
 
-	if ((size <= PAGE_SIZE) &&
+	if ((dmat->maxsize <= PAGE_SIZE) &&
 	    dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) {
-		*vaddr = malloc(size, M_DEVBUF,
+		*vaddr = malloc(dmat->maxsize, M_DEVBUF,
 				(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
 	} else {
 		/*
@@ -359,7 +355,7 @@
 		 *     multi-seg allocations yet though.
 		 */
 		mtx_lock(&Giant);
-		*vaddr = contigmalloc(size, M_DEVBUF,
+		*vaddr = contigmalloc(dmat->maxsize, M_DEVBUF,
 		    (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
 		    0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
 		    dmat->boundary);
@@ -370,20 +366,12 @@
 	return (0);
 }
 
-int
-bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
-		 bus_dmamap_t *mapp)
-{
-	return (bus_dmamem_alloc_size(dmat, vaddr, flags, mapp, dmat->maxsize));
-}
-
 /*
  * Free a piece of memory and it's allociated dmamap, that was allocated
  * via bus_dmamem_alloc.  Make the same choice for free/contigfree.
  */
 void
-bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
-		     bus_size_t size)
+bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 	/*
 	 * dmamem does not need to be bounced, so the map should be
@@ -391,21 +379,16 @@
 	 */
 	if (map != NULL)
 		panic("bus_dmamem_free: Invalid map freed\n");
-	if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem))
+	if ((dmat->maxsize <= PAGE_SIZE)
+	 && dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem))
 		free(vaddr, M_DEVBUF);
 	else {
 		mtx_lock(&Giant);
-		contigfree(vaddr, size, M_DEVBUF);
+		contigfree(vaddr, dmat->maxsize, M_DEVBUF);
 		mtx_unlock(&Giant);
 	}
 }
 
-void
-bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
-{
-	bus_dmamem_free_size(dmat, vaddr, map, dmat->maxsize);
-}
-
 /*
  * Utility function to load a linear buffer.  lastaddrp holds state
  * between invocations (for multiple-buffer loads).  segp contains
@@ -719,7 +702,7 @@
 }
 
 void
-_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, int op)
+_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
 {
 	struct bounce_page *bpage;
 

==== //depot/projects/smpng/sys/amd64/amd64/genassym.c#5 (text+ko) ====

@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)genassym.c	5.11 (Berkeley) 5/10/91
- * $FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.146 2003/05/15 00:23:39 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.147 2003/05/23 05:04:53 peter Exp $
  */
 
 #include "opt_compat.h"
@@ -99,8 +99,11 @@
 ASSYM(PAGE_SIZE, PAGE_SIZE);
 ASSYM(NPTEPG, NPTEPG);
 ASSYM(NPDEPG, NPDEPG);
-ASSYM(NPDEPTD, NPDEPTD);
-ASSYM(NPGPTD, NPGPTD);
+ASSYM(addr_PTmap, addr_PTmap);
+ASSYM(addr_PDmap, addr_PDmap);
+ASSYM(addr_PDPmap, addr_PDPmap);
+ASSYM(addr_PML4map, addr_PML4map);
+ASSYM(addr_PML4pml4e, addr_PML4pml4e);
 ASSYM(PDESIZE, sizeof(pd_entry_t));
 ASSYM(PTESIZE, sizeof(pt_entry_t));
 ASSYM(PTESHIFT, PTESHIFT);
@@ -109,9 +112,14 @@
 ASSYM(PDRSHIFT, PDRSHIFT);
 ASSYM(PDPSHIFT, PDPSHIFT);
 ASSYM(PML4SHIFT, PML4SHIFT);
+ASSYM(val_KPDPI, KPDPI);
+ASSYM(val_KPML4I, KPML4I);
+ASSYM(val_PML4PML4I, PML4PML4I);
 ASSYM(USRSTACK, USRSTACK);
 ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
 ASSYM(KERNBASE, KERNBASE);
+ASSYM(DMAP_MIN_ADDRESS, DMAP_MIN_ADDRESS);
+ASSYM(DMAP_MAX_ADDRESS, DMAP_MAX_ADDRESS);
 ASSYM(MCLBYTES, MCLBYTES);
 ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3));
 ASSYM(PCB_R15, offsetof(struct pcb, pcb_r15));

==== //depot/projects/smpng/sys/amd64/amd64/identcpu.c#3 (text+ko) ====

@@ -38,7 +38,7 @@
  * SUCH DAMAGE.
  *
  *	from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp
- * $FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.124 2003/05/11 23:01:04 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.125 2003/05/27 21:59:56 peter Exp $
  */
 
 #include "opt_cpu.h"
@@ -358,17 +358,17 @@
 		"\022PGE36"	/* 36 bit address space support */
 		"\023RSVD"	/* Reserved, unknown */
 		"\024MP"	/* Multiprocessor Capable */
-		"\025<b20>"
+		"\025NX"	/* Has EFER.NXE, NX (no execute pte bit) */
 		"\026<b21>"
-		"\027AMIE"	/* AMD MMX Instruction Extensions */
+		"\027MMX+"	/* AMD MMX Instruction Extensions */
 		"\030MMX"
 		"\031FXSAVE"	/* FXSAVE/FXRSTOR */
 		"\032<b25>"
 		"\033<b26>"
 		"\034<b27>"
 		"\035<b28>"
-		"\036<b29>"
-		"\037DSP"	/* AMD 3DNow! Instruction Extensions */
-		"\0403DNow!"
+		"\036LM"	/* Long mode */
+		"\0373DNow!+"	/* AMD 3DNow! Instruction Extensions */
+		"\0403DNow!"	/* AMD 3DNow! Instructions */
 		);
 }

==== //depot/projects/smpng/sys/amd64/amd64/locore.S#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/locore.S,v 1.173 2003/05/15 00:20:17 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/locore.S,v 1.174 2003/05/23 05:04:53 peter Exp $
  */
 
 #include <machine/asmacros.h>
@@ -36,8 +36,15 @@
 /*
  * Compiled KERNBASE location
  */
-	.globl	kernbase
+	.globl	kernbase,loc_PTmap,loc_PDmap,loc_PDPmap,loc_PML4map,loc_PML4pml4e,dmapbase,dmapend
 	.set	kernbase,KERNBASE
+	.set	loc_PTmap,addr_PTmap
+	.set	loc_PDmap,addr_PDmap
+	.set	loc_PDPmap,addr_PDPmap
+	.set	loc_PML4map,addr_PML4map
+	.set	loc_PML4pml4e,addr_PML4pml4e
+	.set	dmapbase,DMAP_MIN_ADDRESS
+	.set	dmapend,DMAP_MAX_ADDRESS
 
 	.text
 /**********************************************************************

==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#7 (text+ko) ====

@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)machdep.c	7.4 (Berkeley) 6/3/91
- * $FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.579 2003/05/17 02:05:10 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.580 2003/05/23 05:04:53 peter Exp $
  */
 
 #include "opt_atalk.h"
@@ -133,11 +133,6 @@
 
 u_int64_t	modulep;	/* phys addr of metadata table */
 u_int64_t	physfree;	/* first free page after kernel */
-u_int64_t	IdlePTD;	/* phys addr of kernel PTD */
-u_int64_t	IdlePDP;	/* phys addr of kernel level 3 */
-u_int64_t	IdlePML4;	/* phys addr of kernel level 4 */
-struct user	*proc0uarea;	/* address of proc 0 uarea space */
-vm_offset_t	proc0kstack;	/* address of proc 0 kstack space */
 
 int cold = 1;
 
@@ -945,7 +940,7 @@
 		physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem);
 
 	/* call pmap initialization to make new kernel address space */
-	pmap_bootstrap(first, 0);
+	pmap_bootstrap(&first);
 
 	/*
 	 * Size up each available chunk of physical memory.
@@ -1086,69 +1081,6 @@
 	return (ret);
 }
 
-static void
-create_pagetables(void)
-{
-	u_int64_t p0kpa;
-	u_int64_t p0upa;
-	u_int64_t KPTphys;
-	int i;
-
-	/* Allocate pages */
-	KPTphys = allocpages(NKPT);
-	IdlePML4 = allocpages(NKPML4E);
-	IdlePDP = allocpages(NKPDPE);
-	IdlePTD = allocpages(NPGPTD);
-	p0upa = allocpages(UAREA_PAGES);
-	p0kpa = allocpages(KSTACK_PAGES);
-
-	proc0uarea = (struct user *)(p0upa + KERNBASE);
-	proc0kstack = p0kpa + KERNBASE;
-
-	/* Fill in the underlying page table pages */
-	/* Read-only from zero to physfree */
-	/* XXX not fully used, underneath 2M pages */
-	for (i = 0; (i << PAGE_SHIFT) < physfree; i++) {
-		((pt_entry_t *)KPTphys)[i] = i << PAGE_SHIFT;
-		((pt_entry_t *)KPTphys)[i] |= PG_RW | PG_V;
-	}
-
-	/* Now map the page tables at their location within PTmap */
-	for (i = 0; i < NKPT; i++) {
-		((pd_entry_t *)IdlePTD)[i + KPTDI] = KPTphys + (i << PAGE_SHIFT);
-		((pd_entry_t *)IdlePTD)[i + KPTDI] |= PG_RW | PG_V;
-	}
-
-	/* Map from zero to end of allocations under 2M pages */
-	/* This replaces some of the PTD entries above */
-	for (i = 0; (i << PDRSHIFT) < physfree; i++) {
-		((pd_entry_t *)IdlePTD)[i] = i << PDRSHIFT;
-		((pd_entry_t *)IdlePTD)[i] |= PG_RW | PG_V | PG_PS;
-	}
-
-	/* Now map the page tables at their location within PTmap */
-	for (i = 0; i < NKPT; i++) {
-		((pd_entry_t *)IdlePTD)[i] = KPTphys + (i << PAGE_SHIFT);
-		((pd_entry_t *)IdlePTD)[i] |= PG_RW | PG_V;
-	}
-
-	/* Now map the PTD at the top of the PTmap (ie: PTD[]) */
-	for (i = 0; i < NPGPTD; i++) {
-		((pd_entry_t *)IdlePTD)[i + PTDPTDI] = IdlePTD + (i << PAGE_SHIFT);
-		((pd_entry_t *)IdlePTD)[i + PTDPTDI] |= PG_RW | PG_V;
-	}
-
-	/* And connect up the PTD to the PDP */
-	for (i = 0; i < NPGPTD; i++) {
-		((pdp_entry_t *)IdlePDP)[i] = IdlePTD + (i << PAGE_SHIFT);
-		((pdp_entry_t *)IdlePDP)[i] |= PG_RW | PG_V | PG_U;
-	}
-
-	/* And connect up the PDP to the PML4 */
-	((pdp_entry_t *)IdlePML4)[0] = IdlePDP;
-	((pdp_entry_t *)IdlePML4)[0] |= PG_RW | PG_V | PG_U;
-}
-
 void
 hammer_time(void)
 {
@@ -1157,18 +1089,14 @@
 	struct region_descriptor r_gdt, r_idt;
 	struct pcpu *pc;
 	u_int64_t msr;
+	char *env;
 
 	/* Turn on PTE NX (no execute) bit */
 	msr = rdmsr(MSR_EFER) | EFER_NXE;
 	wrmsr(MSR_EFER, msr);
-	create_pagetables();
 
-	/* XXX do %cr0 as well */
-	load_cr4(rcr4() | CR4_PGE | CR4_PSE);
-	load_cr3(IdlePML4);
-
-	proc0.p_uarea = proc0uarea;
-	thread0.td_kstack = proc0kstack;
+	proc0.p_uarea = (struct user *)(allocpages(UAREA_PAGES) + KERNBASE);
+	thread0.td_kstack = allocpages(KSTACK_PAGES) + KERNBASE;
 	thread0.td_pcb = (struct pcb *)
 	   (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
 	atdevbase = ISA_HOLE_START + KERNBASE;
@@ -1310,8 +1238,12 @@
 
 	/* setup proc 0's pcb */
 	thread0.td_pcb->pcb_flags = 0; /* XXXKSE */
-	thread0.td_pcb->pcb_cr3 = IdlePML4;
+	thread0.td_pcb->pcb_cr3 = KPML4phys;
 	thread0.td_frame = &proc0_tf;
+
+        env = getenv("kernelname");
+	if (env != NULL)
+		strlcpy(kernelname, env, sizeof(kernelname));
 }
 
 void

==== //depot/projects/smpng/sys/amd64/amd64/mem.c#2 (text+ko) ====

@@ -38,7 +38,7 @@
  *
  *	from: Utah $Hdr: mem.c 1.13 89/10/08$
  *	from: @(#)mem.c	7.2 (Berkeley) 5/9/91
- * $FreeBSD: src/sys/amd64/amd64/mem.c,v 1.107 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/mem.c,v 1.108 2003/05/23 05:04:53 peter Exp $
  */
 
 /*
@@ -63,6 +63,7 @@
 #include <machine/frame.h>
 #include <machine/psl.h>
 #include <machine/specialreg.h>
+#include <machine/vmparam.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -177,7 +178,7 @@
 			addr = trunc_page(uio->uio_offset);
 			eaddr = round_page(uio->uio_offset + c);
 
-			if (addr < (vm_offset_t)VADDR(0, 0, PTDPTDI, 0))
+			if (addr < (vm_offset_t)KERNBASE)
 				return (EFAULT);
 			for (; addr < eaddr; addr += PAGE_SIZE) 
 				if (pmap_extract(kernel_pmap, addr) == 0)

==== //depot/projects/smpng/sys/amd64/amd64/nexus.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.51 2003/05/12 02:44:37 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.52 2003/05/23 05:04:53 peter Exp $
  */
 
 /*
@@ -355,8 +355,8 @@
 			 */
 			vaddr = (caddr_t)(uintptr_t)(KERNBASE + rman_get_start(r));
 		} else {
-			u_int32_t paddr;
-			u_int32_t psize;
+			u_int64_t paddr;
+			u_int64_t psize;
 			u_int32_t poffs;
 
 			paddr = rman_get_start(r);

==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#3 (text+ko) ====

@@ -39,7 +39,7 @@
  * SUCH DAMAGE.
  *
  *	from:	@(#)pmap.c	7.7 (Berkeley)	5/12/91
- * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.407 2003/05/11 22:40:24 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.408 2003/05/23 05:04:53 peter Exp $
  */
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -125,6 +125,7 @@
 #include <vm/vm_pageout.h>
 #include <vm/vm_pager.h>
 #include <vm/uma.h>
+#include <vm/uma_int.h>
 
 #include <machine/cpu.h>
 #include <machine/cputypes.h>
@@ -149,41 +150,35 @@
 #endif
 
 /*
- * Get PDEs and PTEs for user/kernel address space
- */
-#define	pmap_pde(m, v)	(&((m)->pm_pdir[(vm_offset_t)(v) >> PDRSHIFT]))
-#define pdir_pde(m, v) (m[(vm_offset_t)(v) >> PDRSHIFT])
-
-#define pmap_pde_v(pte)		((*(int *)pte & PG_V) != 0)
-#define pmap_pte_w(pte)		((*(int *)pte & PG_W) != 0)
-#define pmap_pte_m(pte)		((*(int *)pte & PG_M) != 0)
-#define pmap_pte_u(pte)		((*(int *)pte & PG_A) != 0)
-#define pmap_pte_v(pte)		((*(int *)pte & PG_V) != 0)
-
-#define pmap_pte_set_w(pte, v) ((v)?(*(int *)pte |= PG_W):(*(int *)pte &= ~PG_W))
-#define pmap_pte_set_prot(pte, v) ((*(int *)pte &= ~PG_PROT), (*(int *)pte |= (v)))
-
-/*
  * Given a map and a machine independent protection code,
  * convert to a vax protection code.
  */
 #define pte_prot(m, p)	(protection_codes[p])
-static int protection_codes[8];
+static pt_entry_t protection_codes[8];
 
 struct pmap kernel_pmap_store;
 LIST_HEAD(pmaplist, pmap);
 static struct pmaplist allpmaps;
 static struct mtx allpmaps_lock;
 
-vm_paddr_t avail_start;	/* PA of first available physical page */
-vm_paddr_t avail_end;	/* PA of last available physical page */
+vm_paddr_t avail_start;		/* PA of first available physical page */
+vm_paddr_t avail_end;		/* PA of last available physical page */
 vm_offset_t virtual_avail;	/* VA of first avail page (after kernel bss) */
 vm_offset_t virtual_end;	/* VA of last avail page (end of kernel AS) */
 static boolean_t pmap_initialized = FALSE;	/* Has pmap_init completed? */
 
 static int nkpt;
+static int ndmpdp;
 vm_offset_t kernel_vm_end;
 
+static u_int64_t	KPTphys;	/* phys addr of kernel level 1 */
+static u_int64_t	KPDphys;	/* phys addr of kernel level 2 */
+static u_int64_t	KPDPphys;	/* phys addr of kernel level 3 */
+u_int64_t		KPML4phys;	/* phys addr of kernel level 4 */
+
+static u_int64_t	DMPDphys;	/* phys addr of direct mapped level 2 */
+static u_int64_t	DMPDPphys;	/* phys addr of direct mapped level 3 */
+
 /*
  * Data for the pv entry allocation mechanism
  */
@@ -196,10 +191,8 @@
  * All those kernel PT submaps that BSD is so fond of
  */
 pt_entry_t *CMAP1 = 0;
-static pt_entry_t *CMAP2, *CMAP3, *ptmmap;
+static pt_entry_t *ptmmap;
 caddr_t CADDR1 = 0, ptvmmap = 0;
-static caddr_t CADDR2, CADDR3;
-static struct mtx CMAPCADDR12_lock;
 static pt_entry_t *msgbufmap;
 struct msgbuf *msgbufp = 0;
 
@@ -209,12 +202,9 @@
 static pt_entry_t *pt_crashdumpmap;
 static caddr_t crashdumpmap;
 
-static pt_entry_t *PMAP1 = 0;
-static pt_entry_t *PADDR1 = 0;
-
 static PMAP_INLINE void	free_pv_entry(pv_entry_t pv);
 static pv_entry_t get_pv_entry(void);
-static void	i386_protection_init(void);
+static void	amd64_protection_init(void);
 static __inline void	pmap_changebit(vm_page_t m, int bit, boolean_t setem);
 
 static vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va,
@@ -228,7 +218,7 @@
 
 static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va);
 
-static vm_page_t _pmap_allocpte(pmap_t pmap, unsigned ptepindex);
+static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex);
 static vm_page_t pmap_page_lookup(vm_object_t object, vm_pindex_t pindex);
 static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t);
 static vm_offset_t pmap_kmem_choose(vm_offset_t addr);
@@ -252,10 +242,195 @@
 	return newaddr;
 }
 
+/********************/
+/* Inline functions */
+/********************/
+
+/* Return a non-clipped PD index for a given VA */
+static __inline vm_pindex_t
+pmap_pde_pindex(vm_offset_t va)
+{
+	return va >> PDRSHIFT;
+}
+
+
+/* Return various clipped indexes for a given VA */
+static __inline vm_pindex_t
+pmap_pte_index(vm_offset_t va)
+{
+
+	return ((va >> PAGE_SHIFT) & ((1ul << NPTEPGSHIFT) - 1));
+}
+
+static __inline vm_pindex_t
+pmap_pde_index(vm_offset_t va)
+{
+
+	return ((va >> PDRSHIFT) & ((1ul << NPDEPGSHIFT) - 1));
+}
+
+static __inline vm_pindex_t
+pmap_pdpe_index(vm_offset_t va)
+{
+
+	return ((va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1));
+}
+
+static __inline vm_pindex_t
+pmap_pml4e_index(vm_offset_t va)
+{
+
+	return ((va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1));
+}
+
+/* Return a pointer to the PML4 slot that corresponds to a VA */
+static __inline pml4_entry_t *
+pmap_pml4e(pmap_t pmap, vm_offset_t va)
+{
+
+	if (!pmap)
+		return NULL;
+	return (&pmap->pm_pml4[pmap_pml4e_index(va)]);
+}
+
+/* Return a pointer to the PDP slot that corresponds to a VA */
+static __inline pdp_entry_t *
+pmap_pdpe(pmap_t pmap, vm_offset_t va)
+{
+	pml4_entry_t *pml4e;
+	pdp_entry_t *pdpe;
+
+	pml4e = pmap_pml4e(pmap, va);
+	if (pml4e == NULL || (*pml4e & PG_V) == 0)
+		return NULL;
+	pdpe = (pdp_entry_t *)PHYS_TO_DMAP(*pml4e & PG_FRAME);
+	return (&pdpe[pmap_pdpe_index(va)]);
+}
+
+/* Return a pointer to the PD slot that corresponds to a VA */
+static __inline pd_entry_t *
+pmap_pde(pmap_t pmap, vm_offset_t va)
+{
+	pdp_entry_t *pdpe;
+	pd_entry_t *pde;
+
+	pdpe = pmap_pdpe(pmap, va);
+	if (pdpe == NULL || (*pdpe & PG_V) == 0)
+		 return NULL;
+	pde = (pd_entry_t *)PHYS_TO_DMAP(*pdpe & PG_FRAME);
+	return (&pde[pmap_pde_index(va)]);
+}
+
+/* Return a pointer to the PT slot that corresponds to a VA */
+static __inline pt_entry_t *
+pmap_pte(pmap_t pmap, vm_offset_t va)
+{
+	pd_entry_t *pde;
+	pt_entry_t *pte;
+
+	pde = pmap_pde(pmap, va);
+	if (pde == NULL || (*pde & PG_V) == 0)
+		return NULL;
+	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));
+}
+
+static u_int64_t
+allocpages(int n)
+{
+	u_int64_t ret;
+
+	ret = avail_start;
+	bzero((void *)ret, n * PAGE_SIZE);
+	avail_start += n * PAGE_SIZE;
+	return (ret);
+}
+
+static void
+create_pagetables(void)
+{
+	int i;
+
+	/* Allocate pages */
+	KPTphys = allocpages(NKPT);
+	KPML4phys = allocpages(1);
+	KPDPphys = allocpages(NKPML4E);
+	KPDphys = allocpages(NKPDPE);
+
+	ndmpdp = (ptoa(Maxmem) + NBPDP - 1) >> PDPSHIFT;
+	if (ndmpdp < 1)
+		ndmpdp = 1;
+	DMPDPphys = allocpages(NDMPML4E);
+	DMPDphys = allocpages(ndmpdp);
+
+	/* Fill in the underlying page table pages */
+	/* Read-only from zero to physfree */
+	/* XXX not fully used, underneath 2M pages */
+	for (i = 0; (i << PAGE_SHIFT) < avail_start; i++) {
+		((pt_entry_t *)KPTphys)[i] = i << PAGE_SHIFT;
+		((pt_entry_t *)KPTphys)[i] |= PG_RW | PG_V;
+	}
+
+	/* Now map the page tables at their location within PTmap */
+	for (i = 0; i < NKPT; i++) {
+		((pd_entry_t *)KPDphys)[i] = KPTphys + (i << PAGE_SHIFT);
+		((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V;
+	}
+
+#if 0
+	/* Map from zero to end of allocations under 2M pages */
+	/* This replaces some of the KPTphys entries above */
+	for (i = 0; (i << PDRSHIFT) < avail_start; i++) {
+		((pd_entry_t *)KPDphys)[i] = i << PDRSHIFT;
+		((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V | PG_PS;
+	}
+#endif
+
+	/* And connect up the PD to the PDP */
+	for (i = 0; i < NKPDPE; i++) {
+		((pdp_entry_t *)KPDPphys)[i + KPDPI] = KPDphys + (i << PAGE_SHIFT);
+		((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U;
+	}
+
+
+	/* Now set up the direct map space using 2MB pages */
+	for (i = 0; i < NPDEPG * ndmpdp; i++) {
+		((pd_entry_t *)DMPDphys)[i] = i << PDRSHIFT;
+		((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS;
+	}
+
+	/* And the direct map space's PDP */
+	for (i = 0; i < ndmpdp; i++) {
+		((pdp_entry_t *)DMPDPphys)[i] = DMPDphys + (i << PAGE_SHIFT);
+		((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_U;
+	}
+
+	/* And recursively map PML4 to itself in order to get PTmap */
+	((pdp_entry_t *)KPML4phys)[PML4PML4I] = KPML4phys;
+	((pdp_entry_t *)KPML4phys)[PML4PML4I] |= PG_RW | PG_V | PG_U;
+
+	/* Connect the Direct Map slot up to the PML4 */
+	((pdp_entry_t *)KPML4phys)[DMPML4I] = DMPDPphys;
+	((pdp_entry_t *)KPML4phys)[DMPML4I] |= PG_RW | PG_V | PG_U;
+
+	/* Connect the KVA slot up to the PML4 */
+	((pdp_entry_t *)KPML4phys)[KPML4I] = KPDPphys;
+	((pdp_entry_t *)KPML4phys)[KPML4I] |= PG_RW | PG_V | PG_U;
+}
+
 /*
  *	Bootstrap the system enough to run with virtual memory.
  *
- *	On the i386 this is called after mapping has already been enabled
+ *	On amd64 this is called after mapping has already been enabled
  *	and just syncs the pmap module with what has already been done.
  *	[We can't call it easily with mapping off since the kernel is not
  *	mapped with PA == VA, hence we would have to relocate every address
@@ -263,40 +438,39 @@
  *	(physical) address starting relative to 0]
  */
 void
-pmap_bootstrap(firstaddr, loadaddr)
-	vm_paddr_t firstaddr;
-	vm_paddr_t loadaddr;
+pmap_bootstrap(firstaddr)
+	vm_paddr_t *firstaddr;
 {
 	vm_offset_t va;
 	pt_entry_t *pte;
-	int i;
 
-	avail_start = firstaddr;
+	avail_start = *firstaddr;
 
 	/*
-	 * XXX The calculation of virtual_avail is wrong. It's NKPT*PAGE_SIZE too
-	 * large. It should instead be correctly calculated in locore.s and
-	 * not based on 'first' (which is a physical address, not a virtual
-	 * address, for the start of unused physical memory). The kernel
-	 * page tables are NOT double mapped and thus should not be included
-	 * in this calculation.
+	 * Create an initial set of page tables to run the kernel in.
 	 */
-	virtual_avail = (vm_offset_t) KERNBASE + firstaddr;
+	create_pagetables();
+	*firstaddr = avail_start;
+
+	virtual_avail = (vm_offset_t) KERNBASE + avail_start;
 	virtual_avail = pmap_kmem_choose(virtual_avail);
 
 	virtual_end = VM_MAX_KERNEL_ADDRESS;
 
+
+	/* XXX do %cr0 as well */
+	load_cr4(rcr4() | CR4_PGE | CR4_PSE);
+	load_cr3(KPML4phys);

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305291646.h4TGkBJa041773>