Changeset 1e241723 in mainline


Ignore:
Timestamp:
2009-01-31T13:45:18Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c19a4169
Parents:
53634f9
Message:

respect stricker lookup algorithm (first look for colliding PTEs, then look for unused PTEs)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/src/mm/tlb.c

    r53634f9 r1e241723  
    157157        bool found = false;
    158158       
    159         /* Find unused or colliding PTE in PTEG */
     159        /* Find colliding PTE in PTEG */
    160160        for (i = 0; i < 8; i++) {
    161                 if ((!phte[base + i].v) ||
    162                     ((phte[base + i].vsid == vsid)
     161                if ((phte[base + i].v)
     162                    && (phte[base + i].vsid == vsid)
    163163                    && (phte[base + i].api == api)
    164                     && (phte[base + i].h == 0))) {
     164                    && (phte[base + i].h == 0)) {
    165165                        found = true;
    166166                        break;
     167                }
     168        }
     169       
     170        if (!found) {
     171                /* Find unused PTE in PTEG */
     172                for (i = 0; i < 8; i++) {
     173                        if (!phte[base + i].v) {
     174                                found = true;
     175                                break;
     176                        }
    167177                }
    168178        }
     
    172182                uint32_t base2 = (~hash & 0x3ff) << 3;
    173183               
    174                 /* Find unused or colliding PTE in PTEG */
     184                /* Find colliding PTE in PTEG */
    175185                for (i = 0; i < 8; i++) {
    176                         if ((!phte[base2 + i].v) ||
    177                             ((phte[base2 + i].vsid == vsid)
     186                        if ((phte[base2 + i].v)
     187                            && (phte[base2 + i].vsid == vsid)
    178188                            && (phte[base2 + i].api == api)
    179                             && (phte[base2 + i].h == 1))) {
     189                            && (phte[base2 + i].h == 1)) {
    180190                                found = true;
    181191                                base = base2;
    182192                                h = 1;
    183193                                break;
     194                        }
     195                }
     196               
     197                if (!found) {
     198                        /* Find unused PTE in PTEG */
     199                        for (i = 0; i < 8; i++) {
     200                                if (!phte[base2 + i].v) {
     201                                        found = true;
     202                                        base = base2;
     203                                        h = 1;
     204                                        break;
     205                                }
    184206                        }
    185207                }
     
    309331        bool found = false;
    310332       
    311         /* Find unused or colliding PTE in PTEG */
     333        /* Find colliding PTE in PTEG */
    312334        for (i = 0; i < 8; i++) {
    313                 if ((!phte_real[base + i].v) ||
    314                     ((phte_real[base + i].vsid == vsid)
     335                if ((phte_real[base + i].v)
     336                    && (phte_real[base + i].vsid == vsid)
    315337                    && (phte_real[base + i].api == api)
    316                     && (phte_real[base + i].h == 0))) {
     338                    && (phte_real[base + i].h == 0)) {
    317339                        found = true;
    318340                        break;
     341                }
     342        }
     343       
     344        if (!found) {
     345                /* Find unused PTE in PTEG */
     346                for (i = 0; i < 8; i++) {
     347                        if (!phte_real[base + i].v) {
     348                                found = true;
     349                                break;
     350                        }
    319351                }
    320352        }
     
    324356                uint32_t base2 = (~hash & 0x3ff) << 3;
    325357               
    326                 /* Find unused or colliding PTE in PTEG */
     358                /* Find colliding PTE in PTEG */
    327359                for (i = 0; i < 8; i++) {
    328                         if ((!phte_real[base2 + i].v) ||
    329                             ((phte_real[base2 + i].vsid == vsid)
     360                        if ((phte_real[base2 + i].v)
     361                            && (phte_real[base2 + i].vsid == vsid)
    330362                            && (phte_real[base2 + i].api == api)
    331                             && (phte_real[base2 + i].h == 1))) {
     363                            && (phte_real[base2 + i].h == 1)) {
    332364                                found = true;
    333365                                base = base2;
    334366                                h = 1;
    335367                                break;
     368                        }
     369                }
     370               
     371                if (!found) {
     372                        /* Find unused PTE in PTEG */
     373                        for (i = 0; i < 8; i++) {
     374                                if (!phte_real[base2 + i].v) {
     375                                        found = true;
     376                                        base = base2;
     377                                        h = 1;
     378                                        break;
     379                                }
    336380                        }
    337381                }
Note: See TracChangeset for help on using the changeset viewer.