Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3839 → Rev 3838

/trunk/kernel/arch/ppc32/src/mm/tlb.c
156,12 → 156,12
uint32_t i;
bool found = false;
/* Find colliding PTE in PTEG */
/* Find unused or colliding PTE in PTEG */
for (i = 0; i < 8; i++) {
if ((phte[base + i].v)
&& (phte[base + i].vsid == vsid)
if ((!phte[base + i].v) ||
((phte[base + i].vsid == vsid)
&& (phte[base + i].api == api)
&& (phte[base + i].h == 0)) {
&& (phte[base + i].h == 0))) {
found = true;
break;
}
168,25 → 168,15
}
if (!found) {
/* Find unused PTE in PTEG */
for (i = 0; i < 8; i++) {
if (!phte[base + i].v) {
found = true;
break;
}
}
}
if (!found) {
/* Secondary hash (not) */
uint32_t base2 = (~hash & 0x3ff) << 3;
/* Find colliding PTE in PTEG */
/* Find unused or colliding PTE in PTEG */
for (i = 0; i < 8; i++) {
if ((phte[base2 + i].v)
&& (phte[base2 + i].vsid == vsid)
if ((!phte[base2 + i].v) ||
((phte[base2 + i].vsid == vsid)
&& (phte[base2 + i].api == api)
&& (phte[base2 + i].h == 1)) {
&& (phte[base2 + i].h == 1))) {
found = true;
base = base2;
h = 1;
194,18 → 184,6
}
}
if (!found) {
/* Find unused PTE in PTEG */
for (i = 0; i < 8; i++) {
if (!phte[base2 + i].v) {
found = true;
base = base2;
h = 1;
break;
}
}
}
if (!found)
i = RANDI(seed) % 8;
}
330,12 → 308,12
uint32_t i;
bool found = false;
/* Find colliding PTE in PTEG */
/* Find unused or colliding PTE in PTEG */
for (i = 0; i < 8; i++) {
if ((phte_real[base + i].v)
&& (phte_real[base + i].vsid == vsid)
if ((!phte_real[base + i].v) ||
((phte_real[base + i].vsid == vsid)
&& (phte_real[base + i].api == api)
&& (phte_real[base + i].h == 0)) {
&& (phte_real[base + i].h == 0))) {
found = true;
break;
}
342,25 → 320,15
}
if (!found) {
/* Find unused PTE in PTEG */
for (i = 0; i < 8; i++) {
if (!phte_real[base + i].v) {
found = true;
break;
}
}
}
if (!found) {
/* Secondary hash (not) */
uint32_t base2 = (~hash & 0x3ff) << 3;
/* Find colliding PTE in PTEG */
/* Find unused or colliding PTE in PTEG */
for (i = 0; i < 8; i++) {
if ((phte_real[base2 + i].v)
&& (phte_real[base2 + i].vsid == vsid)
if ((!phte_real[base2 + i].v) ||
((phte_real[base2 + i].vsid == vsid)
&& (phte_real[base2 + i].api == api)
&& (phte_real[base2 + i].h == 1)) {
&& (phte_real[base2 + i].h == 1))) {
found = true;
base = base2;
h = 1;
369,18 → 337,6
}
if (!found) {
/* Find unused PTE in PTEG */
for (i = 0; i < 8; i++) {
if (!phte_real[base2 + i].v) {
found = true;
base = base2;
h = 1;
break;
}
}
}
if (!found) {
/* Use secondary hash to avoid collisions
with usual PHT refill handler. */
i = RANDI(seed_real) % 8;