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