Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jun 2009 19:01:53 -0700 (PDT)
From:      Neelkanth Natu <neelnatu@yahoo.com>
To:        freebsd-mips@freebsd.org
Subject:   Diffs to allow thread0 kstack to use 2 pages
Message-ID:  <7874.24776.qm@web34405.mail.mud.yahoo.com>

next in thread | raw e-mail | index | archive | help

Hi,

Please take a look at the diffs below to allow the thread0 kernel stack
to use 2 pages worth of stack space. I believe that was the original
intent of the code.

A side effect of the change is to align kstack0 on a PAGE_SIZE boundary.

Could somebody review the code and commit it if possible? I have tested it
on Sibyte and Malta platforms.

best
Neel

==== //depot/user/neelnatu/freebsd_current/src/sys/mips/mips/pmap.c#3 - /u/neelnatu/p4/freebsd_current/src/sys/mips/mips/pmap.c ====
@@ -292,6 +292,12 @@
 	/* 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++;
 		}
==== //depot/user/neelnatu/freebsd_current/src/sys/mips/mips/machdep.c#3 - /u/neelnatu/p4/freebsd_current/src/sys/mips/mips/machdep.c ====
@@ -253,8 +253,11 @@
 mips_proc0_init(void)
 {
 	proc_linkup(&proc0, &thread0);
+
+	KASSERT((kstack0 & PAGE_MASK) == 0,
+		("kstack0 is not aligned on a page boundary: 0x%0x", kstack0));
 	thread0.td_kstack = kstack0;
-	thread0.td_kstack_pages = KSTACK_PAGES - 1;
+	thread0.td_kstack_pages = KSTACK_PAGES;
 	if (thread0.td_kstack & (1 << PAGE_SHIFT))
 		thread0.td_md.md_realstack = thread0.td_kstack + PAGE_SIZE;
 	else



      



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