mem.h - vx32 - Local 9vx git repository for patches.
(HTM) git clone git://r-36.net/vx32
(DIR) Log
(DIR) Files
(DIR) Refs
---
mem.h (1644B)
---
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 double word */
12 #define BY2PG 4096 /* bytes per page */
13 #define WD2PG (BY2PG/BY2WD) /* words per page */
14 #define BY2XPG (4096*1024) /* bytes per big page */
15 #define PGSHIFT 12 /* log(BY2PG) */
16 #define ROUND(s, sz) (((s)+((sz)-1))&~((sz)-1))
17 #define PGROUND(s) ROUND(s, BY2PG)
18 #define BLOCKALIGN 8
19
20 #define MAXMACH 128 /* max # cpus system can run */
21 #define KSTACK (1024*1024) /* Size of kernel stack */
22
23 /*
24 * Time
25 */
26 #define HZ (1000) /* clock frequency */
27 #define MS2HZ (1000/HZ) /* millisec per clock tick */
28 #define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
29
30 /*
31 * Address spaces - only user code!
32 */
33 #define UZERO 0 /* base of user address space */
34 #define UTZERO (UZERO+BY2PG) /* first address in user text */
35 #define USTKTOP (0x10000000) /* byte just beyond user stack */
36 #define USTKSIZE (16*1024*1024) /* size of user stack */
37 #define TSTKTOP (USTKTOP-USTKSIZE) /* end of new stack in sysexec */
38 #define TSTKSIZ 100
39
40 /*
41 * virtual MMU
42 */
43 #define PTEMAPMEM (1024*1024)
44 #define PTEPERTAB (PTEMAPMEM/BY2PG)
45 #define SEGMAPSIZE 1984
46 #define SSEGMAPSIZE 16
47 #define PPN(x) ((x)&~(BY2PG-1))
48
49 /*
50 * physical MMU
51 */
52 #define PTEVALID (1<<0)
53 #define PTEWT (1<<3)
54 #define PTEUNCACHED (1<<4)
55 #define PTEWRITE (1<<1)
56 #define PTERONLY (0<<1)
57 #define PTEKERNEL (0<<2)
58 #define PTEUSER (1<<2)
59 #define PTESIZE (1<<7)
60 #define PTEGLOBAL (1<<8)
61
62 #define getpgcolor(a) 0
63