/* * Memory and machine-specific definitions. Used in C and assembler. */ /* * Sizes */ #define BI2BY 8 /* bits per byte */ #define BI2WD 32 /* bits per word */ #define BY2WD 4 /* bytes per word */ #define BY2V 8 /* bytes per double word */ #define BY2PG 4096 /* bytes per page */ #define WD2PG (BY2PG/BY2WD) /* words per page */ #define PGSHIFT 12 /* log(BY2PG) */ #define ROUND(s, sz) (((s)+((sz)-1))&~((sz)-1)) #define PGROUND(s) ROUND(s, BY2PG) #define CACHELINELOG 4 #define CACHELINESZ (1< */ #define USER 29 /* R29 is up-> */ /* * virtual MMU */ #define PTEMAPMEM (1024*1024) #define PTEPERTAB (PTEMAPMEM/BY2PG) #define SEGMAPSIZE 1984 #define SSEGMAPSIZE 16 #define PPN(x) ((x)&~(BY2PG-1)) /* * Fundamental addresses */ #define MACHADDR (KTZERO-MAXMACH*MACHSIZE) #define MACHP(n) ((Mach *)(MACHADDR+(n)*MACHSIZE)) #define UREGSIZE ((8+32)*4) /* * MMU */ /* L1 table entry and Mx_TWC flags */ #define PTEWT (1<<1) /* write through */ #define PTE4K (0<<2) #define PTE512K (1<<2) #define PTE8MB (3<<2) #define PTEG (1<<4) /* guarded */ /* L2 table entry and Mx_RPN flags (also PTEVALID) */ #define PTECI (1<<1) /* cache inhibit */ #define PTESH (1<<2) /* page is shared; ASID ignored */ #define PTELPS (1<<3) /* large page size */ #define PTEKERNEL (0<<2) #define PTEUSER (1<<2) #define PTESIZE (1<<7) #define NTLBPID 16 #define TLBPID(n) ((n)&(NTLBPID-1)) /* soft tlb */ #define STLBLOG 12 #define STLBSIZE (1<