Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Nov 2002 18:17:59 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 21023 for review
Message-ID:  <200211130217.gAD2HxWO053098@repoman.freebsd.org>

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

Change 21023 by peter@peter_daintree on 2002/11/12 18:17:57

	integrate i386_hammer

Affected files ...

.. //depot/projects/hammer/sys/x86_64/include/pcb.h#5 integrate
.. //depot/projects/hammer/sys/x86_64/include/reg.h#4 integrate
.. //depot/projects/hammer/sys/x86_64/isa/npx.c#14 integrate
.. //depot/projects/hammer/sys/x86_64/pci/pci_cfgreg.c#7 integrate
.. //depot/projects/hammer/sys/x86_64/x86_64/exception.s#8 integrate
.. //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#9 integrate
.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#27 integrate
.. //depot/projects/hammer/sys/x86_64/x86_64/pmap.c#7 integrate
.. //depot/projects/hammer/sys/x86_64/x86_64/trap.c#14 integrate

Differences ...

==== //depot/projects/hammer/sys/x86_64/include/pcb.h#5 (text+ko) ====

@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)pcb.h	5.10 (Berkeley) 5/12/91
- * $FreeBSD: src/sys/i386/include/pcb.h,v 1.48 2002/10/15 00:02:50 peter Exp $
+ * $FreeBSD: src/sys/i386/include/pcb.h,v 1.49 2002/11/07 01:34:23 davidxu Exp $
  */
 
 #ifndef _I386_PCB_H_
@@ -63,10 +63,10 @@
 
 	struct	savefpu	pcb_save;
 	u_int	pcb_flags;
-#define	FP_SOFTFP	0x01	/* process using software fltng pnt emulator */
 #define	PCB_DBREGS	0x02	/* process using debug registers */
 #define	PCB_NPXTRAP	0x04	/* npx trap pending */
 #define	PCB_NPXINITDONE	0x08	/* fpu state is initialized */
+
 	caddr_t	pcb_onfault;	/* copyin/out fault recovery */
 	int	pcb_gs;
 	struct	pcb_ext	*pcb_ext;	/* optional pcb extension */

==== //depot/projects/hammer/sys/x86_64/include/reg.h#4 (text+ko) ====

@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)reg.h	5.5 (Berkeley) 1/18/91
- * $FreeBSD: src/sys/i386/include/reg.h,v 1.28 2002/10/20 20:48:56 phk Exp $
+ * $FreeBSD: src/sys/i386/include/reg.h,v 1.29 2002/11/07 22:42:31 alfred Exp $
  */
 
 #ifndef _MACHINE_REG_H_
@@ -131,7 +131,7 @@
 #define DBREG_DR7_EXEC      0x00      /* break on execute       */
 #define DBREG_DR7_WRONLY    0x01      /* break on write         */
 #define DBREG_DR7_RDWR      0x03      /* break on read or write */
-#define DBREG_DRX(d,x) (d->dr[(x)]) /* reference dr0 - dr7 by
+#define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr7 by
                                          register number */
 
 

==== //depot/projects/hammer/sys/x86_64/isa/npx.c#14 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)npx.c	7.2 (Berkeley) 5/12/91
- * $FreeBSD: src/sys/i386/isa/npx.c,v 1.134 2002/10/25 19:12:16 peter Exp $
+ * $FreeBSD: src/sys/i386/isa/npx.c,v 1.135 2002/11/05 04:03:42 davidxu Exp $
  */
 
 #include "opt_debug_npx.h"

==== //depot/projects/hammer/sys/x86_64/pci/pci_cfgreg.c#7 (text+ko) ====

@@ -25,7 +25,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/i386/pci/pci_cfgreg.c,v 1.97 2002/10/07 05:15:05 imp Exp $
+ * $FreeBSD: src/sys/i386/pci/pci_cfgreg.c,v 1.99 2002/11/02 22:35:24 imp Exp $
  *
  */
 
