1 /* $NetBSD: param.h,v 1.13 2010/02/08 19:02:26 joerg Exp $ */ 2 3 #ifdef __x86_64__ 4 5 #ifdef _KERNEL 6 #include <machine/cpu.h> 7 #endif 8 9 #define _MACHINE amd64 10 #define MACHINE "amd64" 11 #define _MACHINE_ARCH x86_64 12 #define MACHINE_ARCH "x86_64" 13 #define MID_MACHINE MID_X86_64 14 15 /* 16 * Round p (pointer or byte index) up to a correctly-aligned value 17 * for all data types (int, long, ...). The result is u_int and 18 * must be cast to any desired pointer type. 19 * 20 * ALIGNED_POINTER is a boolean macro that checks whether an address 21 * is valid to fetch data elements of type t from on this architecture. 22 * This does not reflect the optimal alignment, just the possibility 23 * (within reasonable limits). 24 * 25 */ 26 #define ALIGNBYTES (sizeof(long) - 1) 27 #define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ALIGNBYTES) 28 #define ALIGNED_POINTER(p,t) 1 29 30 #define ALIGNBYTES32 (sizeof(int) - 1) 31 #define ALIGN32(p) (((u_long)(p) + ALIGNBYTES32) &~ALIGNBYTES32) 32 33 #define PGSHIFT 12 /* LOG2(NBPG) */ 34 #define NBPG (1 << PGSHIFT) /* bytes/page */ 35 #define PGOFSET (NBPG-1) /* byte offset into page */ 36 #define NPTEPG (NBPG/(sizeof (pt_entry_t))) 37 38 /* 39 * XXXfvdl change this (after bootstrap) to take # of bits from 40 * config info into account. 41 */ 42 #define KERNBASE 0xffffffff80000000 /* start of kernel virtual space */ 43 #define KERNTEXTOFF 0xffffffff80100000 /* start of kernel text */ 44 #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 45 46 #define KERNTEXTOFF_HI 0xffffffff 47 #define KERNTEXTOFF_LO 0x80100000 48 49 #define KERNBASE_HI 0xffffffff 50 #define KERNBASE_LO 0x80000000 51 52 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 53 #define DEV_BSIZE (1 << DEV_BSHIFT) 54 #define BLKDEV_IOSIZE 2048 55 #ifndef MAXPHYS 56 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 57 #endif 58 59 #define SSIZE 1 /* initial stack size/NBPG */ 60 #define SINCR 1 /* increment of stack/NBPG */ 61 #ifdef DIAGNOSTIC 62 #define UPAGES 4 /* pages of u-area (1 for redzone) */ 63 #else 64 #define UPAGES 3 /* pages of u-area */ 65 #endif 66 #define USPACE (UPAGES * NBPG) /* total size of u-area */ 67 #define INTRSTACKSIZE 4096 68 69 #ifndef MSGBUFSIZE 70 #define MSGBUFSIZE 8*NBPG /* default message buffer size */ 71 #endif 72 73 /* 74 * Constants related to network buffer management. 75 * MCLBYTES must be no larger than NBPG (the software page size), and, 76 * on machines that exchange pages of input or output buffers with mbuf 77 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 78 * of the hardware page size. 79 */ 80 #define MSIZE 512 /* size of an mbuf */ 81 82 #ifndef MCLSHIFT 83 #define MCLSHIFT 11 /* convert bytes to m_buf clusters */ 84 /* 2K cluster can hold Ether frame */ 85 #endif /* MCLSHIFT */ 86 87 #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ 88 89 #ifndef NFS_RSIZE 90 #define NFS_RSIZE 32768 91 #endif 92 #ifndef NFS_WSIZE 93 #define NFS_WSIZE 32768 94 #endif 95 96 /* 97 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 98 * logical pages. 99 */ 100 #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) 101 #define NKMEMPAGES_MAX_DEFAULT ((1 *1024 * 1024 * 1024) >> PAGE_SHIFT) 102 103 /* 104 * XXXfvdl the PD* stuff is different from i386. 105 */ 106 /* 107 * Mach derived conversion macros 108 */ 109 #define x86_round_pdr(x) \ 110 ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1)) 111 #define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1)) 112 #define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT) 113 #define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT) 114 #define x86_round_page(x) ((((unsigned long)(x)) + PGOFSET) & ~PGOFSET) 115 #define x86_trunc_page(x) ((unsigned long)(x) & ~PGOFSET) 116 #define x86_btop(x) ((unsigned long)(x) >> PGSHIFT) 117 #define x86_ptob(x) ((unsigned long)(x) << PGSHIFT) 118 119 #define btop(x) x86_btop(x) 120 #define ptob(x) x86_ptob(x) 121 #define round_pdr(x) x86_round_pdr(x) 122 123 #define mstohz(ms) ((ms + 0UL) * hz / 1000) 124 125 #else /* __x86_64__ */ 126 127 #include <i386/param.h> 128 129 #endif /* __x86_64__ */ 130