svn commit: r201563 - projects/mips/sys/mips/mips

Neel Natu neel at FreeBSD.org
Tue Jan 5 06:58:54 UTC 2010


Author: neel
Date: Tue Jan  5 06:58:54 2010
New Revision: 201563
URL: http://svn.freebsd.org/changeset/base/201563

Log:
  This change increases the size of the kernel stack for thread0 from
  PAGE_SIZE to (2 * PAGE_SIZE). It depends on the memory allocated by
  pmap_steal_memory() being aligned to a PAGE_SIZE boundary.
  
  Approved by: imp (mentor)

Modified:
  projects/mips/sys/mips/mips/machdep.c
  projects/mips/sys/mips/mips/pmap.c

Modified: projects/mips/sys/mips/mips/machdep.c
==============================================================================
--- projects/mips/sys/mips/mips/machdep.c	Tue Jan  5 06:43:29 2010	(r201562)
+++ projects/mips/sys/mips/mips/machdep.c	Tue Jan  5 06:58:54 2010	(r201563)
@@ -260,8 +260,11 @@ mips_proc0_init(void)
 {
 	proc_linkup0(&proc0, &thread0);
 
+	KASSERT((kstack0 & PAGE_MASK) == 0,
+		("kstack0 is not aligned on a page boundary: 0x%0lx",
+		(long)kstack0));
 	thread0.td_kstack = kstack0;
-	thread0.td_kstack_pages = KSTACK_PAGES - 1;
+	thread0.td_kstack_pages = KSTACK_PAGES;
 	thread0.td_md.md_realstack = roundup2(thread0.td_kstack, PAGE_SIZE * 2);
 	/* 
 	 * Do not use cpu_thread_alloc to initialize these fields 

Modified: projects/mips/sys/mips/mips/pmap.c
==============================================================================
--- projects/mips/sys/mips/mips/pmap.c	Tue Jan  5 06:43:29 2010	(r201562)
+++ projects/mips/sys/mips/mips/pmap.c	Tue Jan  5 06:58:54 2010	(r201563)
@@ -291,6 +291,12 @@ pmap_bootstrap(void)
 	/* Sort. */
 again:
 	for (i = 0; phys_avail[i + 1] != 0; i += 2) {
+		/*
+		 * Keep the memory aligned on page boundary.
+		 */
+		phys_avail[i] = round_page(phys_avail[i]);
+		phys_avail[i + 1] = trunc_page(phys_avail[i + 1]);
+
 		if (phys_avail[i + 1] >= MIPS_KSEG0_LARGEST_PHYS)
 			memory_larger_than_512meg++;
 		if (i < 2)


More information about the svn-src-projects mailing list