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