Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2008 01:27:44 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 133384 for review
Message-ID:  <200801160127.m0G1Risb065046@repoman.freebsd.org>

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

Change 133384 by imp@imp_lighthouse on 2008/01/16 01:26:43

	Initialize kstack0 in the mips2 way rather than in the jmips way.

Affected files ...

.. //depot/projects/mips2-jnpr/src/sys/mips/include/md_var.h#8 edit
.. //depot/projects/mips2-jnpr/src/sys/mips/mips/pmap.c#17 edit

Differences ...

==== //depot/projects/mips2-jnpr/src/sys/mips/include/md_var.h#8 (text+ko) ====

@@ -43,6 +43,8 @@
 extern	char	sigcode[];
 extern	int	szsigcode, szosigcode;
 
+extern vm_offset_t kstack0;
+
 void	MipsSaveCurFPState(struct thread *);
 void	fork_trampoline(void);
 void	cpu_swapin(struct proc *);

==== //depot/projects/mips2-jnpr/src/sys/mips/mips/pmap.c#17 (text+ko) ====

@@ -1,4 +1,3 @@
-	kstack0 = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE);
 /*
  * Copyright (c) 1991 Regents of the University of California.
  * All rights reserved.
@@ -256,7 +255,8 @@
 }
 
 /*
- *	Bootstrap the system enough to run with virtual memory.
+ *	Bootstrap the system enough to run with virtual memory.  This
+ * assumes that the phys_avail array has been initialized.
  */
 void
 pmap_bootstrap(void)
@@ -265,6 +265,51 @@
 	pt_entry_t *pte;
 	int i, j;
 
+	/* Sort. */
+again:
+	for (i = 0; phys_avail[i + 1] != 0; i += 2) {
+		if (i < 2)
+			continue;
+		if (phys_avail[i - 2] > phys_avail[i]) {
+			vm_paddr_t ptemp[2];
+
+			ptemp[0] = phys_avail[i+0];
+			ptemp[1] = phys_avail[i+1];
+
+			phys_avail[i + 0] = phys_avail[i - 2];
+			phys_avail[i + 1] = phys_avail[i - 1];
+
+			phys_avail[i - 2] = ptemp[0];
+			phys_avail[i - 1] = ptemp[1];
+			goto again;
+		}
+	}
+
+	if (bootverbose) {
+		printf("Physical memory chunk(s):\n");
+		for (i = 0; phys_avail[i + 1] != 0; i += 2) {
+			vm_paddr_t size;
+
+			size = phys_avail[i + 1] - phys_avail[i];
+			printf("%#08jx - %#08jx, %ju bytes (%ju pages)\n",
+			    (uintmax_t)phys_avail[i],
+			    (uintmax_t)phys_avail[i + 1] - 1,
+			    (uintmax_t)size, (uintmax_t)size / PAGE_SIZE);
+		}
+	}
+
+
+	/*
+	 * Steal the message buffer from the beginning of memory.
+	 */
+	msgbufp = (struct msgbuf *) pmap_steal_memory(MSGBUF_SIZE);
+	msgbufinit(msgbufp, MSGBUF_SIZE);
+
+	/*
+	 * Steal thread0 kstack.
+	 */
+	kstack0 = pmap_steal_memory(KSTACK_PAGES << PAGE_SHIFT);
+
 	/*
 	 * Allocate segment table for the kernel
 	 */



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