Changeset e12ccc5 in mainline for kernel/arch/xen32/include/mm/page.h
- Timestamp:
- 2006-08-01T17:27:11Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0fbfa0d
- Parents:
- e386cbf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/xen32/include/mm/page.h
re386cbf re12ccc5 44 44 45 45 #ifndef __ASM__ 46 # include <arch/hypercall.h>47 46 # define KA2PA(x) (((uintptr_t) (x)) - 0x80000000) 48 47 # define PA2KA(x) (((uintptr_t) (x)) + 0x80000000) … … 66 65 #define PTL3_INDEX_ARCH(vaddr) (((vaddr) >> 12) & 0x3ff) 67 66 68 #define GET_PTL1_ADDRESS_ARCH(ptl0, i) ((pte_t *) ((((pte_t *)(ptl0))[(i)].frame_address) << 12))67 #define GET_PTL1_ADDRESS_ARCH(ptl0, i) ((pte_t *) MA2PA((((pte_t *) (ptl0))[(i)].frame_address) << 12)) 69 68 #define GET_PTL2_ADDRESS_ARCH(ptl1, i) (ptl1) 70 69 #define GET_PTL3_ADDRESS_ARCH(ptl2, i) (ptl2) 71 #define GET_FRAME_ADDRESS_ARCH(ptl3, i) ((uintptr_t) ((((pte_t *)(ptl3))[(i)].frame_address) << 12))70 #define GET_FRAME_ADDRESS_ARCH(ptl3, i) ((uintptr_t) MA2PA((((pte_t *) (ptl3))[(i)].frame_address) << 12)) 72 71 73 72 #define SET_PTL0_ADDRESS_ARCH(ptl0) { \ 74 73 mmuext_op_t mmu_ext; \ 74 \ 75 75 mmu_ext.cmd = MMUEXT_NEW_BASEPTR; \ 76 mmu_ext. arg1.mfn = ADDR2PFN(PA2MA(ptl0)); \76 mmu_ext.mfn = ADDR2PFN(PA2MA(ptl0)); \ 77 77 xen_mmuext_op(&mmu_ext, 1, NULL, DOMID_SELF); \ 78 78 } 79 79 80 #define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) { \ 80 81 mmu_update_t update; \ 82 \ 81 83 update.ptr = PA2MA(KA2PA(&((pte_t *) (ptl0))[(i)])); \ 82 update.val = PA2MA(a) ; \84 update.val = PA2MA(a) | 0x0003; \ 83 85 xen_mmu_update(&update, 1, NULL, DOMID_SELF); \ 84 86 } 85 87 #define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) 86 88 #define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) 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 } 93 94 #define GET_PTL1_FLAGS_ARCH(ptl0, i) get_pt_flags((pte_t *)(ptl0), (index_t)(i)) 89 #define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) (((pte_t *) (ptl3))[(i)].frame_address = PA2MA(a) >> 12) 90 91 #define GET_PTL1_FLAGS_ARCH(ptl0, i) get_pt_flags((pte_t *) (ptl0), (index_t)(i)) 95 92 #define GET_PTL2_FLAGS_ARCH(ptl1, i) PAGE_PRESENT 96 93 #define GET_PTL3_FLAGS_ARCH(ptl2, i) PAGE_PRESENT 97 #define GET_FRAME_FLAGS_ARCH(ptl3, i) get_pt_flags((pte_t *) (ptl3), (index_t)(i))98 99 #define SET_PTL1_FLAGS_ARCH(ptl0, i, x) set_pt_flags((pte_t *) (ptl0), (index_t)(i), (x))94 #define GET_FRAME_FLAGS_ARCH(ptl3, i) get_pt_flags((pte_t *) (ptl3), (index_t)(i)) 95 96 #define SET_PTL1_FLAGS_ARCH(ptl0, i, x) set_pt_flags((pte_t *) (ptl0), (index_t)(i), (x)) 100 97 #define SET_PTL2_FLAGS_ARCH(ptl1, i, x) 101 98 #define SET_PTL3_FLAGS_ARCH(ptl2, i, x) 102 #define SET_FRAME_FLAGS_ARCH(ptl3, i, x) set_pt_flags((pte_t *)(ptl3), (index_t)(i), (x))99 #define SET_FRAME_FLAGS_ARCH(ptl3, i, x) set_pt_flags((pte_t *) (ptl3), (index_t)(i), (x)) 103 100 104 101 #define PTE_VALID_ARCH(p) (*((uint32_t *) (p)) != 0) … … 114 111 #include <arch/mm/frame.h> 115 112 #include <typedefs.h> 113 #include <arch/hypercall.h> 116 114 117 115 /* Page fault error codes. */ … … 145 143 } __attribute__ ((packed)); 146 144 145 typedef struct { 146 uint64_t ptr; /**< Machine address of PTE */ 147 union { /**< New contents of PTE */ 148 uint64_t val; 149 pte_t pte; 150 }; 151 } mmu_update_t; 152 153 typedef struct { 154 unsigned int cmd; 155 union { 156 unsigned long mfn; 157 unsigned long linear_addr; 158 }; 159 union { 160 unsigned int nr_ents; 161 void *vcpumask; 162 }; 163 } mmuext_op_t; 164 165 static inline int xen_update_va_mapping(const void *va, const pte_t pte, const unsigned int flags) 166 { 167 return hypercall4(XEN_UPDATE_VA_MAPPING, va, pte, 0, flags); 168 } 169 170 static inline int xen_mmu_update(const mmu_update_t *req, const unsigned int count, unsigned int *success_count, domid_t domid) 171 { 172 return hypercall4(XEN_MMU_UPDATE, req, count, success_count, domid); 173 } 174 175 static inline int xen_mmuext_op(const mmuext_op_t *op, const unsigned int count, unsigned int *success_count, domid_t domid) 176 { 177 return hypercall4(XEN_MMUEXT_OP, op, count, success_count, domid); 178 } 179 147 180 static inline int get_pt_flags(pte_t *pt, index_t i) 148 181 {
Note:
See TracChangeset
for help on using the changeset viewer.