Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/mm/page_pt.c

    r15187c3 ref9a2a8  
    7777    unsigned int flags)
    7878{
     79        //printf("pt_mapping_insert: as=%p, page=0x%08x, frame=0x%08x\n", as, page, frame);
     80
    7981        pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
    8082
     83        //printf("ptl0 = %p\n", ptl0);
     84
    8185        ASSERT(page_table_locked(as));
    82        
     86
    8387        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
     88        //      printf("allocating ptl1\n");
     89
    8490                pte_t *newpt = (pte_t *) frame_alloc(PTL1_SIZE,
    8591                    FRAME_LOWMEM | FRAME_KA);
     92
     93        //      printf("newpt = %p, index = %d\n", newpt, PTL0_INDEX(page));
     94
    8695                memsetb(newpt, FRAME_SIZE << PTL1_SIZE, 0);
    8796                SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt));
     
    100109        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    101110       
     111//      printf("ptl1 = %p\n", ptl1);
     112
    102113        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
     114//              printf("allocating ptl2\n");
     115
    103116                pte_t *newpt = (pte_t *) frame_alloc(PTL2_SIZE,
    104117                    FRAME_LOWMEM | FRAME_KA);
     118
     119//              printf("newpt = %p, index = %d\n", newpt, PTL1_INDEX(page));
     120
    105121                memsetb(newpt, FRAME_SIZE << PTL2_SIZE, 0);
    106122                SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt));
     
    112128                 */
    113129                write_barrier();
    114                 SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page));
     130                SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page));       
    115131        }
    116132       
    117133        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    118134       
     135//      printf("ptl2 = %p\n", ptl2);
     136
    119137        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
     138//              printf("allocating ptl3\n");
     139
    120140                pte_t *newpt = (pte_t *) frame_alloc(PTL3_SIZE,
    121141                    FRAME_LOWMEM | FRAME_KA);
     142
     143//              printf("newpt = %p, index = %d\n", newpt, PTL2_INDEX(page));
     144
    122145                memsetb(newpt, FRAME_SIZE << PTL3_SIZE, 0);
    123146                SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt));
     
    134157        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
    135158       
     159//      printf("ptl3 = %p\n", ptl3);
     160
    136161        SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame);
    137162        SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags | PAGE_NOT_PRESENT);
     
    180205         * Destroy the mapping.
    181206         * Setting to PAGE_NOT_PRESENT is not sufficient.
    182          * But we need SET_FRAME for possible PT coherence maintenance.
    183          * At least on ARM.
    184          */
    185         //TODO: Fix this inconsistency
    186         SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), PAGE_NOT_PRESENT);
     207         */
    187208        memsetb(&ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0);
    188209       
Note: See TracChangeset for help on using the changeset viewer.