@@ -222,18 +222,19 @@
 static int
 pci_cfgcheck(int maxdev)
 {
-	u_char device;
+	uint32_t id, class;
+	uint8_t header;
+	uint8_t device;
 
 	if (bootverbose) 
 		printf("pci_cfgcheck:\tdevice ");
 
 	for (device = 0; device < maxdev; device++) {
-		unsigned id, class, header;
 		if (bootverbose) 
 			printf("%d ", device);
 
 		id = inl(pci_cfgenable(0, device, 0, 0, 4));
-		if (id == 0 || id == -1)
+		if (id == 0 || id == 0xffffffff)
 			continue;
 
 		class = inl(pci_cfgenable(0, device, 0, 8, 4)) >> 8;
@@ -243,7 +244,7 @@
 			continue;
 
 		header = inb(pci_cfgenable(0, device, 0, 14, 1));
-		if (bootverbose) 
+		if (bootverbose)
 			printf("[hdr=%02x] ", header);
 		if ((header & 0x7e) != 0)
 			continue;
@@ -264,13 +265,13 @@
 static int
 pcireg_cfgopen(void)
 {
-	unsigned long mode1res,oldval1;
-	unsigned char mode2res,oldval2;
+	uint32_t mode1res, oldval1;
+	uint8_t mode2res, oldval2;
 
 	oldval1 = inl(CONF1_ADDR_PORT);
 
 	if (bootverbose) {
-		printf("pci_open(1):\tmode 1 addr port (0x0cf8) is 0x%08lx\n",
+		printf("pci_open(1):\tmode 1 addr port (0x0cf8) is 0x%08x\n",
 		    oldval1);
 	}
 
@@ -280,12 +281,12 @@
 		devmax = 32;
 
 		outl(CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
-		outb(CONF1_ADDR_PORT +3, 0);
+		outb(CONF1_ADDR_PORT + 3, 0);
 		mode1res = inl(CONF1_ADDR_PORT);
 		outl(CONF1_ADDR_PORT, oldval1);
 
 		if (bootverbose)
-			printf("pci_open(1a):\tmode1res=0x%08lx (0x%08lx)\n", 
+			printf("pci_open(1a):\tmode1res=0x%08x (0x%08lx)\n", 
 			    mode1res, CONF1_ENABLE_CHK);
 
 		if (mode1res) {
@@ -298,7 +299,7 @@
 		outl(CONF1_ADDR_PORT, oldval1);
 
 		if (bootverbose)
-			printf("pci_open(1b):\tmode1res=0x%08lx (0x%08lx)\n", 
+			printf("pci_open(1b):\tmode1res=0x%08x (0x%08lx)\n", 
 			    mode1res, CONF1_ENABLE_CHK1);
 
 		if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) {

==== //depot/projects/hammer/sys/x86_64/x86_64/exception.s#8 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/i386/exception.s,v 1.98 2002/07/28 00:27:51 peter Exp $
+ * $FreeBSD: src/sys/i386/i386/exception.s,v 1.99 2002/11/07 01:34:23 davidxu Exp $
  */
 
 #include <machine/asmacros.h>

==== //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#9 (text+ko) ====

@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)genassym.c	5.11 (Berkeley) 5/10/91
- * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.130 2002/10/25 19:10:56 peter Exp $
+ * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.131 2002/11/07 01:34:23 davidxu Exp $
  */
 
 #include "opt_compat.h"
@@ -141,6 +141,7 @@
 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
 
 ASSYM(PCB_SIZE, sizeof(struct pcb));
+ASSYM(PCB_VM86CALL, PCB_VM86CALL);
 
 ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
 ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));

==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#27 (text+ko) ====

@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)machdep.c	7.4 (Berkeley) 6/3/91
- * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.545 2002/10/25 19:10:56 peter Exp $
+ * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.549 2002/11/09 21:17:41 iwasaki Exp $
  */
 
 #include "opt_atalk.h"
@@ -148,7 +148,6 @@
 	CTLFLAG_RD, &tlb_flush_count, 0, "");
 #endif
 
-long physmem = 0;
 int cold = 1;
 
 #ifdef COMPAT_FREEBSD4
@@ -156,42 +155,6 @@
     u_long code);
 #endif
 
-static int
-sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
-{
-	u_long val;
-
-	val = ctob(physmem);
-	return (sysctl_handle_long(oidp, &val, 0, req));
-}
-
-SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD,
-	0, 0, sysctl_hw_physmem, "LU", "");
-
-static int
-sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
-{
-	u_long val;
-
-	val = ctob(physmem - cnt.v_wire_count);
-	return (sysctl_handle_long(oidp, &val, 0, req));
-}
-
-SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD,
-	0, 0, sysctl_hw_usermem, "LU", "");
-
-static int
-sysctl_hw_availpages(SYSCTL_HANDLER_ARGS)
-{
-	u_long val;
-
-	val = i386_btop(avail_end - avail_start);
-	return (sysctl_handle_long(oidp, &val, 0, req));
-}
-
-SYSCTL_PROC(_hw, OID_AUTO, availpages, CTLTYPE_ULONG | CTLFLAG_RD,
-	0, 0, sysctl_hw_availpages, "LU", "");
-
 long Maxmem = 0;
 
 vm_offset_t phys_avail[10];
