Changeset 849386a in mainline


Ignore:
Timestamp:
2006-01-27T16:23:40Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
457d18a
Parents:
c2b95d3
Message:

First HT_HASH_ARCH implementation for ia64.

Location:
arch/ia64
Files:
2 edited

Legend:

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

    rc2b95d3 r849386a  
    4747
    4848/** Implementation of page hash table interface. */
    49 #define HT_ENTRIES_ARCH                 0
    50 #define HT_HASH_ARCH(page, asid)        0
     49#define HT_ENTRIES_ARCH                 (VHPT_SIZE/sizeof(pte_t))
     50#define HT_HASH_ARCH(page, asid)        vhpt_hash((page), (asid))
    5151#define HT_COMPARE_ARCH(page, asid, t)  0
    5252#define HT_SLOT_EMPTY_ARCH(t)           1
     
    5656#define HT_SET_RECORD_ARCH(t, page, asid, frame, flags)
    5757
     58#define VRN_SHIFT                       61
     59#define VRN_MASK                        (7LL << VRN_SHIFT)
     60
    5861#define VRN_KERNEL                      0
     62#define VRN_WORK                        1LL
    5963#define REGION_REGISTERS                8
    6064
     
    198202        __u64 ret;
    199203       
    200 //      ASSERT(i < REGION_REGISTERS);
     204        ASSERT(i < REGION_REGISTERS);
    201205        __asm__ volatile ("mov %0 = rr[%1]\n" : "=r" (ret) : "r" (i));
    202206       
     
    212216static inline void rr_write(index_t i, __u64 v)
    213217{
    214 //      ASSERT(i < REGION_REGISTERS);
     218        ASSERT(i < REGION_REGISTERS);
    215219        __asm__ volatile ("mov rr[%0] = %1\n" : : "r" (i), "r" (v));
    216220}
     
    239243
    240244extern void page_arch_init(void);
     245extern pte_t *vhpt_hash(__address page, asid_t asid);
    241246
    242247#endif
  • arch/ia64/src/mm/page.c

    rc2b95d3 r849386a  
    3939#include <arch/asm.h>
    4040#include <arch/barrier.h>
     41#include <memstr.h>
    4142
    4243/** Initialize VHPT and region registers. */
     
    6768       
    6869                rr.word == rr_read(i);
     70                rr.map.ve = 0;          /* disable VHPT walker */
    6971                rr.map.rid = ASID_INVALID;
    7072                rr_write(i, rr.word);
     
    7779         */
    7880        page_ht = (pte_t *) frame_alloc(FRAME_KA, VHPT_WIDTH - FRAME_WIDTH, NULL);
    79         ht_invalidate_all();
     81        memsetb((__address) page_ht, VHPT_SIZE, 0);
     82        ht_invalidate_all();   
    8083       
    8184        /*
     
    99102        set_vhpt_environment();
    100103}
     104
     105/** Calculate address of collision chain from VPN and ASID.
     106 *
     107 * This is rather non-trivial function.
     108 * First, it has to translate ASID to RID.
     109 * This is achieved by taking VRN bits of
     110 * page into account.
     111 * Second, it must preserve the region register
     112 * it writes the RID to.
     113 *
     114 * @param page Address of virtual page including VRN bits.
     115 * @param asid Address space identifier.
     116 *
     117 * @return Head of VHPT collision chain for page and asid.
     118 */
     119pte_t *vhpt_hash(__address page, asid_t asid)
     120{
     121        region_register rr_save, rr;
     122        pte_t *t;
     123
     124        rr_save.word = rr_read(VRN_WORK);
     125        rr.word = rr_save.word;
     126        if ((page >> VRN_SHIFT) != VRN_KERNEL)
     127                rr.map.rid = (asid * RIDS_PER_ASID) + (page >> VRN_SHIFT);
     128        else
     129                rr.map.rid = ASID_KERNEL;
     130        rr_write(VRN_WORK, rr.word);
     131        srlz_i();
     132        t = (pte_t *) thash((VRN_WORK << VRN_SHIFT) | (~(VRN_MASK) & page));
     133        rr_write(VRN_WORK, rr_save.word);
     134        srlz_i();
     135        srlz_d();
     136
     137        return t;
     138}
Note: See TracChangeset for help on using the changeset viewer.