param.h revision 1.10 1 /* $NetBSD: param.h,v 1.10 2008/12/20 12:42:36 ad 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 NMBCLUSTERS
90 #if defined(_KERNEL_OPT)
91 #include "opt_gateway.h"
92 #endif
93
94 #ifdef GATEWAY
95 #define NMBCLUSTERS 4096 /* map size, max cluster allocation */
96 #else
97 #define NMBCLUSTERS 2048 /* map size, max cluster allocation */
98 #endif
99 #endif
100
101 #ifndef NFS_RSIZE
102 #define NFS_RSIZE 32768
103 #endif
104 #ifndef NFS_WSIZE
105 #define NFS_WSIZE 32768
106 #endif
107
108 /*
109 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
110 * logical pages.
111 */
112 #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
113 #define NKMEMPAGES_MAX_DEFAULT ((1 *1024 * 1024 * 1024) >> PAGE_SHIFT)
114
115 /*
116 * XXXfvdl the PD* stuff is different from i386.
117 */
118 /*
119 * Mach derived conversion macros
120 */
121 #define x86_round_pdr(x) \
122 ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
123 #define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1))
124 #define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT)
125 #define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT)
126 #define x86_round_page(x) ((((unsigned long)(x)) + PGOFSET) & ~PGOFSET)
127 #define x86_trunc_page(x) ((unsigned long)(x) & ~PGOFSET)
128 #define x86_btop(x) ((unsigned long)(x) >> PGSHIFT)
129 #define x86_ptob(x) ((unsigned long)(x) << PGSHIFT)
130
131 #define btop(x) x86_btop(x)
132 #define ptob(x) x86_ptob(x)
133 #define round_pdr(x) x86_round_pdr(x)
134
135 #define mstohz(ms) ((ms + 0UL) * hz / 1000)
136
137 #else /* __x86_64__ */
138
139 #include <i386/param.h>
140
141 #endif /* __x86_64__ */
142