FreeBSD/Linux Kernel Cross Reference
sys/alphapc/mem.h
1 /*
2 * Memory and machine-specific definitions. Used in C and assembler.
3 */
4
5 /*
6 * Sizes
7 */
8 #define BI2BY 8 /* bits per byte */
9 #define BI2WD 32 /* bits per word */
10 #define BY2WD 4 /* bytes per word */
11 #define BY2V 8 /* bytes per vlong */
12 #define BY2PG 8192 /* bytes per page */
13 #define WD2PG (BY2PG/BY2WD) /* words per page */
14 #define PGSHIFT 13 /* log(BY2PG) */
15 #define ROUND(s, sz) (((s)+((sz)-1))&~((sz)-1))
16 #define PGROUND(s) ROUND(s, BY2PG)
17 #define BLOCKALIGN 8
18
19 #define BY2PTE 8 /* bytes per pte entry */
20 #define PTE2PG (BY2PG/BY2PTE) /* pte entries per page */
21
22 #define MAXMACH 1 /* max # cpus system can run */
23 #define KSTACK 4096 /* Size of kernel stack */
24
25 /*
26 * Time
27 */
28 #define HZ 100 /* clock frequency */
29 #define MS2HZ (1000/HZ)
30 #define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
31
32 /*
33 * Magic registers
34 */
35 #define MACH 15 /* R15 is m-> */
36 #define USER 14 /* R14 is up-> */
37
38
39 /*
40 * Fundamental addresses
41 */
42 /* XXX MACHADDR, MACHP(n) */
43
44 /*
45 * MMU
46 *
47 * A PTE is 64 bits, but a ulong is 32! Hence we encode
48 * the PTEs specially for fault.c, and decode them in putmmu().
49 * This means that we can only map the first 2G of physical
50 * space via putmmu() - ie only physical memory, not devices.
51 */
52 #define PTEVALID 0x3301
53 #define PTEKVALID 0x1101
54 #define PTEASM 0x0010
55 #define PTEGH(s) ((s)<<5)
56 #define PTEWRITE 0
57 #define PTERONLY 0x4
58 #define PTEUNCACHED 0
59 #define PPN(n) (((n)>>PGSHIFT)<<14)
60 #define FIXPTE(x) ((((uvlong)(x)>>14)<<32)|((x) & 0x3fff))
61 #define PTEPFN(pa) (((uvlong)(pa)>>PGSHIFT)<<32)
62 #define NCOLOR 1
63 #define getpgcolor(a) 0
64
65 #define PTEMAPMEM (1024*1024)
66 #define PTEPERTAB (PTEMAPMEM/BY2PG)
67 #define SEGMAPSIZE 512
68 #define SSEGMAPSIZE 16
69
70 /*
71 * Address spaces
72 */
73 #define UZERO 0 /* base of user address space */
74 #define UTZERO (UZERO+BY2PG) /* first address in user text */
75 #define USTKTOP (TSTKTOP-TSTKSIZ*BY2PG) /* byte just beyond user stack */
76 #define TSTKTOP KZERO /* top of temporary stack */
77 #define TSTKSIZ 100
78 #define KZERO 0x80000000 /* base of kernel address space */
79 #define KTZERO (KZERO+0x400000) /* first address in kernel text */
80 #define USTKSIZE (4*1024*1024) /* size of user stack */
81
82 /*
83 * Processor Status (as returned by rdps)
84 */
85 #define UMODE 0x8
86 #define IPL 0x7
87
88
89 #define isphys(x) (((ulong)x&KZERO)!=0)
Cache object: ebba8b8a22e2efe9c7108259bbb9d824
|