|
|
1.1 root 1: /*
2: * Memory and machine-specific definitions. Used in C and assembler.
3: */
4:
5: /*
6: * Sizes
7: */
8:
9: #define BI2BY 8 /* bits per byte */
10: #define BI2WD 32 /* bits per word */
11: #define BY2WD 4 /* bytes per word */
12: #define BY2PG 8192 /* bytes per page */
13: #define WD2PG (BY2PG/BY2WD) /* words per page */
14: #define PGSHIFT 13 /* log(BY2PG) */
15: #define PGROUND(s) (((s)+(BY2PG-1))&~(BY2PG-1))
16: #define ICACHESIZE 0
17: #define MB4 (4*1024*1024) /* Lots of things are 4Mb in size */
18:
19: #define MAXMACH 1 /* max # cpus system can run */
20:
21: /*
22: * Time
23: */
24: #define HZ (60) /* clock frequency */
25: #define MS2HZ (1000/HZ) /* millisec per clock tick */
26: #define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
27: #define TK2MS(t) ((((ulong)(t))*1000)/HZ) /* ticks to milliseconds */
28: #define MS2TK(t) ((((ulong)(t))*HZ)/1000) /* milliseconds to ticks */
29:
30: /*
31: * SR bits
32: */
33: #define SUPER 0x2000
34: #define SPL(n) (n<<8)
35:
36: /*
37: * CACR
38: */
39: #define CCLEAR 0x08
40: #define CENABLE 0x01
41:
42: /*
43: * Magic registers (unused in current system)
44: */
45:
46: #define MACH A5 /* A5 is m-> */
47: #define USER A4 /* A4 is u-> */
48:
49: /*
50: * Fundamental addresses
51: */
52:
53: #define USERADDR 0x80000000
54: /* assuming we're in a syscall, this is the address of the Ureg structure */
55: #define UREGVARSZ (23*BY2WD) /* size of variable part of Ureg */
56: #define UREGADDR (USERADDR+BY2PG-(UREGVARSZ+2+4+2+(8+8+1+1)*BY2WD))
57:
58: /*
59: * Devices poked during bootstrap
60: */
61: #define TACADDR 0x40600000
62: #define MOUSE 0x40200000
63:
64: /*
65: * MMU
66: */
67:
68: #define VAMASK 0xCFFFFFFF /* clear balu bits in address */
69: #define KUSEG 0x00000000
70: #define KSEG 0x80000000
71:
72: /*
73: * MMU entries
74: */
75: #define PTEVALID (1<<13)
76: #define PTEWRITE 0
77: #define PTERONLY (1<<14)
78: #define PTEKERNEL (1<<15)
79: #define PTEUNCACHED 0
80: #define INVALIDPTE 0
81: #define PTEMAPMEM (1024*1024)
82: #define PTEPERTAB (PTEMAPMEM/BY2PG)
83: #define SEGMAPSIZE 16
84:
85: #define PPN(pa) ((pa>>13)&0x1FFF)
86:
87: #define KMAP ((unsigned long *)0xD0000000)
88: #define UMAP ((unsigned long *)0x50000000)
89:
90: /*
91: * Virtual addresses
92: */
93: #define VTAG(va) ((va>>22)&0x03F)
94: #define VPN(va) ((va>>13)&0x1FF)
95:
96: #define PARAM ((char*)0x40500000)
97: #define TLBFLUSH_ 0x01
98:
99: /*
100: * Address spaces
101: */
102:
103: #define UZERO KUSEG /* base of user address space */
104: #define UTZERO (UZERO+BY2PG) /* first address in user text */
105: #define TSTKTOP 0x10000000 /* end of new stack in sysexec */
106: #define TSTKSIZ 100
107: #define USTKTOP (TSTKTOP-TSTKSIZ*BY2PG) /* byte just beyond user stack */
108: #define KZERO KSEG /* base of kernel address space */
109: #define KTZERO (KZERO+BY2PG) /* first address in kernel text */
110: #define USTKSIZE (4*1024*1024) /* size of user stack */
111:
112: #define MACHSIZE 4096
113:
114:
115: #define isphys(p) ((((ulong)(p))&0xF0000000) == KSEG)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.