diff options
| author | Alan Cox <alc@FreeBSD.org> | 2009-10-31 18:54:26 +0000 |
|---|---|---|
| committer | Alan Cox <alc@FreeBSD.org> | 2009-10-31 18:54:26 +0000 |
| commit | ebc91405bdb4587f2434aa552a45c82e5df2231c (patch) | |
| tree | 00049577401f4871bee8e2081f39f9a48b5db89c /sys | |
| parent | 38c15033c7c4ed836e3dbe11827374db0a903fd7 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/amd64/include/param.h | 2 | ||||
| -rw-r--r-- | sys/arm/include/param.h | 2 | ||||
| -rw-r--r-- | sys/i386/include/param.h | 2 | ||||
| -rw-r--r-- | sys/ia64/include/param.h | 2 | ||||
| -rw-r--r-- | sys/kern/kern_mib.c | 27 | ||||
| -rw-r--r-- | sys/mips/include/param.h | 2 | ||||
| -rw-r--r-- | sys/powerpc/include/param.h | 2 | ||||
| -rw-r--r-- | sys/sparc64/include/param.h | 2 | ||||
| -rw-r--r-- | sys/sun4v/include/param.h | 2 | ||||
| -rw-r--r-- | sys/sys/systm.h | 1 |
10 files changed, 44 insertions, 0 deletions
diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index edcf427df3e6..10d3ab3d6b25 100644 --- a/sys/amd64/include/param.h +++ b/sys/amd64/include/param.h @@ -118,6 +118,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 diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index c6801487c462..38224efacc00 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -104,6 +104,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 */ diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 2bcbaf478c94..bce8e6c0c569 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -109,6 +109,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 diff --git a/sys/ia64/include/param.h b/sys/ia64/include/param.h index cb805a6b344e..b844a84ca588 100644 --- a/sys/ia64/include/param.h +++ b/sys/ia64/include/param.h @@ -100,6 +100,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 diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index d42d31d651f5..04e4dc0437b7 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -204,6 +204,33 @@ SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD, 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"); diff --git a/sys/mips/include/param.h b/sys/mips/include/param.h index 250de77ba7eb..cdc9f3af7fef 100644 --- a/sys/mips/include/param.h +++ b/sys/mips/include/param.h @@ -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 */ diff --git a/sys/powerpc/include/param.h b/sys/powerpc/include/param.h index 9728fe416c0c..6234e4860c23 100644 --- a/sys/powerpc/include/param.h +++ b/sys/powerpc/include/param.h @@ -98,6 +98,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 diff --git a/sys/sparc64/include/param.h b/sys/sparc64/include/param.h index 2642a8ac2c46..eac552b45565 100644 --- a/sys/sparc64/include/param.h +++ b/sys/sparc64/include/param.h @@ -121,6 +121,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 diff --git a/sys/sun4v/include/param.h b/sys/sun4v/include/param.h index 4b26748cb985..e10b73111cdf 100644 --- a/sys/sun4v/include/param.h +++ b/sys/sun4v/include/param.h @@ -116,6 +116,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 diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 96222da91522..397976fd564f 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -54,6 +54,7 @@ extern int kstack_pages; /* number of kernel stack pages */ extern int nswap; /* size of swap space */ +extern u_long pagesizes[]; /* supported page sizes */ extern long physmem; /* physical memory */ extern long realmem; /* 'real' memory */ |
