Changeset fb84455 in mainline
- Timestamp:
- 2006-05-27T13:35:32Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ee077ee
- Parents:
- 6bf18fa
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/include/mm/page.h
r6bf18fa rfb84455 104 104 #define PTE_PRESENT_ARCH(p) ((p)->present != 0) 105 105 #define PTE_GET_FRAME_ARCH(p) ((((__address)(p)->addr_12_31)<<12) | ((__address)(p)->addr_32_51<<32)) 106 #define PTE_WRITABLE_ARCH(p) ((p)->writeable != 0) 107 #define PTE_EXECUTABLE_ARCH(p) ((p)->no_execute == 0) 106 108 107 109 #ifndef __ASM__ -
arch/ia32/include/mm/page.h
r6bf18fa rfb84455 83 83 #define PTE_PRESENT_ARCH(p) ((p)->present != 0) 84 84 #define PTE_GET_FRAME_ARCH(p) ((p)->frame_address<<FRAME_WIDTH) 85 #define PTE_WRITABLE_ARCH(p) ((p)->writeable != 0) 86 #define PTE_EXECUTABLE_ARCH(p) 1 85 87 86 88 #ifndef __ASM__ -
arch/mips32/include/mm/page.h
r6bf18fa rfb84455 98 98 #define PTE_PRESENT_ARCH(pte) ((pte)->p != 0) 99 99 #define PTE_GET_FRAME_ARCH(pte) ((pte)->pfn<<12) 100 #define PTE_WRITABLE_ARCH(pte) ((pte)->w != 0) 101 #define PTE_EXECUTABLE_ARCH(pte) 1 100 102 101 103 #ifndef __ASM__ -
arch/ppc32/include/mm/page.h
r6bf18fa rfb84455 90 90 91 91 #define PTE_VALID_ARCH(pte) (*((__u32 *) (pte)) != 0) 92 #define PTE_PRESENT_ARCH(pte) ((pte)->p != 0) 93 #define PTE_GET_FRAME_ARCH(pte) ((pte)->pfn << 12) 92 #define PTE_PRESENT_ARCH(pte) ((pte)->p != 0) 93 #define PTE_GET_FRAME_ARCH(pte) ((pte)->pfn << 12) 94 #define PTE_WRITABLE_ARCH(pte) 1 95 #define PTE_EXECUTABLE_ARCH(pte) 1 94 96 95 97 #ifndef __ASM__ -
arch/ppc64/include/mm/page.h
r6bf18fa rfb84455 90 90 91 91 #define PTE_VALID_ARCH(pte) (*((__u32 *) (pte)) != 0) 92 #define PTE_PRESENT_ARCH(pte) ((pte)->p != 0) 93 #define PTE_GET_FRAME_ARCH(pte) ((pte)->pfn << 12) 92 #define PTE_PRESENT_ARCH(pte) ((pte)->p != 0) 93 #define PTE_GET_FRAME_ARCH(pte) ((__address) ((pte)->pfn << 12)) 94 #define PTE_WRITABLE_ARCH(pte) 1 95 #define PTE_EXECUTABLE_ARCH(pte) 1 94 96 95 97 #ifndef __ASM__ -
genarch/include/mm/page_ht.h
r6bf18fa rfb84455 52 52 #define PTE_PRESENT(pte) ((pte)->p != 0) 53 53 #define PTE_GET_FRAME(pte) ((pte)->frame) 54 #define PTE_READABLE(pte) 1 55 #define PTE_WRITABLE(pte) ((pte)->w != 0) 56 #define PTE_EXECUTABLE(pte) ((pte)->x != 0) 54 57 55 58 #define SET_PTL0_ADDRESS(x) -
genarch/include/mm/page_pt.h
r6bf18fa rfb84455 98 98 #define PTE_PRESENT(p) PTE_PRESENT_ARCH((p)) 99 99 #define PTE_GET_FRAME(p) PTE_GET_FRAME_ARCH((p)) 100 #define PTE_READABLE(p) 1 101 #define PTE_WRITABLE(p) PTE_WRITABLE_ARCH((p)) 102 #define PTE_EXECUTABLE(p) PTE_EXECUTABLE_ARCH((p)) 100 103 101 104 extern page_mapping_operations_t pt_mapping_operations; -
generic/include/mm/as.h
r6bf18fa rfb84455 146 146 extern int as_area_get_flags(as_area_t *area); 147 147 extern void as_set_mapping(as_t *as, __address page, __address frame); 148 extern bool as_area_check_access(as_area_t *area, pf_access_t access); 148 149 extern int as_page_fault(__address page, pf_access_t access, istate_t *istate); 149 150 extern void as_switch(as_t *old, as_t *new); -
generic/src/lib/elf.c
r6bf18fa rfb84455 236 236 __address base, frame; 237 237 index_t i; 238 239 if (!as_area_check_access(area, access)) 240 return AS_PF_FAULT; 238 241 239 242 ASSERT((addr >= entry->p_vaddr) && (addr < entry->p_vaddr + entry->p_memsz)); -
generic/src/mm/as.c
r6bf18fa rfb84455 633 633 } 634 634 635 /** Check access mode for address space area. 636 * 637 * The address space area must be locked prior to this call. 638 * 639 * @param area Address space area. 640 * @param access Access mode. 641 * 642 * @return False if access violates area's permissions, true otherwise. 643 */ 644 bool as_area_check_access(as_area_t *area, pf_access_t access) 645 { 646 int flagmap[] = { 647 [PF_ACCESS_READ] = AS_AREA_READ, 648 [PF_ACCESS_WRITE] = AS_AREA_WRITE, 649 [PF_ACCESS_EXEC] = AS_AREA_EXEC 650 }; 651 652 if (!(area->flags & flagmap[access])) 653 return false; 654 655 return true; 656 } 657 635 658 /** Handle page fault within the current address space. 636 659 * … … 699 722 if ((pte = page_mapping_find(AS, page))) { 700 723 if (PTE_PRESENT(pte)) { 701 page_table_unlock(AS, false); 702 mutex_unlock(&area->lock); 703 mutex_unlock(&AS->lock); 704 return AS_PF_OK; 724 if (((access == PF_ACCESS_READ) && PTE_READABLE(pte)) || 725 (access == PF_ACCESS_WRITE && PTE_WRITABLE(pte)) || 726 (access == PF_ACCESS_EXEC && PTE_EXECUTABLE(pte))) { 727 page_table_unlock(AS, false); 728 mutex_unlock(&area->lock); 729 mutex_unlock(&AS->lock); 730 return AS_PF_OK; 731 } 705 732 } 706 733 } … … 1496 1523 __address frame; 1497 1524 1525 if (!as_area_check_access(area, access)) 1526 return AS_PF_FAULT; 1527 1498 1528 if (area->sh_info) { 1499 1529 btree_node_t *leaf;
Note:
See TracChangeset
for help on using the changeset viewer.