- Timestamp:
- 2006-01-31T00:44:08Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef67bab
- Parents:
- 6a3c9a7
- Location:
- generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/mm/as.h
r6a3c9a7 rfc1e4f6 49 49 #define UDATA_ADDRESS UDATA_ADDRESS_ARCH 50 50 51 #define AS_KERNEL (1<<0) /**< Kernel address space. */51 #define FLAG_AS_KERNEL (1<<0) /**< Kernel address space. */ 52 52 53 53 enum as_area_type { … … 85 85 }; 86 86 87 extern as_t * as_create(pte_t *ptl0, int flags); 87 extern as_t *AS_KERNEL; 88 89 extern as_t *as_create(pte_t *ptl0, int flags); 88 90 extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base); 89 91 extern void as_set_mapping(as_t *as, __address page, __address frame); -
generic/include/mm/page.h
r6a3c9a7 rfc1e4f6 62 62 /** Operations to manipulate page mappings. */ 63 63 struct page_operations { 64 void (* mapping_insert)( __address page, asid_t asid, __address frame, int flags, __address root);65 pte_t *(* mapping_find)( __address page, asid_t asid, __address root);64 void (* mapping_insert)(as_t *as, __address page, __address frame, int flags, __address root); 65 pte_t *(* mapping_find)(as_t *as, __address page, __address root); 66 66 }; 67 67 typedef struct page_operations page_operations_t; … … 70 70 71 71 extern void page_init(void); 72 extern void page_mapping_insert( __address page, asid_t asid, __address frame, int flags, __address root);73 extern pte_t *page_mapping_find( __address page, asid_t asid, __address root);72 extern void page_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root); 73 extern pte_t *page_mapping_find(as_t *as, __address page, __address root); 74 74 extern void map_structure(__address s, size_t size); 75 75 -
generic/src/main/main.c
r6a3c9a7 rfc1e4f6 78 78 size_t init_size = 0; 79 79 80 /** Kernel address space. */ 81 as_t *AS_KERNEL = NULL; 82 80 83 void main_bsp(void); 81 84 void main_ap(void); … … 153 156 */ 154 157 exc_init(); 155 158 159 /* 160 * Memory management subsystems initialization. 161 */ 156 162 arch_pre_mm_init(); 157 163 early_heap_init(config.heap_addr, config.heap_size + config.heap_delta); … … 186 192 * Create kernel address space. 187 193 */ 188 as = as_create(GET_PTL0_ADDRESS(), AS_KERNEL);194 as = as_create(GET_PTL0_ADDRESS(), FLAG_AS_KERNEL); 189 195 if (!as) 190 196 panic("can't create kernel address space\n"); -
generic/src/mm/as.c
r6a3c9a7 rfc1e4f6 77 77 list_initialize(&as->as_area_head); 78 78 79 if (flags & AS_KERNEL)79 if (flags & FLAG_AS_KERNEL) 80 80 as->asid = ASID_KERNEL; 81 81 else … … 187 187 */ 188 188 189 page_mapping_insert( page, as->asid, frame, get_area_flags(area), (__address) as->ptl0);189 page_mapping_insert(as, page, frame, get_area_flags(area), (__address) as->ptl0); 190 190 191 191 spinlock_unlock(&area->lock); … … 267 267 * inserted into page tables. 268 268 */ 269 page_mapping_insert( page, AS->asid, frame, get_area_flags(area), (__address) AS->ptl0);269 page_mapping_insert(AS, page, frame, get_area_flags(area), (__address) AS->ptl0); 270 270 271 271 spinlock_unlock(&area->lock); -
generic/src/mm/page.c
r6a3c9a7 rfc1e4f6 34 34 #include <arch/mm/page.h> 35 35 #include <arch/mm/asid.h> 36 #include <mm/as id.h>36 #include <mm/as.h> 37 37 #include <mm/frame.h> 38 38 #include <arch/types.h> … … 49 49 { 50 50 page_arch_init(); 51 page_mapping_insert( 0x0,0, 0x0, PAGE_NOT_PRESENT, 0);51 page_mapping_insert(AS_KERNEL, 0x0, 0x0, PAGE_NOT_PRESENT, 0); 52 52 } 53 53 … … 69 69 70 70 for (i = 0; i < cnt; i++) 71 page_mapping_insert( s + i*PAGE_SIZE, ASID_KERNEL, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0);71 page_mapping_insert(AS_KERNEL, s + i*PAGE_SIZE, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0); 72 72 73 73 } … … 78 78 * using 'flags'. Allocate and setup any missing page tables. 79 79 * 80 * @param as Address space to wich page belongs. Must be locked prior the call. 80 81 * @param page Virtual address of the page to be mapped. 81 * @param asid Address space to wich page belongs.82 82 * @param frame Physical address of memory frame to which the mapping is done. 83 83 * @param flags Flags to be used for mapping. 84 84 * @param root Explicit PTL0 address. 85 85 */ 86 void page_mapping_insert( __address page, asid_t asid, __address frame, int flags, __address root)86 void page_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root) 87 87 { 88 88 ASSERT(page_operations); 89 89 ASSERT(page_operations->mapping_insert); 90 90 91 page_operations->mapping_insert( page, asid, frame, flags, root);91 page_operations->mapping_insert(as, page, frame, flags, root); 92 92 } 93 93 … … 96 96 * Find mapping for virtual page. 97 97 * 98 * @param as Address space to wich page belongs must be locked prior the call. 98 99 * @param page Virtual page. 99 * @param asid Address space to wich page belongs.100 100 * @param root PTL0 address if non-zero. 101 101 * 102 102 * @return NULL if there is no such mapping; requested mapping otherwise. 103 103 */ 104 pte_t *page_mapping_find( __address page, asid_t asid, __address root)104 pte_t *page_mapping_find(as_t *as, __address page, __address root) 105 105 { 106 106 ASSERT(page_operations); 107 107 ASSERT(page_operations->mapping_find); 108 108 109 return page_operations->mapping_find( page, asid, root);109 return page_operations->mapping_find(as, page, root); 110 110 }
Note:
See TracChangeset
for help on using the changeset viewer.