Changeset c7ec94a4 in mainline for arch/ia64/src/mm/page.c


Ignore:
Timestamp:
2006-02-06T14:18:28Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f5935ed
Parents:
214f5bb
Message:

Page hash table architectures now use generic hash table to manage
mappings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/ia64/src/mm/page.c

    r214f5bb rc7ec94a4  
    4343#include <memstr.h>
    4444
    45 static void set_vhpt_environment(void);
     45static void set_environment(void);
    4646
    4747/** Initialize ia64 virtual address translation subsystem. */
     
    5050        page_operations = &page_ht_operations;
    5151        pk_disable();
    52         set_vhpt_environment();
     52        set_environment();
    5353}
    5454
    5555/** Initialize VHPT and region registers. */
    56 void set_vhpt_environment(void)
     56void set_environment(void)
    5757{
    5858        region_register rr;
     
    8888
    8989        /*
    90          * Allocate VHPT and invalidate all its entries.
    91          */
    92         page_ht = (pte_t *) frame_alloc(VHPT_WIDTH - FRAME_WIDTH, FRAME_KA);
    93         memsetb((__address) page_ht, VHPT_SIZE, 0);
    94         ht_invalidate_all();   
    95        
    96         /*
    9790         * Set up PTA register.
    9891         */
     
    10194        pta.map.vf = 1;                   /* large entry format */
    10295        pta.map.size = VHPT_WIDTH;
    103         pta.map.base = ((__address) page_ht) >> PTA_BASE_SHIFT;
     96        pta.map.base = VHPT_BASE >> PTA_BASE_SHIFT;
    10497        pta_write(pta.word);
    10598        srlz_i();
     
    114107 * @param asid Address space identifier.
    115108 *
    116  * @return Head of VHPT collision chain for page and asid.
    117  */
    118 pte_t *vhpt_hash(__address page, asid_t asid)
     109 * @return VHPT entry address.
     110 */
     111vhpt_entry_t *vhpt_hash(__address page, asid_t asid)
    119112{
    120113        region_register rr_save, rr;
    121114        index_t vrn;
    122115        rid_t rid;
    123         pte_t *t;
     116        vhpt_entry_t *v;
    124117
    125118        vrn = page >> VRN_SHIFT;
     
    131124                 * The RID is already in place, compute thash and return.
    132125                 */
    133                 t = (pte_t *) thash(page);
    134                 return t;
     126                v = (vhpt_entry_t *) thash(page);
     127                return v;
    135128        }
    136129       
     
    143136        rr_write(vrn, rr.word);
    144137        srlz_i();
    145         t = (pte_t *) thash(page);
     138        v = (vhpt_entry_t *) thash(page);
    146139        rr_write(vrn, rr_save.word);
    147140        srlz_i();
    148141        srlz_d();
    149142
    150         return t;
     143        return v;
    151144}
    152145
     
    160153 * @return True if page and asid match the page and asid of t, false otherwise.
    161154 */
    162 bool vhpt_compare(__address page, asid_t asid, pte_t *t)
     155bool vhpt_compare(__address page, asid_t asid, vhpt_entry_t *v)
    163156{
    164157        region_register rr_save, rr;   
     
    167160        bool match;
    168161
    169         ASSERT(t);
     162        ASSERT(v);
    170163
    171164        vrn = page >> VRN_SHIFT;
     
    177170                 * The RID is already in place, compare ttag with t and return.
    178171                 */
    179                 return ttag(page) == t->present.tag.tag_word;
     172                return ttag(page) == v->present.tag.tag_word;
    180173        }
    181174       
     
    188181        rr_write(vrn, rr.word);
    189182        srlz_i();
    190         match = (ttag(page) == t->present.tag.tag_word);
     183        match = (ttag(page) == v->present.tag.tag_word);
    191184        rr_write(vrn, rr_save.word);
    192185        srlz_i();
     
    204197 * @param flags Different flags for the mapping.
    205198 */
    206 void vhpt_set_record(pte_t *t, __address page, asid_t asid, __address frame, int flags)
     199void vhpt_set_record(vhpt_entry_t *v, __address page, asid_t asid, __address frame, int flags)
    207200{
    208201        region_register rr_save, rr;   
     
    211204        __u64 tag;
    212205
    213         ASSERT(t);
     206        ASSERT(v);
    214207
    215208        vrn = page >> VRN_SHIFT;
     
    232225         * Clear the entry.
    233226         */
    234         t->word[0] = 0;
    235         t->word[1] = 0;
    236         t->word[2] = 0;
    237         t->word[3] = 0;
    238        
    239         t->present.p = true;
    240         t->present.ma = (flags & PAGE_CACHEABLE) ? MA_WRITEBACK : MA_UNCACHEABLE;
    241         t->present.a = false;   /* not accessed */
    242         t->present.d = false;   /* not dirty */
    243         t->present.pl = (flags & PAGE_USER) ? PL_USER : PL_KERNEL;
    244         t->present.ar = (flags & PAGE_WRITE) ? AR_WRITE : AR_READ;
    245         t->present.ar |= (flags & PAGE_EXEC) ? AR_EXECUTE : 0;
    246         t->present.ppn = frame >> PPN_SHIFT;
    247         t->present.ed = false;  /* exception not deffered */
    248         t->present.ps = PAGE_WIDTH;
    249         t->present.key = 0;
    250         t->present.tag.tag_word = tag;
    251         t->present.next = NULL;
    252 }
     227        v->word[0] = 0;
     228        v->word[1] = 0;
     229        v->word[2] = 0;
     230        v->word[3] = 0;
     231       
     232        v->present.p = true;
     233        v->present.ma = (flags & PAGE_CACHEABLE) ? MA_WRITEBACK : MA_UNCACHEABLE;
     234        v->present.a = false;   /* not accessed */
     235        v->present.d = false;   /* not dirty */
     236        v->present.pl = (flags & PAGE_USER) ? PL_USER : PL_KERNEL;
     237        v->present.ar = (flags & PAGE_WRITE) ? AR_WRITE : AR_READ;
     238        v->present.ar |= (flags & PAGE_EXEC) ? AR_EXECUTE : 0;
     239        v->present.ppn = frame >> PPN_SHIFT;
     240        v->present.ed = false;  /* exception not deffered */
     241        v->present.ps = PAGE_WIDTH;
     242        v->present.key = 0;
     243        v->present.tag.tag_word = tag;
     244}
Note: See TracChangeset for help on using the changeset viewer.