Changeset c049309 in mainline for kernel/arch/xen32/include/mm/page.h


Ignore:
Timestamp:
2006-07-30T15:57:07Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b3e8c90
Parents:
764c302
Message:

xen32 cleanup

File:
1 edited

Legend:

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

    r764c302 rc049309  
    4444
    4545#ifndef __ASM__
     46#       include <arch/hypercall.h>
    4647#       define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
    4748#       define PA2KA(x) (((uintptr_t) (x)) + 0x80000000)
     
    6061#define PTL3_ENTRIES_ARCH       1024
    6162
    62 #define PTL0_INDEX_ARCH(vaddr)  (((vaddr)>>22)&0x3ff)
     63#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ff)
    6364#define PTL1_INDEX_ARCH(vaddr)  0
    6465#define PTL2_INDEX_ARCH(vaddr)  0
    65 #define PTL3_INDEX_ARCH(vaddr)  (((vaddr)>>12)&0x3ff)
     66#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ff)
    6667
    67 #define GET_PTL1_ADDRESS_ARCH(ptl0, i)          ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address)<<12))
     68#define GET_PTL1_ADDRESS_ARCH(ptl0, i)          ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address) << 12))
    6869#define GET_PTL2_ADDRESS_ARCH(ptl1, i)          (ptl1)
    6970#define GET_PTL3_ADDRESS_ARCH(ptl2, i)          (ptl2)
    70 #define GET_FRAME_ADDRESS_ARCH(ptl3, i)         ((uintptr_t)((((pte_t *)(ptl3))[(i)].frame_address)<<12))
     71#define GET_FRAME_ADDRESS_ARCH(ptl3, i)         ((uintptr_t)((((pte_t *)(ptl3))[(i)].frame_address) << 12))
    7172
    72 #define SET_PTL0_ADDRESS_ARCH(ptl0)             (write_cr3((uintptr_t) (ptl0)))
    73 #define SET_PTL1_ADDRESS_ARCH(ptl0, i, a)       (((pte_t *)(ptl0))[(i)].frame_address = (a)>>12)
     73#define SET_PTL0_ADDRESS_ARCH(ptl0) { \
     74        mmuext_op_t mmu_ext; \
     75        mmu_ext.cmd = MMUEXT_NEW_BASEPTR; \
     76        mmu_ext.arg1.mfn = ADDR2PFN(PA2MA(ptl0)); \
     77        xen_mmuext_op(&mmu_ext, 1, NULL, DOMID_SELF); \
     78}
     79#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) { \
     80        mmu_update_t update; \
     81        update.ptr = PA2MA(KA2PA(&((pte_t *) (ptl0))[(i)])); \
     82        update.val = PA2MA(a); \
     83        xen_mmu_update(&update, 1, NULL, DOMID_SELF); \
     84}
    7485#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
    7586#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
    76 #define SET_FRAME_ADDRESS_ARCH(ptl3, i, a)      (((pte_t *)(ptl3))[(i)].frame_address = (a)>>12)
     87#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) { \
     88        mmu_update_t update; \
     89        update.ptr = PA2MA(KA2PA(&((pte_t *) (ptl3))[(i)])); \
     90        update.val = PA2MA(a); \
     91        xen_mmu_update(&update, 1, NULL, DOMID_SELF); \
     92}
    7793
    7894#define GET_PTL1_FLAGS_ARCH(ptl0, i)            get_pt_flags((pte_t *)(ptl0), (index_t)(i))
     
    88104#define PTE_VALID_ARCH(p)                       (*((uint32_t *) (p)) != 0)
    89105#define PTE_PRESENT_ARCH(p)                     ((p)->present != 0)
    90 #define PTE_GET_FRAME_ARCH(p)                   ((p)->frame_address<<FRAME_WIDTH)
     106#define PTE_GET_FRAME_ARCH(p)                   ((p)->frame_address << FRAME_WIDTH)
    91107#define PTE_WRITABLE_ARCH(p)                    ((p)->writeable != 0)
    92108#define PTE_EXECUTABLE_ARCH(p)                  1
     
    102118
    103119/** When bit on this position is 0, the page fault was caused by a not-present page. */
    104 #define PFERR_CODE_P            (1<<0)
     120#define PFERR_CODE_P            (1 << 0)
    105121
    106122/** When bit on this position is 1, the page fault was caused by a write. */
    107 #define PFERR_CODE_RW           (1<<1)
     123#define PFERR_CODE_RW           (1 << 1)
    108124
    109125/** When bit on this position is 1, the page fault was caused in user mode. */
    110 #define PFERR_CODE_US           (1<<2)
     126#define PFERR_CODE_US           (1 << 2)
    111127
    112128/** When bit on this position is 1, a reserved bit was set in page directory. */
    113 #define PFERR_CODE_RSVD         (1<<3) 
     129#define PFERR_CODE_RSVD         (1 << 3)
    114130
    115131/** Page Table Entry. */
Note: See TracChangeset for help on using the changeset viewer.