@@ -220,8 +183,8 @@
 #ifdef PERFMON
 	perfmon_init();
 #endif
-	printf("real memory  = %u (%uK bytes)\n", ptoa(Maxmem),
-	    ptoa(Maxmem) / 1024);
+	printf("real memory  = %u (%u MB)\n", ptoa(Maxmem),
+	    ptoa(Maxmem) / 1048576);
 	/*
 	 * Display any holes after the first chunk of extended memory.
 	 */
@@ -241,8 +204,8 @@
 
 	vm_ksubmap_init(&kmi);
 
-	printf("avail memory = %u (%uK bytes)\n", ptoa(cnt.v_free_count),
-	    ptoa(cnt.v_free_count) / 1024);
+	printf("avail memory = %u (%u MB)\n", ptoa(cnt.v_free_count),
+	    ptoa(cnt.v_free_count) / 1048576);
 
 	/*
 	 * Set up buffers, so they can be used to read disk labels.
@@ -325,8 +288,6 @@
 		sf.sf_si.si_signo = sig;
 		sf.sf_si.si_code = code;
 		sf.sf_si.si_addr = (void *)regs->tf_err;
-		sf.sf_si.si_pid = p->p_pid;
-		sf.sf_si.si_uid = p->p_ucred->cr_uid;
 	} else {
 		/* Old FreeBSD-style arguments. */
 		sf.sf_siginfo = code;
@@ -456,8 +417,6 @@
 		sf.sf_si.si_signo = sig;
 		sf.sf_si.si_code = code;
 		sf.sf_si.si_addr = (void *)regs->tf_err;
-		sf.sf_si.si_pid = p->p_pid;
-		sf.sf_si.si_uid = p->p_ucred->cr_uid;
 	} else {
 		/* Old FreeBSD-style arguments. */
 		sf.sf_siginfo = code;
@@ -1164,55 +1123,34 @@
 	} #error "while not end of smap table from loader"
 
 	/*
-	 * Perform "base memory" related probes & setup
+	 * Perform "base memory" related probes & setup based on SMAP
 	 */
