Module Name: src Committed By: matt Date: Fri Dec 23 18:54:50 UTC 2011
Modified Files: src/sys/arch/mips/include [matt-nb5-mips64]: mips_param.h vmparam.h Log Message: Use MIPS_PAGE_SHIFT to define the page size to be used from a config file. Add support for tracking which colors have been used for an EXECPAGE. To generate a diff of this commit: cvs rdiff -u -r1.23.78.8 -r1.23.78.9 src/sys/arch/mips/include/mips_param.h cvs rdiff -u -r1.41.28.22 -r1.41.28.23 src/sys/arch/mips/include/vmparam.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/include/mips_param.h diff -u src/sys/arch/mips/include/mips_param.h:1.23.78.8 src/sys/arch/mips/include/mips_param.h:1.23.78.9 --- src/sys/arch/mips/include/mips_param.h:1.23.78.8 Sat Dec 3 01:44:04 2011 +++ src/sys/arch/mips/include/mips_param.h Fri Dec 23 18:54:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mips_param.h,v 1.23.78.8 2011/12/03 01:44:04 matt Exp $ */ +/* $NetBSD: mips_param.h,v 1.23.78.9 2011/12/23 18:54:50 matt Exp $ */ #ifdef _KERNEL #include <machine/cpu.h> @@ -39,17 +39,25 @@ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ -#if defined(ENABLE_MIPS_16KB_PAGE) || defined(ENABLE_MIPS_8KB_PAGE) +#ifdef PAGE_SHIFT +#if MIPS_PAGE_SHIFT != PAGE_SHIFT +#error MIPS_PAGE_SHIFT != PAGE_SHIFT +#endif +#elif defined(MIPS_PAGE_SHIFT) +#define PAGE_SHIFT MIPS_PAGE_SHIFT +#else +#define PAGE_SHIFT 12 +#endif + +#if PAGE_SHIFT & 1 #define UPAGES 1 /* pages of u-area */ -#define USPACE (UPAGES*NBPG) /* size of u-area in bytes */ -#elif defined(ENABLE_MIPS_4KB_PAGE) || 1 +#else #define UPAGES 2 /* pages of u-area */ -#define USPACE (UPAGES*NBPG) /* size of u-area in bytes */ #define USPACE_ALIGN USPACE /* make sure it starts on a even VA */ -#else -#error ENABLE_MIPS_xKB_PAGE not defined #endif +#define USPACE (UPAGES*NBPG) /* size of u-area in bytes */ + #ifndef MSGBUFSIZE #define MSGBUFSIZE NBPG /* default message buffer size */ #endif @@ -73,13 +81,7 @@ #define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES) #define ALIGNED_POINTER(p,t) ((((uintptr_t)(p)) & (sizeof(t)-1)) == 0) -#ifdef ENABLE_MIPS_16KB_PAGE -#define PGSHIFT 14 /* LOG2(NBPG) */ -#elif defined(ENABLE_MIPS_8KB_PAGE) -#define PGSHIFT 13 /* LOG2(NBPG) */ -#else -#define PGSHIFT 12 /* LOG2(NBPG) */ -#endif +#define PGSHIFT PAGE_SHIFT /* LOG2(NBPG) */ #define NBPG (1 << PGSHIFT) /* bytes/page */ #define PGOFSET (NBPG-1) /* byte offset into page */ #define NPTEPG (NBPG/4) Index: src/sys/arch/mips/include/vmparam.h diff -u src/sys/arch/mips/include/vmparam.h:1.41.28.22 src/sys/arch/mips/include/vmparam.h:1.41.28.23 --- src/sys/arch/mips/include/vmparam.h:1.41.28.22 Fri Dec 2 00:01:37 2011 +++ src/sys/arch/mips/include/vmparam.h Fri Dec 23 18:54:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.41.28.22 2011/12/02 00:01:37 matt Exp $ */ +/* $NetBSD: vmparam.h,v 1.41.28.23 2011/12/23 18:54:50 matt Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,17 +51,13 @@ */ /* - * We normally use a 4K page but may use 16K on MIPS systems. + * We normally use a 4K page but may use 8K, 16K, or 32K on MIPS systems. * Override PAGE_* definitions to compile-time constants. */ -#ifdef ENABLE_MIPS_16KB_PAGE -#define PAGE_SHIFT 14 -#elif defined(ENABLE_MIPS_8KB_PAGE) -#define PAGE_SHIFT 13 -#elif defined(ENABLE_MIPS_4KB_PAGE) || 1 -#define PAGE_SHIFT 12 +#ifdef MIPS_PAGE_SHIFT +#define PAGE_SHIFT MIPS_PAGE_SHIFT #else -#error ENABLE_MIPS_xKB_PAGE not defined +#define PAGE_SHIFT 12 #endif #define PAGE_SIZE (1 << PAGE_SHIFT) #define PAGE_MASK (PAGE_SIZE - 1) @@ -177,7 +173,7 @@ #ifdef ENABLE_MIPS_TX3900 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x01000000) /* 0xFFFFFFFFFF000000 */ #else -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x00004000) /* 0xFFFFFFFFFFFFC000 */ +#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x00008000) /* 0xFFFFFFFFFFF08000 */ #endif #endif #define VM_MAXUSER32_ADDRESS ((vaddr_t)(1UL << 31))/* 0x0000000080000000 */ @@ -238,14 +234,21 @@ typedef struct pv_entry { #define PG_MD_MODIFIED 0x0002 /* page has been modified */ #define PG_MD_REFERENCED 0x0004 /* page has been recently referenced */ #define PG_MD_POOLPAGE 0x0008 /* page is used as a poolpage */ -#define PG_MD_EXECPAGE 0x0010 /* page is exec mapped */ +#define PG_MD_EXECPAGE_SHIFT 8 +#define PG_MD_EXECPAGE(va) \ + __BIT(PG_MD_EXECPAGE_SHIFT + atop(va & MIPS_ICACHE_ALIAS_MASK)) + /* page (color) is exec mapped */ +#define PG_MD_EXECPAGE_ANY (0xff << PG_MD_EXECPAGE_SHIFT) + /* page is exec mapped */ #define PG_MD_CACHED_P(md) (((md)->pvh_attrs & PG_MD_UNCACHED) == 0) #define PG_MD_UNCACHED_P(md) (((md)->pvh_attrs & PG_MD_UNCACHED) != 0) #define PG_MD_MODIFIED_P(md) (((md)->pvh_attrs & PG_MD_MODIFIED) != 0) #define PG_MD_REFERENCED_P(md) (((md)->pvh_attrs & PG_MD_REFERENCED) != 0) #define PG_MD_POOLPAGE_P(md) (((md)->pvh_attrs & PG_MD_POOLPAGE) != 0) -#define PG_MD_EXECPAGE_P(md) (((md)->pvh_attrs & PG_MD_EXECPAGE) != 0) +#define PG_MD_EXECPAGE_P(md,va) (((md)->pvh_attrs & PG_MD_EXECPAGE(va)) != 0) +#define PG_MD_EXECPAGES(md) ((md)->pvh_attrs & PG_MD_EXECPAGE_ANY) +#define PG_MD_EXECPAGE_ANY_P(md) (PG_MD_EXECPAGES(md) != 0) struct vm_page_md { struct pv_entry pvh_first; /* pv_entry first */