/* * Memory and machine-specific definitions. Used in C and assembler. */ #define KiB 1024u /* Kibi 0x0000000000000400 */ #define MiB 1048576u /* Mebi 0x0000000000100000 */ #define GiB 1073741824u /* Gibi 000000000040000000 */ #define TiB 1099511627776ull /* Tebi 0x0000010000000000 */ #define PiB 1125899906842624ull /* Pebi 0x0004000000000000 */ #define EiB 1152921504606846976ull /* Exbi 0x1000000000000000 */ /* * Sizes */ #define BI2BY 8 /* bits per byte */ #define BI2WD 32 /* bits per word */ #define BY2WD 4 /* bytes per word */ #define BY2V 8 /* bytes per vlong */ #define BY2SE 4 /* bytes per stack element */ #define BY2PG 4096 /* bytes per page */ #define PGSHIFT 12 /* log(BY2PG) */ #define STACKALIGN(sp) ((sp) & ~7) /* bug: assure with alloc */ #define BY2PTE 8 /* bytes per pte entry */ #define BY2PTEG 64 /* bytes per pte group */ #define ICACHESIZE 16384 /* 0, 4, 8, 16, or 32 KB */ #define ICACHEWAYSIZE (ICACHESIZE/2) /* 2-way set associative */ #define ICACHELINELOG 5 /* 8 words (4 bytes) per line */ #define ICACHELINESZ (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)) #define PTEVALID (1<<0) #define PTEWRITE (1<<1) #define PTERONLY (0<<1) #define PTEUNCACHED (1<<2) /* * Physical MMU */ #define NTLB 64 /* number of entries */ #define NTLBPID 256 /* number of hardware pids (0 = global) */ /* TLBHI */ #define TLBEPN(x) ((x) & ~0x3FF) #define TLB1K (0<<7) #define TLB4K (1<<7) #define TLB16K (2<<7) #define TLB64K (3<<7) #define TLB256K (4<<7) #define TLB1MB (5<<7) #define TLB4MB (6<<7) #define TLB16MB (7<<7) #define TLBVALID (1<<6) #define TLBLE (1<<5) /* little-endian */ #define TLBU0 (1<<4) /* user-defined attribute */ /* TLBLO */ #define TLBRPN(x) ((x) & ~0x3FF) #define TLBEX (1<<9) /* execute enable */ #define TLBWR (1<<8) /* write enable */ #define TLBZONE(x) ((x)<<4) #define TLBW (1<<3) /* write-through */ #define TLBI (1<<2) /* cache inhibit */ #define TLBM (1<<1) /* memory coherent */ /* * WARNING: applying TLBG to instruction pages will cause ISI traps * on Xilinx 405s, despite the words of the Xilinx manual (p. 155). */ #define TLBG (1<<0) /* guarded */ /* * software TLB (for quick reload by [id]tlbmiss) */ #define STLBLOG 10 #define STLBSIZE (1<