Rev 2082 | Rev 3228 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2082 | Rev 2089 | ||
|---|---|---|---|
| Line 34... | Line 34... | ||
| 34 | 34 | ||
| 35 | #ifndef KERN_mips32_TLB_H_ |
35 | #ifndef KERN_mips32_TLB_H_ |
| 36 | #define KERN_mips32_TLB_H_ |
36 | #define KERN_mips32_TLB_H_ |
| 37 | 37 | ||
| 38 | #include <arch/exception.h> |
38 | #include <arch/exception.h> |
| 39 | #include <typedefs.h> |
- | |
| 40 | 39 | ||
| 41 | #ifdef TLBCNT |
40 | #ifdef TLBCNT |
| 42 | # define TLB_ENTRY_COUNT TLBCNT |
41 | # define TLB_ENTRY_COUNT TLBCNT |
| 43 | #else |
42 | #else |
| 44 | # define TLB_ENTRY_COUNT 48 |
43 | # define TLB_ENTRY_COUNT 48 |
| Line 50... | Line 49... | ||
| 50 | #define TLB_PAGE_MASK_16K (0x3<<13) |
49 | #define TLB_PAGE_MASK_16K (0x3<<13) |
| 51 | 50 | ||
| 52 | #define PAGE_UNCACHED 2 |
51 | #define PAGE_UNCACHED 2 |
| 53 | #define PAGE_CACHEABLE_EXC_WRITE 5 |
52 | #define PAGE_CACHEABLE_EXC_WRITE 5 |
| 54 | 53 | ||
| 55 | typedef union entry_lo entry_lo_t; |
- | |
| 56 | typedef union entry_hi entry_hi_t; |
- | |
| 57 | typedef union page_mask page_mask_t; |
- | |
| 58 | typedef union index tlb_index_t; |
54 | typedef union { |
| 59 | - | ||
| 60 | union entry_lo { |
- | |
| 61 | struct { |
55 | struct { |
| 62 | #ifdef BIG_ENDIAN |
56 | #ifdef BIG_ENDIAN |
| 63 | unsigned : 2; /* zero */ |
57 | unsigned : 2; /* zero */ |
| 64 | unsigned pfn : 24; /* frame number */ |
58 | unsigned pfn : 24; /* frame number */ |
| 65 | unsigned c : 3; /* cache coherency attribute */ |
59 | unsigned c : 3; /* cache coherency attribute */ |
| Line 74... | Line 68... | ||
| 74 | unsigned pfn : 24; /* frame number */ |
68 | unsigned pfn : 24; /* frame number */ |
| 75 | unsigned : 2; /* zero */ |
69 | unsigned : 2; /* zero */ |
| 76 | #endif |
70 | #endif |
| 77 | } __attribute__ ((packed)); |
71 | } __attribute__ ((packed)); |
| 78 | uint32_t value; |
72 | uint32_t value; |
| 79 | }; |
- | |
| 80 | - | ||
| 81 | /** Page Table Entry. */ |
- | |
| 82 | struct pte { |
73 | } entry_lo_t; |
| 83 | unsigned g : 1; /**< Global bit. */ |
- | |
| 84 | unsigned p : 1; /**< Present bit. */ |
- | |
| 85 | unsigned d : 1; /**< Dirty bit. */ |
- | |
| 86 | unsigned cacheable : 1; /**< Cacheable bit. */ |
- | |
| 87 | unsigned : 1; /**< Unused. */ |
- | |
| 88 | unsigned soft_valid : 1; /**< Valid content even if not present. */ |
- | |
| 89 | unsigned pfn : 24; /**< Physical frame number. */ |
- | |
| 90 | unsigned w : 1; /**< Page writable bit. */ |
- | |
| 91 | unsigned a : 1; /**< Accessed bit. */ |
- | |
| 92 | }; |
- | |
| 93 | 74 | ||
| 94 | union entry_hi { |
75 | typedef union { |
| 95 | struct { |
76 | struct { |
| 96 | #ifdef BIG_ENDIAN |
77 | #ifdef BIG_ENDIAN |
| 97 | unsigned vpn2 : 19; |
78 | unsigned vpn2 : 19; |
| 98 | unsigned : 5; |
79 | unsigned : 5; |
| 99 | unsigned asid : 8; |
80 | unsigned asid : 8; |
| Line 102... | Line 83... | ||
| 102 | unsigned : 5; |
83 | unsigned : 5; |
| 103 | unsigned vpn2 : 19; |
84 | unsigned vpn2 : 19; |
| 104 | #endif |
85 | #endif |
| 105 | } __attribute__ ((packed)); |
86 | } __attribute__ ((packed)); |
| 106 | uint32_t value; |
87 | uint32_t value; |
| 107 | }; |
88 | } entry_hi_t; |
| 108 | 89 | ||
| 109 | union page_mask { |
90 | typedef union { |
| 110 | struct { |
91 | struct { |
| 111 | #ifdef BIG_ENDIAN |
92 | #ifdef BIG_ENDIAN |
| 112 | unsigned : 7; |
93 | unsigned : 7; |
| 113 | unsigned mask : 12; |
94 | unsigned mask : 12; |
| 114 | unsigned : 13; |
95 | unsigned : 13; |
| Line 117... | Line 98... | ||
| 117 | unsigned mask : 12; |
98 | unsigned mask : 12; |
| 118 | unsigned : 7; |
99 | unsigned : 7; |
| 119 | #endif |
100 | #endif |
| 120 | } __attribute__ ((packed)); |
101 | } __attribute__ ((packed)); |
| 121 | uint32_t value; |
102 | uint32_t value; |
| 122 | }; |
103 | } page_mask_t; |
| 123 | 104 | ||
| 124 | union index { |
105 | typedef union { |
| 125 | struct { |
106 | struct { |
| 126 | #ifdef BIG_ENDIAN |
107 | #ifdef BIG_ENDIAN |
| 127 | unsigned p : 1; |
108 | unsigned p : 1; |
| 128 | unsigned : 27; |
109 | unsigned : 27; |
| 129 | unsigned index : 4; |
110 | unsigned index : 4; |
| Line 132... | Line 113... | ||
| 132 | unsigned : 27; |
113 | unsigned : 27; |
| 133 | unsigned p : 1; |
114 | unsigned p : 1; |
| 134 | #endif |
115 | #endif |
| 135 | } __attribute__ ((packed)); |
116 | } __attribute__ ((packed)); |
| 136 | uint32_t value; |
117 | uint32_t value; |
| 137 | }; |
118 | } tlb_index_t; |
| 138 | 119 | ||
| 139 | /** Probe TLB for Matching Entry |
120 | /** Probe TLB for Matching Entry |
| 140 | * |
121 | * |
| 141 | * Probe TLB for Matching Entry. |
122 | * Probe TLB for Matching Entry. |
| 142 | */ |
123 | */ |