Diffs to allow thread0 kstack to use 2 pages
Neelkanth Natu
neelnatu at yahoo.com
Thu Jun 25 02:01:55 UTC 2009
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
More information about the freebsd-mips
mailing list