Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 8fe2c9bd in mainline


Ignore:
Timestamp:
2013-03-22T12:30:41Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
119b46e
Parents:
89f61be
Message:

Do not pass badvaddr but rather the page address in TLB exceptions.

The unaligned badvaddr was causing problems in connection with the
backend_phys and our mips32 PTE format. The combination resulted in
non-aligned frame addresses in the PTE. This showed, for example, when
loading some tasks from the RAM disk: tasks crashed due to wrongly
loaded sections.

File:
1 edited

Legend:

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

    r89f61be r8fe2c9bd  
    9494        entry_lo_t lo;
    9595        uintptr_t badvaddr;
     96        uintptr_t page;
    9697        pte_t *pte;
    9798       
    9899        badvaddr = cp0_badvaddr_read();
    99 
    100         pte = page_mapping_find(AS, badvaddr, true);
     100        page = ALIGN_DOWN(badvaddr, PAGE_SIZE);
     101
     102        pte = page_mapping_find(AS, page, true);
    101103        if (pte && pte->p) {
    102104                /*
     
    123125        }
    124126
    125         (void) as_page_fault(badvaddr, PF_ACCESS_READ, istate);
     127        (void) as_page_fault(page, PF_ACCESS_READ, istate);
    126128}
    127129
     
    135137        tlb_index_t index;
    136138        uintptr_t badvaddr;
     139        uintptr_t page;
    137140        pte_t *pte;
    138141
     
    158161
    159162        badvaddr = cp0_badvaddr_read();
    160 
    161         pte = page_mapping_find(AS, badvaddr, true);
     163        page = ALIGN_DOWN(badvaddr, PAGE_SIZE);
     164
     165        pte = page_mapping_find(AS, page, true);
    162166        if (pte && pte->p) {
    163167                /*
     
    185189        }
    186190
    187         (void) as_page_fault(badvaddr, PF_ACCESS_READ, istate);
     191        (void) as_page_fault(page, PF_ACCESS_READ, istate);
    188192}
    189193
     
    197201        tlb_index_t index;
    198202        uintptr_t badvaddr;
     203        uintptr_t page;
    199204        pte_t *pte;
    200205
    201206        badvaddr = cp0_badvaddr_read();
     207        page = ALIGN_DOWN(badvaddr, PAGE_SIZE);
    202208
    203209        /*
     
    221227        }
    222228
    223         pte = page_mapping_find(AS, badvaddr, true);
     229        pte = page_mapping_find(AS, page, true);
    224230        if (pte && pte->p && pte->w) {
    225231                /*
     
    248254        }
    249255
    250         (void) as_page_fault(badvaddr, PF_ACCESS_WRITE, istate);
     256        (void) as_page_fault(page, PF_ACCESS_WRITE, istate);
    251257}
    252258
Note: See TracChangeset for help on using the changeset viewer.