Changeset 38a1a84 in mainline for arch/mips32/include


Ignore:
Timestamp:
2005-10-05T21:29:16Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bca1b47
Parents:
49c1f93
Message:

MIPS32 memory management work.
Fix some bugs introduced yesterday (PTL3 index is indeed calculated by >> 14).
Introduce two new bits in pte_t (i.e. 'a' and 'w').
Implement TLB Invalid Exception and TLB Modified Exception. (Needs review and testing)

Location:
arch/mips32/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • arch/mips32/include/mm/page.h

    r49c1f93 r38a1a84  
    4747 * - 32-bit virtual addresses
    4848 * - Offset is 14 bits => pages are 16K long
    49  * - PTE's use the same format as CP0 EntryLo[01] registers => PTE is therefore 4 bytes long
     49 * - PTE's use similar format as CP0 EntryLo[01] registers => PTE is therefore 4 bytes long
     50 * - PTE's make use of CP0 EntryLo's two-bit reserved field for bit W (writable) and bit A (accessed)
    5051 * - PTL0 has 64 entries (6 bits)
    5152 * - PTL1 is not used
     
    5758#define PTL1_INDEX_ARCH(vaddr)  0
    5859#define PTL2_INDEX_ARCH(vaddr)  0
    59 #define PTL3_INDEX_ARCH(vaddr)  (((vaddr)>>12)&0xfff)
     60#define PTL3_INDEX_ARCH(vaddr)  (((vaddr)>>14)&0x3fff)
    6061
    6162#define GET_PTL0_ADDRESS_ARCH()                 (PTL0)
     
    9899                (1<<PAGE_USER_SHIFT) |
    99100                (1<<PAGE_READ_SHIFT) |
    100                 ((p->d)<<PAGE_WRITE_SHIFT) |
     101                ((p->w)<<PAGE_WRITE_SHIFT) |
    101102                (1<<PAGE_EXEC_SHIFT)
    102103        );
     
    110111        p->c = (flags & PAGE_CACHEABLE) != 0 ? PAGE_CACHEABLE_EXC_WRITE : PAGE_UNCACHED;
    111112        p->v = !(flags & PAGE_NOT_PRESENT);
    112         p->d = (flags & PAGE_WRITE) != 0;
     113        p->w = (flags & PAGE_WRITE) != 0;
    113114}
    114115
  • arch/mips32/include/mm/tlb.h

    r49c1f93 r38a1a84  
    4848        unsigned c : 3;         /* cache coherency attribute */
    4949        unsigned pfn : 24;      /* frame number */
    50         unsigned : 2;
     50        unsigned zero: 2;       /* zero */
     51} __attribute__ ((packed));
     52
     53struct pte {
     54        unsigned g : 1;         /* global bit */
     55        unsigned v : 1;         /* valid bit */
     56        unsigned d : 1;         /* dirty/write-protect bit */
     57        unsigned c : 3;         /* cache coherency attribute */
     58        unsigned pfn : 24;      /* frame number */
     59        unsigned w : 1;         /* writable */
     60        unsigned a : 1;         /* accessed */
    5161} __attribute__ ((packed));
    5262
     
    6373} __attribute__ ((packed));
    6474
    65 struct tlb_entry {
    66         struct entry_lo lo0;
    67         struct entry_lo lo1;
    68         struct entry_hi hi;
    69         struct page_mask mask;
     75struct index {
     76        unsigned index : 4;
     77        unsigned : 27;
     78        unsigned p : 1;
    7079} __attribute__ ((packed));
     80
     81/** Probe TLB for Matching Entry
     82 *
     83 * Probe TLB for Matching Entry.
     84 */
     85static inline void tlbp(void)
     86{
     87        __asm__ volatile ("tlbp\n\t");
     88}
    7189
    7290
  • arch/mips32/include/types.h

    r49c1f93 r38a1a84  
    5050typedef __u32 __native;
    5151
    52 typedef struct entry_lo pte_t;
     52typedef struct pte pte_t;
    5353
    5454#endif
Note: See TracChangeset for help on using the changeset viewer.