]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/X64/machine/param.h
1 /* $NetBSD: param.h,v 1.3 2006/08/28 13:43:35 yamt Exp $ */
4 #define MACHINE "amd64"
5 #define _MACHINE_ARCH x86_64
6 #define MACHINE_ARCH "x86_64"
7 #define MID_MACHINE MID_X86_64
10 * Round p (pointer or byte index) up to a correctly-aligned value
11 * for all data types (int, long, ...). The result is u_int and
12 * must be cast to any desired pointer type.
14 * ALIGNED_POINTER is a boolean macro that checks whether an address
15 * is valid to fetch data elements of type t from on this architecture.
16 * This does not reflect the optimal alignment, just the possibility
17 * (within reasonable limits).
20 #define ALIGNBYTES (sizeof(INT64) - 1)
21 #define ALIGN(p) (((UINT64)(p) + ALIGNBYTES) &~ALIGNBYTES)
22 #define ALIGNED_POINTER(p,t) 1
24 #define ALIGNBYTES32 (sizeof(INT32) - 1)
25 #define ALIGN32(p) (((UINT32)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
27 #define PGSHIFT 12 /* LOG2(NBPG) */
28 #define NBPG (1 << PGSHIFT) /* bytes/page */
29 #define PGOFSET (NBPG-1) /* byte offset into page */
30 #define NPTEPG (NBPG/(sizeof (pt_entry_t)))
33 * XXXfvdl change this (after bootstrap) to take # of bits from
34 * config info into account.
36 #define KERNBASE 0xffffffff80000000 /* start of kernel virtual space */
37 #define KERNTEXTOFF 0xffffffff80100000 /* start of kernel text */
38 #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
40 #define KERNTEXTOFF_HI 0xffffffff
41 #define KERNTEXTOFF_LO 0x80100000
43 #define KERNBASE_HI 0xffffffff
44 #define KERNBASE_LO 0x80000000
46 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
47 #define DEV_BSIZE (1 << DEV_BSHIFT)
48 #define BLKDEV_IOSIZE 2048
50 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
53 #define SSIZE 1 /* initial stack size/NBPG */
54 #define SINCR 1 /* increment of stack/NBPG */
55 #define UPAGES 5 /* pages of u-area */
56 #define USPACE (UPAGES * NBPG) /* total size of u-area */
59 #define MSGBUFSIZE 4*NBPG /* default message buffer size */
63 * Constants related to network buffer management.
64 * MCLBYTES must be no larger than NBPG (the software page size), and,
65 * on machines that exchange pages of input or output buffers with mbuf
66 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
67 * of the hardware page size.
69 #define MSIZE 512 /* size of an mbuf */
72 #define MCLSHIFT 11 /* convert bytes to m_buf clusters */
73 /* 2K cluster can hold Ether frame */
76 #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
80 #define NMBCLUSTERS 4096 /* map size, max cluster allocation */
82 #define NMBCLUSTERS 2048 /* map size, max cluster allocation */
87 #define NFS_RSIZE 32768
90 #define NFS_WSIZE 32768
94 * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
97 //#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
98 //#define NKMEMPAGES_MAX_DEFAULT ((1 *1024 * 1024 * 1024) >> PAGE_SHIFT)
101 * XXXfvdl the PD* stuff is different from i386.
104 * Mach derived conversion macros
107 #define x86_round_pdr(x) ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
108 #define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1))
109 #define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT)
110 #define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT)
113 #define x86_round_page(x) ((((ULONG32)(x)) + PGOFSET) & ~PGOFSET)
114 #define x86_trunc_page(x) ((ULONG32)(x) & ~PGOFSET)
115 #define x86_btop(x) ((ULONG32)(x) >> PGSHIFT)
116 #define x86_ptob(x) ((ULONG32)(x) << PGSHIFT)
118 #define btop(x) x86_btop(x)
119 #define ptob(x) x86_ptob(x)
120 #define round_pdr(x) x86_round_pdr(x)
122 #define mstohz(ms) ((ms + 0UL) * hz / 1000)