svn commit: r197316 - in head/sys: amd64/include arm/include i386/include ia64/include kern mips/include powerpc/include sparc64/include sun4v/include sys

Alan Cox alc at FreeBSD.org
Fri Sep 18 17:04:59 UTC 2009


Author: alc
Date: Fri Sep 18 17:04:57 2009
New Revision: 197316
URL: http://svn.freebsd.org/changeset/base/197316

Log:
  Add a new sysctl for reporting all of the supported page sizes.
  
  Reviewed by:	jhb
  MFC after:	3 weeks

Modified:
  head/sys/amd64/include/param.h
  head/sys/arm/include/param.h
  head/sys/i386/include/param.h
  head/sys/ia64/include/param.h
  head/sys/kern/kern_mib.c
  head/sys/mips/include/param.h
  head/sys/powerpc/include/param.h
  head/sys/sparc64/include/param.h
  head/sys/sun4v/include/param.h
  head/sys/sys/systm.h

Modified: head/sys/amd64/include/param.h
==============================================================================
--- head/sys/amd64/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/amd64/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -108,6 +108,8 @@
 #define	NBPML4		(1ul<<PML4SHIFT)/* bytes/page map lev4 table */
 #define	PML4MASK	(NBPML4-1)
 
+#define	MAXPAGESIZES	3	/* maximum number of supported page sizes */
+
 #define IOPAGES	2		/* pages of i/o permission bitmap */
 
 #ifndef	KSTACK_PAGES

Modified: head/sys/arm/include/param.h
==============================================================================
--- head/sys/arm/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/arm/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -92,6 +92,8 @@
 #define NBPDR		(1 << PDR_SHIFT)
 #define NPDEPG          (1 << (32 - PDR_SHIFT))
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES    2
 #endif /* !KSTACK_PAGES */

Modified: head/sys/i386/include/param.h
==============================================================================
--- head/sys/i386/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/i386/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -110,6 +110,8 @@
 #define NBPDR		(1<<PDRSHIFT)	/* bytes/page dir */
 #define PDRMASK		(NBPDR-1)
 
+#define	MAXPAGESIZES	2	/* maximum number of supported page sizes */
+
 #define IOPAGES	2		/* pages of i/o permission bitmap */
 
 #ifndef KSTACK_PAGES

Modified: head/sys/ia64/include/param.h
==============================================================================
--- head/sys/ia64/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/ia64/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -89,6 +89,8 @@
 #define PAGE_MASK	(PAGE_SIZE-1)
 #define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef	KSTACK_PAGES
 #define	KSTACK_PAGES	4		/* pages of kernel stack */
 #endif

Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/kern/kern_mib.c	Fri Sep 18 17:04:57 2009	(r197316)
@@ -204,6 +204,33 @@ SYSCTL_PROC(_hw, HW_USERMEM, usermem, CT
 
 SYSCTL_ULONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
 
+u_long pagesizes[MAXPAGESIZES] = { PAGE_SIZE };
+
+static int
+sysctl_hw_pagesizes(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+#ifdef SCTL_MASK32
+	int i;
+	uint32_t pagesizes32[MAXPAGESIZES];
+
+	if (req->flags & SCTL_MASK32) {
+		/*
+		 * Recreate the "pagesizes" array with 32-bit elements.  Truncate
+		 * any page size greater than UINT32_MAX to zero.
+		 */
+		for (i = 0; i < MAXPAGESIZES; i++)
+			pagesizes32[i] = (uint32_t)pagesizes[i];
+
+		error = SYSCTL_OUT(req, pagesizes32, sizeof(pagesizes32));
+	} else
+#endif
+		error = SYSCTL_OUT(req, pagesizes, sizeof(pagesizes));
+	return (error);
+}
+SYSCTL_PROC(_hw, OID_AUTO, pagesizes, CTLTYPE_ULONG | CTLFLAG_RD,
+    NULL, 0, sysctl_hw_pagesizes, "LU", "Supported page sizes");
+
 static char	machine_arch[] = MACHINE_ARCH;
 SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
     machine_arch, 0, "System architecture");

Modified: head/sys/mips/include/param.h
==============================================================================
--- head/sys/mips/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/mips/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -115,6 +115,8 @@
 #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
 #define	SEGSHIFT	22		/* LOG2(NBSEG) */
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 /* XXXimp: This has moved to vmparam.h */
 /* Also, this differs from the mips2 definition, but likely is better */
 /* since this means the kernel won't chew up TLBs when it is executing */

Modified: head/sys/powerpc/include/param.h
==============================================================================
--- head/sys/powerpc/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/powerpc/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -86,6 +86,8 @@
 #define	PAGE_MASK	(PAGE_SIZE - 1)
 #define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define	KSTACK_PAGES		4		/* includes pcb */
 #endif

Modified: head/sys/sparc64/include/param.h
==============================================================================
--- head/sys/sparc64/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/sparc64/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -109,6 +109,8 @@
 #define PAGE_SIZE_MAX	PAGE_SIZE_4M
 #define PAGE_MASK_MAX	PAGE_MASK_4M
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
 #endif

Modified: head/sys/sun4v/include/param.h
==============================================================================
--- head/sys/sun4v/include/param.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/sun4v/include/param.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -104,6 +104,8 @@
 #define PAGE_SIZE_MAX	PAGE_SIZE_4M
 #define PAGE_MASK_MAX	PAGE_MASK_4M
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
 #endif

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Fri Sep 18 15:39:09 2009	(r197315)
+++ head/sys/sys/systm.h	Fri Sep 18 17:04:57 2009	(r197316)
@@ -54,6 +54,7 @@ extern int kstack_pages;	/* number of ke
 
 extern int nswap;		/* size of swap space */
 
+extern u_long pagesizes[];	/* supported page sizes */
 extern long physmem;		/* physical memory */
 extern long realmem;		/* 'real' memory */
 


More information about the svn-src-head mailing list