Changeset 2a2fbc8 in mainline for kernel/arch/ppc32/src/mm/pht.c


Ignore:
Timestamp:
2016-09-01T17:05:13Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
42d08592
Parents:
f126c87 (diff), fb63c06 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jakub/helenos/pt

File:
1 edited

Legend:

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

    rf126c87 r2a2fbc8  
    4949 * @param access   Access mode that caused the fault.
    5050 * @param istate   Pointer to interrupted state.
    51  *
    52  * @return PTE on success, NULL otherwise.
    53  *
    54  */
    55 static pte_t *find_mapping_and_check(as_t *as, uintptr_t badvaddr, int access,
    56     istate_t *istate)
     51 * @param[out] pte Structure that will receive a copy of the found PTE.
     52 *
     53 * @return True if the mapping was found, false otherwise.
     54 *
     55 */
     56static bool find_mapping_and_check(as_t *as, uintptr_t badvaddr, int access,
     57    istate_t *istate, pte_t *pte)
    5758{
    5859        /*
    5960         * Check if the mapping exists in page tables.
    6061         */
    61         pte_t *pte = page_mapping_find(as, badvaddr, true);
    62         if ((pte) && (pte->present)) {
     62        bool found = page_mapping_find(as, badvaddr, true, pte);
     63        if (found && pte->present) {
    6364                /*
    6465                 * Mapping found in page tables.
    6566                 * Immediately succeed.
    6667                 */
    67                 return pte;
     68                return true;
    6869        }
    6970        /*
     
    7677                 * The mapping ought to be in place.
    7778                 */
    78                 pte = page_mapping_find(as, badvaddr, true);
    79                 ASSERT((pte) && (pte->present));
    80                 return pte;
    81         }
    82 
    83         return NULL;
     79                found = page_mapping_find(as, badvaddr, true, pte);
     80
     81                ASSERT(found);
     82                ASSERT(pte->present);
     83
     84                return found;
     85        }
     86
     87        return false;
    8488}
    8589
     
    182186                badvaddr = istate->pc;
    183187       
    184         pte_t *pte = find_mapping_and_check(AS, badvaddr,
    185             PF_ACCESS_READ /* FIXME */, istate);
    186        
    187         if (pte) {
     188        pte_t pte;
     189        bool found = find_mapping_and_check(AS, badvaddr,
     190            PF_ACCESS_READ /* FIXME */, istate, &pte);
     191       
     192        if (found) {
    188193                /* Record access to PTE */
    189                 pte->accessed = 1;
    190                 pht_insert(badvaddr, pte);
     194                pte.accessed = 1;
     195                pht_insert(badvaddr, &pte);
    191196        }
    192197}
Note: See TracChangeset for help on using the changeset viewer.