Changeset 6d7ffa65 in mainline
- Timestamp:
- 2006-01-08T15:03:41Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1a67595
- Parents:
- 566ba81
- Files:
-
- 5 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/Makefile.inc
r566ba81 r6d7ffa65 59 59 CONFIG_ACPI = y 60 60 61 ## Compile with hierarchical page tables support. 62 # 63 64 CONFIG_PAGE_PT = y 65 61 66 ## Accepted configuration directives 62 67 # -
arch/amd64/src/mm/page.c
r566ba81 r6d7ffa65 28 28 29 29 #include <arch/mm/page.h> 30 #include <genarch/mm/page_pt.h> 30 31 #include <arch/mm/frame.h> 31 32 #include <mm/page.h> … … 45 46 46 47 if (config.cpu_active == 1) { 48 page_operations = &page_pt_operations; 49 47 50 dba = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME); 48 51 memsetb(dba, PAGE_SIZE, 0); -
arch/ia32/Makefile.inc
r566ba81 r6d7ffa65 78 78 CONFIG_ACPI = y 79 79 80 ## Compile with hierarchical page tables support. 81 # 82 83 CONFIG_PAGE_PT = y 84 80 85 ## Accepted configuration directives 81 86 # -
arch/ia32/src/mm/page.c
r566ba81 r6d7ffa65 28 28 29 29 #include <arch/mm/page.h> 30 #include <genarch/mm/page_pt.h> 30 31 #include <arch/mm/frame.h> 31 32 #include <mm/frame.h> … … 49 50 50 51 if (config.cpu_active == 1) { 52 page_operations = &page_pt_operations; 53 51 54 dba = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME); 52 55 memsetb(dba, PAGE_SIZE, 0); -
arch/ia64/Makefile.inc
r566ba81 r6d7ffa65 43 43 AFLAGS += -mconstant-gp 44 44 45 ## Compile with page hash table support. 46 # 47 48 CONFIG_PAGE_HT = y 49 45 50 ARCH_SOURCES = \ 46 51 arch/$(ARCH)/src/start.S \ … … 55 60 arch/$(ARCH)/src/interrupt.c \ 56 61 arch/$(ARCH)/src/mm/frame.c \ 62 arch/$(ARCH)/src/mm/page.c \ 57 63 arch/$(ARCH)/src/drivers/it.c -
arch/ia64/include/mm/page.h
r566ba81 r6d7ffa65 38 38 #define PA2KA(x) ((__address) (x)) 39 39 40 #define page_arch_init() ;41 42 40 /* 43 41 * Implementation of generic 4-level page table interface. … … 71 69 #define SET_FRAME_FLAGS_ARCH(ptl3, i, x) 72 70 71 extern void page_arch_init(void); 72 73 73 #endif -
arch/mips32/Makefile.inc
r566ba81 r6d7ffa65 46 46 CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss 47 47 DEFS += -DMACHINE=${MIPS_MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS} -DINIT_ADDRESS=${INIT_ADDRESS} -DINIT_SIZE=${INIT_SIZE} 48 49 ## Compile with hierarchical page tables support. 50 # 51 52 CONFIG_PAGE_PT = y 53 48 54 49 55 ## Accepted MACHINEs -
arch/mips32/src/mm/page.c
r566ba81 r6d7ffa65 27 27 */ 28 28 29 #include <arch/types.h>30 29 #include <arch/mm/page.h> 30 #include <genarch/mm/page_pt.h> 31 31 #include <arch/mm/frame.h> 32 32 #include <mm/frame.h> 33 33 #include <mm/page.h> 34 #include <arch/types.h> 34 35 #include <memstr.h> 35 36 … … 39 40 { 40 41 __address ptl0; 42 43 page_operations = &page_pt_operations; 41 44 42 45 ptl0 = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME); -
arch/ppc32/Makefile.inc
r566ba81 r6d7ffa65 46 46 CONFIG_OFW = y 47 47 48 ## Compile with hierarchical page tables support. 49 # 50 51 CONFIG_PAGE_PT = y 52 48 53 ARCH_SOURCES = \ 49 54 arch/$(ARCH)/src/console.c \ -
arch/ppc32/src/mm/page.c
r566ba81 r6d7ffa65 27 27 */ 28 28 29 #include <arch/types.h>30 29 #include <arch/mm/page.h> 30 #include <genarch/mm/page_pt.h> 31 31 #include <arch/mm/frame.h> 32 32 #include <mm/frame.h> 33 33 #include <mm/page.h> 34 #include <arch/types.h> 34 35 35 36 void page_arch_init(void) 36 37 { 38 page_operations = &page_pt_operations; 37 39 } -
arch/sparc64/Makefile.inc
r566ba81 r6d7ffa65 47 47 CONFIG_OFW = y 48 48 49 ## Compile with page hash table support. 50 # 51 52 CONFIG_PAGE_HT = y 53 49 54 ARCH_SOURCES = \ 50 55 arch/$(ARCH)/src/cpu/cpu.c \ -
arch/sparc64/src/mm/page.c
r566ba81 r6d7ffa65 28 28 29 29 #include <arch/mm/page.h> 30 #include <genarch/mm/page_ht.h> 30 31 31 32 void page_arch_init(void) 32 33 { 34 page_operations = &page_ht_operations; 33 35 } -
genarch/Makefile.inc
r566ba81 r6d7ffa65 38 38 genarch/src/acpi/matd.c 39 39 endif 40 ifeq ($(CONFIG_PAGE_PT),y) 41 GENARCH_SOURCES += \ 42 genarch/src/mm/page_pt.c 43 endif 44 ifeq ($(CONFIG_PAGE_HT),y) 45 GENARCH_SOURCES += \ 46 genarch/src/mm/page_ht.c 47 endif -
generic/include/mm/page.h
r566ba81 r6d7ffa65 56 56 #define PAGE_EXEC (1<<PAGE_EXEC_SHIFT) 57 57 58 /* 59 * This is the generic 4-level page table interface. 60 * Architectures are supposed to implement *_ARCH macros. 61 */ 58 struct page_operations { 59 void (* mapping_insert)(__address page, __address frame, int flags, __address root); 60 pte_t *(* mapping_find)(__address page, __address root); 61 }; 62 typedef struct page_operations page_operations_t; 62 63 63 /* 64 * These macros process vaddr and extract those portions 65 * of it that function as indices to respective page tables. 66 */ 67 #define PTL0_INDEX(vaddr) PTL0_INDEX_ARCH(vaddr) 68 #define PTL1_INDEX(vaddr) PTL1_INDEX_ARCH(vaddr) 69 #define PTL2_INDEX(vaddr) PTL2_INDEX_ARCH(vaddr) 70 #define PTL3_INDEX(vaddr) PTL3_INDEX_ARCH(vaddr) 71 72 #define GET_PTL0_ADDRESS() GET_PTL0_ADDRESS_ARCH() 73 #define SET_PTL0_ADDRESS(ptl0) SET_PTL0_ADDRESS_ARCH(ptl0) 74 75 /* 76 * These macros traverse the 4-level tree of page tables, 77 * each descending by one level. 78 */ 79 #define GET_PTL1_ADDRESS(ptl0, i) GET_PTL1_ADDRESS_ARCH(ptl0, i) 80 #define GET_PTL2_ADDRESS(ptl1, i) GET_PTL2_ADDRESS_ARCH(ptl1, i) 81 #define GET_PTL3_ADDRESS(ptl2, i) GET_PTL3_ADDRESS_ARCH(ptl2, i) 82 #define GET_FRAME_ADDRESS(ptl3, i) GET_FRAME_ADDRESS_ARCH(ptl3, i) 83 84 /* 85 * These macros are provided to change shape of the 4-level 86 * tree of page tables on respective level. 87 */ 88 #define SET_PTL1_ADDRESS(ptl0, i, a) SET_PTL1_ADDRESS_ARCH(ptl0, i, a) 89 #define SET_PTL2_ADDRESS(ptl1, i, a) SET_PTL2_ADDRESS_ARCH(ptl1, i, a) 90 #define SET_PTL3_ADDRESS(ptl2, i, a) SET_PTL3_ADDRESS_ARCH(ptl2, i, a) 91 #define SET_FRAME_ADDRESS(ptl3, i, a) SET_FRAME_ADDRESS_ARCH(ptl3, i, a) 92 93 /* 94 * These macros are provided to query various flags within the page tables. 95 */ 96 #define GET_PTL1_FLAGS(ptl0, i) GET_PTL1_FLAGS_ARCH(ptl0, i) 97 #define GET_PTL2_FLAGS(ptl1, i) GET_PTL2_FLAGS_ARCH(ptl1, i) 98 #define GET_PTL3_FLAGS(ptl2, i) GET_PTL3_FLAGS_ARCH(ptl2, i) 99 #define GET_FRAME_FLAGS(ptl3, i) GET_FRAME_FLAGS_ARCH(ptl3, i) 100 101 /* 102 * These macros are provided to set/clear various flags within the page tables. 103 */ 104 #define SET_PTL1_FLAGS(ptl0, i, x) SET_PTL1_FLAGS_ARCH(ptl0, i, x) 105 #define SET_PTL2_FLAGS(ptl1, i, x) SET_PTL2_FLAGS_ARCH(ptl1, i, x) 106 #define SET_PTL3_FLAGS(ptl2, i, x) SET_PTL3_FLAGS_ARCH(ptl2, i, x) 107 #define SET_FRAME_FLAGS(ptl3, i, x) SET_FRAME_FLAGS_ARCH(ptl3, i, x) 64 extern page_operations_t *page_operations; 108 65 109 66 extern void page_init(void); -
generic/src/main/main.c
r566ba81 r6d7ffa65 47 47 #include <mm/frame.h> 48 48 #include <mm/page.h> 49 #include <genarch/mm/page_pt.h> 49 50 #include <mm/tlb.h> 50 51 #include <mm/vm.h> -
generic/src/mm/page.c
r566ba81 r6d7ffa65 34 34 #include <arch/asm.h> 35 35 #include <memstr.h> 36 #include <debug.h> 37 38 /** Virtual operations for page subsystem. */ 39 page_operations_t *page_operations = NULL; 36 40 37 41 void page_init(void) … … 74 78 void page_mapping_insert(__address page, __address frame, int flags, __address root) 75 79 { 76 pte_t *ptl0, *ptl1, *ptl2, *ptl3; 77 __address newpt; 78 79 ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS()); 80 81 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) { 82 newpt = frame_alloc(FRAME_KA, ONE_FRAME); 83 memsetb(newpt, PAGE_SIZE, 0); 84 SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt)); 85 SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE); 86 } 87 88 ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page))); 89 90 if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) { 91 newpt = frame_alloc(FRAME_KA, ONE_FRAME); 92 memsetb(newpt, PAGE_SIZE, 0); 93 SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt)); 94 SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE); 95 } 96 97 ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page))); 98 99 if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) { 100 newpt = frame_alloc(FRAME_KA, ONE_FRAME); 101 memsetb(newpt, PAGE_SIZE, 0); 102 SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt)); 103 SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page), PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE | PAGE_WRITE); 104 } 105 106 ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page))); 107 108 SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame); 109 SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags); 80 ASSERT(page_operations); 81 ASSERT(page_operations->mapping_insert); 82 83 page_operations->mapping_insert(page, frame, flags, root); 110 84 } 111 85 … … 121 95 pte_t *page_mapping_find(__address page, __address root) 122 96 { 123 pte_t *ptl0, *ptl1, *ptl2, *ptl3; 97 ASSERT(page_operations); 98 ASSERT(page_operations->mapping_find); 124 99 125 ptl0 = (pte_t *) PA2KA(root ? root : (__address) GET_PTL0_ADDRESS()); 126 127 if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) 128 return NULL; 129 130 ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page))); 131 132 if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) 133 return NULL; 134 135 ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page))); 136 137 if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) 138 return NULL; 139 140 ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page))); 141 142 return &ptl3[PTL3_INDEX(page)]; 100 return page_operations->mapping_find(page, root); 143 101 } -
generic/src/mm/vm.c
r566ba81 r6d7ffa65 33 33 #include <mm/heap.h> 34 34 #include <arch/mm/page.h> 35 #include <genarch/mm/page_pt.h> 35 36 #include <arch/mm/asid.h> 36 37 #include <arch/mm/vm.h>
Note:
See TracChangeset
for help on using the changeset viewer.