param.h revision 1.9 1 1.9 mrg /* $NetBSD: param.h,v 1.9 2008/10/26 00:08:15 mrg 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.8 yamt #define UPAGES 3 /* pages of u-area */
62 1.1 fvdl #define USPACE (UPAGES * NBPG) /* total size of u-area */
63 1.7 yamt #define INTRSTACKSIZE 4096
64 1.1 fvdl
65 1.1 fvdl #ifndef MSGBUFSIZE
66 1.4 joerg #define MSGBUFSIZE 8*NBPG /* default message buffer size */
67 1.1 fvdl #endif
68 1.1 fvdl
69 1.1 fvdl /*
70 1.1 fvdl * Constants related to network buffer management.
71 1.1 fvdl * MCLBYTES must be no larger than NBPG (the software page size), and,
72 1.1 fvdl * on machines that exchange pages of input or output buffers with mbuf
73 1.1 fvdl * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
74 1.1 fvdl * of the hardware page size.
75 1.1 fvdl */
76 1.1 fvdl #define MSIZE 512 /* size of an mbuf */
77 1.1 fvdl
78 1.1 fvdl #ifndef MCLSHIFT
79 1.1 fvdl #define MCLSHIFT 11 /* convert bytes to m_buf clusters */
80 1.1 fvdl /* 2K cluster can hold Ether frame */
81 1.1 fvdl #endif /* MCLSHIFT */
82 1.1 fvdl
83 1.1 fvdl #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
84 1.1 fvdl
85 1.1 fvdl #ifndef NMBCLUSTERS
86 1.1 fvdl #if defined(_KERNEL_OPT)
87 1.1 fvdl #include "opt_gateway.h"
88 1.1 fvdl #endif
89 1.1 fvdl
90 1.1 fvdl #ifdef GATEWAY
91 1.1 fvdl #define NMBCLUSTERS 4096 /* map size, max cluster allocation */
92 1.1 fvdl #else
93 1.1 fvdl #define NMBCLUSTERS 2048 /* map size, max cluster allocation */
94 1.1 fvdl #endif
95 1.1 fvdl #endif
96 1.1 fvdl
97 1.1 fvdl #ifndef NFS_RSIZE
98 1.1 fvdl #define NFS_RSIZE 32768
99 1.1 fvdl #endif
100 1.1 fvdl #ifndef NFS_WSIZE
101 1.1 fvdl #define NFS_WSIZE 32768
102 1.1 fvdl #endif
103 1.1 fvdl
104 1.1 fvdl /*
105 1.1 fvdl * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
106 1.1 fvdl * logical pages.
107 1.1 fvdl */
108 1.1 fvdl #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
109 1.2 chs #define NKMEMPAGES_MAX_DEFAULT ((1 *1024 * 1024 * 1024) >> PAGE_SHIFT)
110 1.1 fvdl
111 1.1 fvdl /*
112 1.1 fvdl * XXXfvdl the PD* stuff is different from i386.
113 1.1 fvdl */
114 1.1 fvdl /*
115 1.1 fvdl * Mach derived conversion macros
116 1.1 fvdl */
117 1.1 fvdl #define x86_round_pdr(x) \
118 1.1 fvdl ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
119 1.1 fvdl #define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1))
120 1.1 fvdl #define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT)
121 1.1 fvdl #define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT)
122 1.1 fvdl #define x86_round_page(x) ((((unsigned long)(x)) + PGOFSET) & ~PGOFSET)
123 1.1 fvdl #define x86_trunc_page(x) ((unsigned long)(x) & ~PGOFSET)
124 1.1 fvdl #define x86_btop(x) ((unsigned long)(x) >> PGSHIFT)
125 1.1 fvdl #define x86_ptob(x) ((unsigned long)(x) << PGSHIFT)
126 1.1 fvdl
127 1.1 fvdl #define btop(x) x86_btop(x)
128 1.1 fvdl #define ptob(x) x86_ptob(x)
129 1.1 fvdl #define round_pdr(x) x86_round_pdr(x)
130 1.1 fvdl
131 1.1 fvdl #define mstohz(ms) ((ms + 0UL) * hz / 1000)
132 1.9 mrg
133 1.9 mrg #else /* __x86_64__ */
134 1.9 mrg
135 1.9 mrg #include <i386/param.h>
136 1.9 mrg
137 1.9 mrg #endif /* __x86_64__ */
138