-	for (i = 0; i <= physmap_idx; i += 2) {
-		if (physmap[i] == 0x00000000) {
-			basemem = physmap[i + 1] / 1024;
-			break;
+	if (basemem == 0) {
+		for (i = 0; i <= physmap_idx; i += 2) {
+			if (physmap[i] == 0x00000000) {
+				basemem = physmap[i + 1] / 1024;
+				break;
+			}
 		}
-	}
 
-	/* Fall back to the old compatibility function for base memory */
-#error "basemem = fetch from loader metadata"
+		if (basemem == 0) {
+			basemem = 640;
+		}
 
-	if (basemem > 640) {
-		printf("Preposterous BIOS basemem of %uK, truncating to 640K\n",
-			basemem);
-		basemem = 640;
-	}
+		if (basemem > 640) {
+			printf("Preposterous BIOS basemem of %uK, truncating to 640K\n",
+				basemem);
+			basemem = 640;
+		}
 
-	/*
-	 * XXX if biosbasemem is now < 640, there is a `hole'
-	 * between the end of base memory and the start of
-	 * ISA memory.  The hole may be empty or it may
-	 * contain BIOS code or data.  Map it read/write so
-	 * that the BIOS can write to it.  (Memory from 0 to
-	 * the physical end of the kernel is mapped read-only
-	 * to begin with and then parts of it are remapped.
-	 * The parts that aren't remapped form holes that
-	 * remain read-only and are unused by the kernel.
-	 * The base memory area is below the physical end of
-	 * the kernel and right now forms a read-only hole.
-	 * The part of it from PAGE_SIZE to
-	 * (trunc_page(biosbasemem * 1024) - 1) will be
-	 * remapped and used by the kernel later.)
-	 *
-	 * This code is similar to the code used in
-	 * pmap_mapdev, but since no memory needs to be
-	 * allocated we simply change the mapping.
-	 */
-	for (pa = trunc_page(basemem * 1024);
-	     pa < ISA_HOLE_START; pa += PAGE_SIZE)
-		pmap_kenter(KERNBASE + pa, pa);
+		for (pa = trunc_page(basemem * 1024);
+		     pa < ISA_HOLE_START; pa += PAGE_SIZE)
+			pmap_kenter(KERNBASE + pa, pa);
 
-	/*
-	 * if basemem != 640, map pages r/w into vm86 page table so
-	 * that the bios can scribble on it.
-	 */
-	pte = (pt_entry_t *)vm86paddr;
-	for (i = basemem / 4; i < 160; i++)
-		pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U;
+		pte = (pt_entry_t *)vm86paddr;
+		for (i = basemem / 4; i < 160; i++)
+			pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U;
+	}
 
 	if (physmap[1] != 0)
 		goto physmap_done;

==== //depot/projects/hammer/sys/x86_64/x86_64/pmap.c#7 (text+ko) ====

@@ -39,7 +39,7 @@
  * SUCH DAMAGE.
  *
  *	from:	@(#)pmap.c	7.7 (Berkeley)	5/12/91
- * $FreeBSD: src/sys/i386/i386/pmap.c,v 1.367 2002/10/02 07:44:21 scottl Exp $
+ * $FreeBSD: src/sys/i386/i386/pmap.c,v 1.369 2002/11/11 05:17:33 alc Exp $
  */
 
 /*
@@ -191,7 +191,6 @@
 static void	i386_protection_init(void);
 static __inline void	pmap_changebit(vm_page_t m, int bit, boolean_t setem);
 
-static void	pmap_remove_all(vm_page_t m);
 static vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va,
 				      vm_page_t m, vm_page_t mpte);
 static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva);
@@ -1740,7 +1739,7 @@
  *		pmap_remove (slow...)
  */
 
-static void
+void
 pmap_remove_all(vm_page_t m)
 {
 	register pv_entry_t pv;
@@ -2196,7 +2195,6 @@
 	vm_offset_t tmpidx;
 	int psize;
 	vm_page_t p, mpte;
-	int objpgs;
 
 	if (pmap == NULL || object == NULL)
 		return;
@@ -2275,76 +2273,44 @@
 	}
 
 	mpte = NULL;
+
+	if ((p = TAILQ_FIRST(&object->memq)) != NULL) {
+		if (p->pindex < pindex) {
+			p = vm_page_splay(pindex, object->root);
+			if ((object->root = p)->pindex < pindex)
+				p = TAILQ_NEXT(p, listq);
+		}
+	}
 	/*
-	 * if we are processing a major portion of the object, then scan the
-	 * entire thing.
+	 * Assert: the variable p is either (1) the page with the
+	 * least pindex greater than or equal to the parameter pindex
+	 * or (2) NULL.
 	 */
-	if (psize > (object->resident_page_count >> 2)) {
-		objpgs = psize;
-
-		for (p = TAILQ_FIRST(&object->memq);
-		    ((objpgs > 0) && (p != NULL));
-		    p = TAILQ_NEXT(p, listq)) {
-
-			if (p->pindex < pindex || p->pindex - pindex >= psize) {
-				continue;
-			}
-			tmpidx = p->pindex - pindex;
-			/*
-			 * don't allow an madvise to blow away our really
-			 * free pages allocating pv entries.
-			 */
-			if ((limit & MAP_PREFAULT_MADVISE) &&
-			    cnt.v_free_count < cnt.v_free_reserved) {
-				break;
-			}
-			vm_page_lock_queues();
-			if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
-				(p->busy == 0) &&
-			    (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
-				if ((p->queue - p->pc) == PQ_CACHE)
-					vm_page_deactivate(p);
-				vm_page_busy(p);
-				vm_page_unlock_queues();
-				mpte = pmap_enter_quick(pmap, 
-					addr + i386_ptob(tmpidx), p, mpte);
-				vm_page_lock_queues();
-				vm_page_wakeup(p);
-			}
-			vm_page_unlock_queues();
-			objpgs -= 1;
-		}
-	} else {
+	for (;
+	     p != NULL && (tmpidx = p->pindex - pindex) < psize;
+	     p = TAILQ_NEXT(p, listq)) {
 		/*
-		 * else lookup the pages one-by-one.
+		 * don't allow an madvise to blow away our really
+		 * free pages allocating pv entries.
 		 */
-		for (tmpidx = 0; tmpidx < psize; tmpidx += 1) {
-			/*
-			 * don't allow an madvise to blow away our really
-			 * free pages allocating pv entries.
-			 */
-			if ((limit & MAP_PREFAULT_MADVISE) &&
-			    cnt.v_free_count < cnt.v_free_reserved) {
-				break;
-			}
-			p = vm_page_lookup(object, tmpidx + pindex);
-			if (p == NULL)
-				continue;
+		if ((limit & MAP_PREFAULT_MADVISE) &&
+		    cnt.v_free_count < cnt.v_free_reserved) {
+			break;
+		}
+		vm_page_lock_queues();
+		if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL &&
+		    (p->busy == 0) &&
+		    (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
+			if ((p->queue - p->pc) == PQ_CACHE)
+				vm_page_deactivate(p);
+			vm_page_busy(p);
+			vm_page_unlock_queues();
+			mpte = pmap_enter_quick(pmap, 
+				addr + i386_ptob(tmpidx), p, mpte);
 			vm_page_lock_queues();
-			if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL &&
-				(p->busy == 0) &&
-			    (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
-				if ((p->queue - p->pc) == PQ_CACHE)
-					vm_page_deactivate(p);
-				vm_page_busy(p);
-				vm_page_unlock_queues();
-				mpte = pmap_enter_quick(pmap, 
-					addr + i386_ptob(tmpidx), p, mpte);
-				vm_page_lock_queues();
-				vm_page_wakeup(p);
-			}
-			vm_page_unlock_queues();
+			vm_page_wakeup(p);
 		}
+		vm_page_unlock_queues();
 	}
 	return;
 }
@@ -2859,7 +2825,8 @@
 	register pt_entry_t *pte;
 	int s;
 
-	if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
+	if (!pmap_initialized || (m->flags & PG_FICTITIOUS) ||
+	    (!setem && bit == PG_RW && (m->flags & PG_WRITEABLE) == 0))
 		return;
 
 	s = splvm();
@@ -2904,6 +2871,8 @@
 			}
 		}
 	}
+	if (!setem && bit == PG_RW)
+		vm_page_flag_clear(m, PG_WRITEABLE);
 	splx(s);
 }
 

==== //depot/projects/hammer/sys/x86_64/x86_64/trap.c#14 (text+ko) ====

@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)trap.c	7.4 (Berkeley) 5/13/91
- * $FreeBSD: src/sys/i386/i386/trap.c,v 1.236 2002/10/24 23:09:48 julian Exp $
+ * $FreeBSD: src/sys/i386/i386/trap.c,v 1.237 2002/11/07 01:34:23 davidxu Exp $
  */
 
 /*

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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