Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Aug 2009 22:51:11 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r196266 - projects/mips/sys/mips/mips
Message-ID:  <200908152251.n7FMpBJQ092527@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Aug 15 22:51:11 2009
New Revision: 196266
URL: http://svn.freebsd.org/changeset/base/196266

Log:
  (1) Fix a few 32/64-bit bugs.
  (2) Also, always allocate 2 pages for the stack to optimize TLB usage.
  
  Submitted by:	neel@ (2)

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

Modified: projects/mips/sys/mips/mips/machdep.c
==============================================================================
--- projects/mips/sys/mips/mips/machdep.c	Sat Aug 15 22:48:09 2009	(r196265)
+++ projects/mips/sys/mips/mips/machdep.c	Sat Aug 15 22:51:11 2009	(r196266)
@@ -104,6 +104,7 @@ SYSCTL_STRING(_hw, HW_MODEL, model, CTLF
 
 int cold = 1;
 long realmem = 0;
+long Maxmem = 0;
 int cpu_clock = MIPS_DEFAULT_HZ;
 SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD, 
     &cpu_clock, 0, "CPU instruction clock rate");
@@ -170,11 +171,13 @@ cpu_startup(void *dummy)
 
 		printf("Physical memory chunk(s):\n");
 		for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
-			int size1 = phys_avail[indx + 1] - phys_avail[indx];
+			uintptr_t size1 = phys_avail[indx + 1] - phys_avail[indx];
 
-			printf("0x%08x - 0x%08x, %u bytes (%u pages)\n",
-			    phys_avail[indx], phys_avail[indx + 1] - 1, size1,
-			    size1 / PAGE_SIZE);
+			printf("0x%08llx - 0x%08llx, %llu bytes (%llu pages)\n",
+			    (unsigned long long)phys_avail[indx],
+			    (unsigned long long)phys_avail[indx + 1] - 1,
+			    (unsigned long long)size1,
+			    (unsigned long long)size1 / PAGE_SIZE);
 		}
 	}
 
@@ -255,10 +258,7 @@ mips_proc0_init(void)
 	proc_linkup(&proc0, &thread0);
 	thread0.td_kstack = kstack0;
 	thread0.td_kstack_pages = KSTACK_PAGES - 1;
-	if (thread0.td_kstack & (1 << PAGE_SHIFT))
-		thread0.td_md.md_realstack = thread0.td_kstack + PAGE_SIZE;
-	else
-		thread0.td_md.md_realstack = thread0.td_kstack;
+	thread0.td_md.md_realstack = roundup2(thread0.td_kstack, PAGE_SIZE * 2);
 	/* Initialize pcpu info of cpu-zero */
 #ifdef SMP
 	pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu));



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