Rev 3833 | Rev 3837 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3833 | Rev 3836 | ||
|---|---|---|---|
| Line 149... | Line 149... | ||
| 149 | uint32_t hash = vsid ^ page; |
149 | uint32_t hash = vsid ^ page; |
| 150 | uint32_t base = (hash & 0x3ff) << 3; |
150 | uint32_t base = (hash & 0x3ff) << 3; |
| 151 | uint32_t i; |
151 | uint32_t i; |
| 152 | bool found = false; |
152 | bool found = false; |
| 153 | 153 | ||
| 154 | /* Find unused or colliding |
154 | /* Find unused or colliding PTE in PTEG */ |
| 155 | PTE in PTEG */ |
- | |
| 156 | for (i = 0; i < 8; i++) { |
155 | for (i = 0; i < 8; i++) { |
| - | 156 | if ((!phte[base + i].v) || |
|
| 157 | if ((!phte[base + i].v) || ((phte[base + i].vsid == vsid) && |
157 | ((phte[base + i].vsid == vsid) |
| 158 | (phte[base + i].api == api))) { |
158 | && (phte[base + i].api == api) |
| - | 159 | && (phte[base + i].h == 0))) { |
|
| 159 | found = true; |
160 | found = true; |
| 160 | break; |
161 | break; |
| 161 | } |
162 | } |
| 162 | } |
163 | } |
| 163 | 164 | ||
| 164 | if (!found) { |
165 | if (!found) { |
| 165 | /* Secondary hash (not) */ |
166 | /* Secondary hash (not) */ |
| 166 | uint32_t base2 = (~hash & 0x3ff) << 3; |
167 | uint32_t base2 = (~hash & 0x3ff) << 3; |
| 167 | 168 | ||
| 168 | /* Find unused or colliding |
169 | /* Find unused or colliding PTE in PTEG */ |
| 169 | PTE in PTEG */ |
- | |
| 170 | for (i = 0; i < 8; i++) { |
170 | for (i = 0; i < 8; i++) { |
| 171 | if ((!phte[base2 + i].v) || |
171 | if ((!phte[base2 + i].v) || |
| 172 | ((phte[base2 + i].vsid == vsid) && |
172 | ((phte[base2 + i].vsid == vsid) |
| 173 | (phte[base2 + i].api == api))) { |
173 | && (phte[base2 + i].api == api) |
| - | 174 | && (phte[base2 + i].h == 1))) { |
|
| 174 | found = true; |
175 | found = true; |
| 175 | base = base2; |
176 | base = base2; |
| 176 | h = 1; |
177 | h = 1; |
| 177 | break; |
178 | break; |
| 178 | } |
179 | } |
| 179 | } |
180 | } |
| 180 | 181 | ||
| 181 | if (!found) { |
182 | if (!found) |
| 182 | // TODO: A/C precedence groups |
- | |
| 183 | i = page % 8; |
183 | i = page % 8; |
| 184 | } |
- | |
| 185 | } |
184 | } |
| 186 | 185 | ||
| - | 186 | ||
| - | 187 | ||
| 187 | phte[base + i].v = 1; |
188 | phte[base + i].v = 1; |
| 188 | phte[base + i].vsid = vsid; |
189 | phte[base + i].vsid = vsid; |
| 189 | phte[base + i].h = h; |
190 | phte[base + i].h = h; |
| 190 | phte[base + i].api = api; |
191 | phte[base + i].api = api; |
| 191 | phte[base + i].rpn = pte->pfn; |
192 | phte[base + i].rpn = pte->pfn; |
| Line 220... | Line 221... | ||
| 220 | uint32_t hash = vsid ^ page; |
221 | uint32_t hash = vsid ^ page; |
| 221 | uint32_t base = (hash & 0x3ff) << 3; |
222 | uint32_t base = (hash & 0x3ff) << 3; |
| 222 | uint32_t i; |
223 | uint32_t i; |
| 223 | bool found = false; |
224 | bool found = false; |
| 224 | 225 | ||
| 225 | /* Find unused or colliding |
226 | /* Find unused or colliding PTE in PTEG */ |
| 226 | PTE in PTEG */ |
- | |
| 227 | for (i = 0; i < 8; i++) { |
227 | for (i = 0; i < 8; i++) { |
| 228 | if ((!phte_physical[base + i].v) || |
228 | if ((!phte_physical[base + i].v) || |
| 229 | ((phte_physical[base + i].vsid == vsid) && |
229 | ((phte_physical[base + i].vsid == vsid) |
| 230 | (phte_physical[base + i].api == api))) { |
230 | && (phte_physical[base + i].api == api) |
| - | 231 | && (phte_physical[base + i].h == 0))) { |
|
| 231 | found = true; |
232 | found = true; |
| 232 | break; |
233 | break; |
| 233 | } |
234 | } |
| 234 | } |
235 | } |
| 235 | 236 | ||
| 236 | if (!found) { |
237 | if (!found) { |
| 237 | /* Secondary hash (not) */ |
238 | /* Secondary hash (not) */ |
| 238 | uint32_t base2 = (~hash & 0x3ff) << 3; |
239 | uint32_t base2 = (~hash & 0x3ff) << 3; |
| 239 | 240 | ||
| 240 | /* Find unused or colliding |
241 | /* Find unused or colliding PTE in PTEG */ |
| 241 | PTE in PTEG */ |
- | |
| 242 | for (i = 0; i < 8; i++) { |
242 | for (i = 0; i < 8; i++) { |
| 243 | if ((!phte_physical[base2 + i].v) || |
243 | if ((!phte_physical[base2 + i].v) || |
| 244 | ((phte_physical[base2 + i].vsid == vsid) && |
244 | ((phte_physical[base2 + i].vsid == vsid) |
| 245 | (phte_physical[base2 + i].api == api))) { |
245 | && (phte_physical[base2 + i].api == api) |
| - | 246 | && (phte_physical[base2 + i].h == 1))) { |
|
| 246 | found = true; |
247 | found = true; |
| 247 | base = base2; |
248 | base = base2; |
| 248 | h = 1; |
249 | h = 1; |
| 249 | break; |
250 | break; |
| 250 | } |
251 | } |
| 251 | } |
252 | } |
| 252 | 253 | ||
| 253 | if (!found) { |
254 | if (!found) { |
| 254 | // TODO: A/C precedence groups |
- | |
| 255 | i = page % 8; |
255 | i = page % 8; |
| - | 256 | base = base2; |
|
| - | 257 | h = 1; |
|
| 256 | } |
258 | } |
| 257 | } |
259 | } |
| 258 | 260 | ||
| 259 | phte_physical[base + i].v = 1; |
261 | phte_physical[base + i].v = 1; |
| 260 | phte_physical[base + i].vsid = vsid; |
262 | phte_physical[base + i].vsid = vsid; |