1 /* $NetBSD: param.h,v 1.23 2018/01/11 10:30:26 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 * Maximum physical memory supported by the implementation. 34 */ 35 #define MAXPHYSMEM 0x100000000000ULL /* 16TB */ 36 37 /* 38 * XXXfvdl change this (after bootstrap) to take # of bits from 39 * config info into account. 40 */ 41 #define KERNBASE 0xffffffff80000000 /* start of kernel virtual space */ 42 #define KERNTEXTOFF 0xffffffff80200000 /* start of kernel text */ 43 #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 44 45 #define KERNTEXTOFF_HI 0xffffffff 46 #define KERNTEXTOFF_LO 0x80200000 47 48 #define KERNBASE_HI 0xffffffff 49 #define KERNBASE_LO 0x80000000 50 51 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 52 #define DEV_BSIZE (1 << DEV_BSHIFT) 53 #define BLKDEV_IOSIZE 2048 54 #ifndef MAXPHYS 55 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 56 #endif 57 58 #define SSIZE 1 /* initial stack size/NBPG */ 59 #define SINCR 1 /* increment of stack/NBPG */ 60 #ifdef DIAGNOSTIC 61 #define UPAGES 4 /* pages of u-area (1 for redzone) */ 62 #else 63 #define UPAGES 3 /* pages of u-area */ 64 #endif 65 #define USPACE (UPAGES * NBPG) /* total size of u-area */ 66 67 #ifndef MSGBUFSIZE 68 #define MSGBUFSIZE (8*NBPG) /* default message buffer size */ 69 #endif 70 71 /* 72 * Constants related to network buffer management. 73 * MCLBYTES must be no larger than NBPG (the software page size), and, 74 * on machines that exchange pages of input or output buffers with mbuf 75 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 76 * of the hardware page size. 77 */ 78 #define MSIZE 512 /* size of an mbuf */ 79 80 #ifndef MCLSHIFT 81 #define MCLSHIFT 11 /* convert bytes to m_buf clusters */ 82 /* 2K cluster can hold Ether frame */ 83 #endif /* MCLSHIFT */ 84 85 #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ 86 87 #ifndef NFS_RSIZE 88 #define NFS_RSIZE 32768 89 #endif 90 #ifndef NFS_WSIZE 91 #define NFS_WSIZE 32768 92 #endif 93 94 /* 95 * Minimum size of the kernel kmem_arena in PAGE_SIZE-sized 96 * logical pages. 97 * No enforced maximum on amd64. 98 */ 99 #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) 100 #define NKMEMPAGES_MAX_UNLIMITED 1 101 102 /* 103 * XXXfvdl the PD* stuff is different from i386. 104 */ 105 /* 106 * Mach derived conversion macros 107 */ 108 #define x86_round_pdr(x) \ 109 ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1)) 110 #define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1)) 111 #define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT) 112 #define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT) 113 #define x86_round_page(x) ((((unsigned long)(x)) + PGOFSET) & ~PGOFSET) 114 #define x86_trunc_page(x) ((unsigned long)(x) & ~PGOFSET) 115 #define x86_btop(x) ((unsigned long)(x) >> PGSHIFT) 116 #define x86_ptob(x) ((unsigned long)(x) << PGSHIFT) 117 118 #define btop(x) x86_btop(x) 119 #define ptob(x) x86_ptob(x) 120 121 #define mstohz(ms) ((ms + 0UL) * hz / 1000) 122 123 #else /* __x86_64__ */ 124 125 #include <i386/param.h> 126 127 #endif /* __x86_64__ */ 128