1 /* $NetBSD: mips_param.h,v 1.17 2000/02/11 19:25:16 thorpej Exp $ */ 2 3 #include <machine/cpu.h> 4 5 /* 6 * On mips, UPAGES is fixed by sys/arch/mips/mips/locore code 7 * to be the number of per-process-wired kernel-stack pages/PTES. 8 */ 9 10 #define SSIZE 1 /* initial stack size/NBPG */ 11 #define SINCR 1 /* increment of stack/NBPG */ 12 13 #define UPAGES 2 /* pages of u-area */ 14 #define USPACE (UPAGES*NBPG) /* size of u-area in bytes */ 15 16 #ifndef MSGBUFSIZE 17 #define MSGBUFSIZE NBPG /* default message buffer size */ 18 #endif 19 20 /* 21 * Round p (pointer or byte index) up to a correctly-aligned value for all 22 * data types (int, long, ...). The result is u_int and must be cast to 23 * any desired pointer type. 24 * 25 * ALIGNED_POINTER is a boolean macro that checks whether an address 26 * is valid to fetch data elements of type t from on this architecture. 27 * This does not reflect the optimal alignment, just the possibility 28 * (within reasonable limits). 29 * 30 */ 31 #define ALIGNBYTES 7 32 #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) 33 #define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) 34 35 #ifdef MIPS_16K_PAGE /* enable kernel support for 16k pages */ 36 #define NBPG (1024*16) /* bytes/page */ 37 #define PGOFSET (NBPG-1) /* byte offset into page */ 38 #define PGSHIFT 14 /* LOG2(NBPG) */ 39 #else 40 #define NBPG 4096 /* bytes/page */ 41 #define PGOFSET (NBPG-1) /* byte offset into page */ 42 #define PGSHIFT 12 /* LOG2(NBPG) */ 43 #endif 44 #define NPTEPG (NBPG/4) 45 46 #define NBSEG 0x400000 /* bytes/segment */ 47 #define SEGOFSET (NBSEG-1) /* byte offset into segment */ 48 #define SEGSHIFT 22 /* LOG2(NBSEG) */ 49 50 /* 51 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 52 * logical pages. 53 */ 54 #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) 55 #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) 56 57 /* pages ("clicks") (4096 bytes) to disk blocks */ 58 #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) 59 #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) 60 61 /* pages to bytes */ 62 #define ctob(x) ((x) << PGSHIFT) 63 #define btoc(x) (((x) + PGOFSET) >> PGSHIFT) 64 65 /* bytes to disk blocks */ 66 #define btodb(x) ((x) >> DEV_BSHIFT) 67 #define dbtob(x) ((x) << DEV_BSHIFT) 68 69 /* 70 * Map a ``block device block'' to a file system block. 71 * This should be device dependent, and should use the bsize 72 * field from the disk label. 73 * For now though just use DEV_BSIZE. 74 */ 75 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 76 77 /* 78 * Mach derived conversion macros 79 */ 80 #define mips_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) 81 #define mips_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) 82 #define mips_btop(x) ((unsigned)(x) >> PGSHIFT) 83 #define mips_ptob(x) ((unsigned)(x) << PGSHIFT) 84