Changeset 43d6401 in mainline


Ignore:
Timestamp:
2009-01-29T18:24:40Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
917c427
Parents:
f817d3a
Message:

ppc32: add support for cache disable page access control

Location:
kernel/arch/ppc32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/include/mm/page.h

    rf817d3a r43d6401  
    121121/* Macros for querying the last-level PTEs. */
    122122#define PTE_VALID_ARCH(pte)                     (*((uint32_t *) (pte)) != 0)
    123 #define PTE_PRESENT_ARCH(pte)                   ((pte)->p != 0)
     123#define PTE_PRESENT_ARCH(pte)                   ((pte)->present != 0)
    124124#define PTE_GET_FRAME_ARCH(pte)                 ((pte)->pfn << 12)
    125125#define PTE_WRITABLE_ARCH(pte)                  1
     
    135135        pte_t *p = &pt[i];
    136136       
    137         return ((1 << PAGE_CACHEABLE_SHIFT) |
    138             ((!p->p) << PAGE_PRESENT_SHIFT) |
     137        return (((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
     138            ((!p->present) << PAGE_PRESENT_SHIFT) |
    139139            (1 << PAGE_USER_SHIFT) |
    140140            (1 << PAGE_READ_SHIFT) |
    141141            (1 << PAGE_WRITE_SHIFT) |
    142142            (1 << PAGE_EXEC_SHIFT) |
    143             (p->g << PAGE_GLOBAL_SHIFT));
     143            (p->global << PAGE_GLOBAL_SHIFT));
    144144}
    145145
     
    148148        pte_t *p = &pt[i];
    149149       
    150         p->p = !(flags & PAGE_NOT_PRESENT);
    151         p->g = (flags & PAGE_GLOBAL) != 0;
     150        p->page_cache_disable = !(flags & PAGE_CACHEABLE);
     151        p->present = !(flags & PAGE_NOT_PRESENT);
     152        p->global = (flags & PAGE_GLOBAL) != 0;
    152153        p->valid = 1;
    153154}
  • kernel/arch/ppc32/include/mm/tlb.h

    rf817d3a r43d6401  
    4040#include <typedefs.h>
    4141
     42#define WIMG_GUARDED    0x01
     43#define WIMG_COHERENT   0x02
     44#define WIMG_NO_CACHE   0x04
     45#define WIMG_WRITETHRU  0x08
     46
    4247typedef struct {
    4348        unsigned v : 1;          /**< Valid */
  • kernel/arch/ppc32/include/types.h

    rf817d3a r43d6401  
    8585/** Page Table Entry. */
    8686typedef struct {
    87         unsigned p : 1;       /**< Present bit. */
    88         unsigned a : 1;       /**< Accessed bit. */
    89         unsigned g : 1;       /**< Global bit. */
    90         unsigned valid : 1;   /**< Valid content even if not present. */
    91         unsigned pfn : 20;    /**< Physical frame number. */
     87        unsigned present : 1;             /**< Present bit. */
     88        unsigned page_write_through : 1;  /**< Write thought caching. */
     89        unsigned page_cache_disable : 1;  /**< No caching. */
     90        unsigned accessed : 1;            /**< Accessed bit. */
     91        unsigned global : 1;              /**< Global bit. */
     92        unsigned valid : 1;               /**< Valid content even if not present. */
     93        unsigned pfn : 20;                /**< Physical frame number. */
    9294} pte_t;
    9395
  • kernel/arch/ppc32/src/mm/tlb.c

    rf817d3a r43d6401  
    6767         */     
    6868        pte_t *pte = page_mapping_find(as, badvaddr);
    69         if ((pte) && (pte->p)) {
     69        if ((pte) && (pte->present)) {
    7070                /*
    7171                 * Mapping found in page tables.
     
    8989                        page_table_lock(as, lock);
    9090                        pte = page_mapping_find(as, badvaddr);
    91                         ASSERT((pte) && (pte->p));
     91                        ASSERT((pte) && (pte->present));
    9292                        *pfrc = 0;
    9393                        return pte;
     
    127127
    128128
    129 static void pht_insert(const uintptr_t vaddr, const pfn_t pfn)
     129static void pht_insert(const uintptr_t vaddr, const pte_t *pte)
    130130{
    131131        uint32_t page = (vaddr >> 12) & 0xffff;
     
    190190        phte[base + i].h = h;
    191191        phte[base + i].api = api;
    192         phte[base + i].rpn = pfn;
     192        phte[base + i].rpn = pte->pfn;
    193193        phte[base + i].r = 0;
    194194        phte[base + i].c = 0;
     195        phte[base + i].wimg = (pte->page_cache_disable ? WIMG_NO_CACHE : 0);
    195196        phte[base + i].pp = 2; // FIXME
    196197}
     
    264265        phte_physical[base + i].r = 0;
    265266        phte_physical[base + i].c = 0;
     267        phte_physical[base + i].wimg = 0;
    266268        phte_physical[base + i].pp = 2; // FIXME
    267269}
     
    319321        }
    320322       
    321         pte->a = 1; /* Record access to PTE */
    322         pht_insert(badvaddr, pte->pfn);
     323        pte->accessed = 1; /* Record access to PTE */
     324        pht_insert(badvaddr, pte);
    323325       
    324326        page_table_unlock(as, lock);
Note: See TracChangeset for help on using the changeset viewer.