Changeset fc1e4f6 in mainline
- 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
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/src/mm/page.c
r6a3c9a7 rfc1e4f6 32 32 #include <mm/page.h> 33 33 #include <mm/frame.h> 34 #include <mm/as id.h>34 #include <mm/as.h> 35 35 #include <arch/interrupt.h> 36 36 #include <arch/asm.h> … … 58 58 */ 59 59 for (cur = 0; cur < last_frame; cur += FRAME_SIZE) { 60 page_mapping_insert( PA2KA(cur), ASID_KERNEL, cur, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba));60 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba)); 61 61 } 62 62 -
arch/ia32/src/drivers/ega.c
r6a3c9a7 rfc1e4f6 30 30 #include <putchar.h> 31 31 #include <mm/page.h> 32 #include <mm/as id.h>32 #include <mm/as.h> 33 33 #include <arch/mm/page.h> 34 34 #include <synch/spinlock.h> … … 60 60 __u8 hi, lo; 61 61 62 page_mapping_insert( PA2KA(VIDEORAM), ASID_KERNEL, VIDEORAM, PAGE_NOT_CACHEABLE, 0);62 page_mapping_insert(AS_KERNEL, PA2KA(VIDEORAM), VIDEORAM, PAGE_NOT_CACHEABLE, 0); 63 63 outb(0x3d4,0xe); 64 64 hi = inb(0x3d5); -
arch/ia32/src/mm/page.c
r6a3c9a7 rfc1e4f6 32 32 #include <mm/frame.h> 33 33 #include <mm/page.h> 34 #include <mm/as id.h>34 #include <mm/as.h> 35 35 #include <arch/types.h> 36 36 #include <config.h> … … 62 62 */ 63 63 for (cur = 0; cur < last_frame; cur += FRAME_SIZE) 64 page_mapping_insert( PA2KA(cur), ASID_KERNEL, cur, PAGE_CACHEABLE, KA2PA(dba));64 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, PAGE_CACHEABLE, KA2PA(dba)); 65 65 66 66 exc_register(14, "page_fault", page_fault); -
arch/ia32/src/smp/smp.c
r6a3c9a7 rfc1e4f6 45 45 #include <mm/page.h> 46 46 #include <mm/heap.h> 47 #include <mm/as id.h>47 #include <mm/as.h> 48 48 #include <print.h> 49 49 #include <memstr.h> … … 66 66 67 67 if (config.cpu_count > 1) { 68 page_mapping_insert( (__address)l_apic, ASID_KERNEL, (__address)l_apic,68 page_mapping_insert(AS_KERNEL, (__address) l_apic, (__address) l_apic, 69 69 PAGE_NOT_CACHEABLE, 0); 70 page_mapping_insert((__address) io_apic, ASID_KERNEL, 71 (__address) io_apic, 70 page_mapping_insert(AS_KERNEL, (__address) io_apic, (__address) io_apic, 72 71 PAGE_NOT_CACHEABLE, 0); 73 72 } -
arch/mips32/src/mm/tlb.c
r6a3c9a7 rfc1e4f6 340 340 * Check if the mapping exists in page tables. 341 341 */ 342 pte = page_mapping_find( badvaddr, AS->asid, 0);342 pte = page_mapping_find(AS, badvaddr, 0); 343 343 if (pte && pte->lo.v) { 344 344 /* … … 357 357 * The mapping ought to be in place. 358 358 */ 359 pte = page_mapping_find( badvaddr, AS->asid, 0);359 pte = page_mapping_find(AS, badvaddr, 0); 360 360 ASSERT(pte && pte->lo.v); 361 361 return pte; -
genarch/include/mm/page_pt.h
r6a3c9a7 rfc1e4f6 88 88 extern page_operations_t page_pt_operations; 89 89 90 extern void page_mapping_insert_pt( __address page, __address frame, int flags, __address root);91 extern pte_t *page_mapping_find_pt( __address page, __address root);90 extern void page_mapping_insert_pt(as_t *as, __address page, __address frame, int flags, __address root); 91 extern pte_t *page_mapping_find_pt(as_t *as, __address page, __address root); 92 92 93 93 #endif -
genarch/src/acpi/acpi.c
r6a3c9a7 rfc1e4f6 30 30 #include <genarch/acpi/madt.h> 31 31 #include <arch/bios/bios.h> 32 #include <mm/as id.h>32 #include <mm/as.h> 33 33 #include <mm/page.h> 34 34 #include <print.h> … … 80 80 static void map_sdt(struct acpi_sdt_header *sdt) 81 81 { 82 page_mapping_insert( (__address) sdt, ASID_KERNEL, (__address) sdt, PAGE_NOT_CACHEABLE, 0);82 page_mapping_insert(AS_KERNEL, (__address) sdt, (__address) sdt, PAGE_NOT_CACHEABLE, 0); 83 83 map_structure((__address) sdt, sdt->length); 84 84 } -
genarch/src/mm/page_ht.c
r6a3c9a7 rfc1e4f6 31 31 #include <mm/frame.h> 32 32 #include <mm/heap.h> 33 #include <mm/as.h> 33 34 #include <arch/mm/asid.h> 34 35 #include <arch/types.h> … … 53 54 pte_t *page_ht = NULL; 54 55 55 static void ht_mapping_insert( __address page, asid_t asid, __address frame, int flags, __address root);56 static pte_t *ht_mapping_find( __address page, asid_t asid, __address root);56 static void ht_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root); 57 static pte_t *ht_mapping_find(as_t *as, __address page, __address root); 57 58 58 59 page_operations_t page_ht_operations = { … … 68 69 * chain. 69 70 * 71 * @param as Address space to which page belongs. Must be locked prior the call. 70 72 * @param page Virtual address of the page to be mapped. 71 * @param asid Address space to which page belongs.72 73 * @param frame Physical address of memory frame to which the mapping is done. 73 74 * @param flags Flags to be used for mapping. 74 75 * @param root Ignored. 75 76 */ 76 void ht_mapping_insert( __address page, asid_t asid, __address frame, int flags, __address root)77 void ht_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root) 77 78 { 78 79 pte_t *t, *u; … … 81 82 ipl = interrupts_disable(); 82 83 spinlock_lock(&page_ht_lock); 83 84 t = HT_HASH(page, as id);84 85 t = HT_HASH(page, as->asid); 85 86 if (!HT_SLOT_EMPTY(t)) { 86 87 … … 92 93 do { 93 94 u = t; 94 if (HT_COMPARE(page, as id, t)) {95 if (HT_COMPARE(page, as->asid, t)) { 95 96 /* 96 97 * Nothing to do, … … 110 111 } 111 112 112 HT_SET_RECORD(t, page, as id, frame, flags);113 HT_SET_RECORD(t, page, as->asid, frame, flags); 113 114 HT_SET_NEXT(t, NULL); 114 115 … … 123 124 * Interrupts must be disabled. 124 125 * 126 * @param as Address space to wich page belongs. Must be locked prior the call. 125 127 * @param page Virtual page. 126 * @param asid Address space to wich page belongs.127 128 * @param root Ignored. 128 129 * 129 130 * @return NULL if there is no such mapping; requested mapping otherwise. 130 131 */ 131 pte_t *ht_mapping_find( __address page, asid_t asid, __address root)132 pte_t *ht_mapping_find(as_t *as, __address page, __address root) 132 133 { 133 134 pte_t *t; 134 135 135 136 spinlock_lock(&page_ht_lock); 136 t = HT_HASH(page, as id);137 t = HT_HASH(page, as->asid); 137 138 if (!HT_SLOT_EMPTY(t)) { 138 while (!HT_COMPARE(page, as id, t) && HT_GET_NEXT(t))139 while (!HT_COMPARE(page, as->asid, t) && HT_GET_NEXT(t)) 139 140 t = HT_GET_NEXT(t); 140 t = HT_COMPARE(page, as id, t) ? t : NULL;141 t = HT_COMPARE(page, as->asid, t) ? t : NULL; 141 142 } else { 142 143 t = NULL; -
genarch/src/mm/page_pt.c
r6a3c9a7 rfc1e4f6 31 31 #include <mm/frame.h> 32 32 #include <arch/mm/page.h> 33 #include <arch/mm/as id.h>33 #include <arch/mm/as.h> 34 34 #include <arch/types.h> 35 35 #include <typedefs.h> … … 37 37 #include <memstr.h> 38 38 39 static void pt_mapping_insert( __address page, asid_t asid, __address frame, int flags, __address root);40 static pte_t *pt_mapping_find( __address page, asid_t asid, __address root);39 static void pt_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root); 40 static pte_t *pt_mapping_find(as_t *as, __address page, __address root); 41 41 42 42 page_operations_t page_pt_operations = { … … 50 50 * using 'flags'. 51 51 * 52 * @param as Ignored. 52 53 * @param page Virtual address of the page to be mapped. 53 * @param asid Ignored.54 54 * @param frame Physical address of memory frame to which the mapping is done. 55 55 * @param flags Flags to be used for mapping. 56 56 * @param root Explicit PTL0 address. 57 57 */ 58 void pt_mapping_insert( __address page, asid_t asid, __address frame, int flags, __address root)58 void pt_mapping_insert(as_t *as, __address page, __address frame, int flags, __address root) 59 59 { 60 60 pte_t *ptl0, *ptl1, *ptl2, *ptl3; … … 98 98 * Find mapping for virtual page. 99 99 * 100 * @param as Ignored. 100 101 * @param page Virtual page. 101 * @param asid Ignored.102 102 * @param root PTL0 address if non-zero. 103 103 * 104 104 * @return NULL if there is no such mapping; entry from PTL3 describing the mapping otherwise. 105 105 */ 106 pte_t *pt_mapping_find( __address page, asid_t asid, __address root)106 pte_t *pt_mapping_find(as_t *as, __address page, __address root) 107 107 { 108 108 pte_t *ptl0, *ptl1, *ptl2, *ptl3; -
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 } -
test/mm/mapping1/test.c
r6a3c9a7 rfc1e4f6 30 30 #include <mm/page.h> 31 31 #include <mm/frame.h> 32 #include <mm/as id.h>32 #include <mm/as.h> 33 33 #include <arch/mm/page.h> 34 34 #include <arch/types.h> … … 57 57 58 58 printf("Mapping virtual address %P to physical address %P.\n", PAGE0, KA2PA(frame0)); 59 page_mapping_insert( PAGE0, ASID_KERNEL, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE, 0);59 page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE, 0); 60 60 printf("Mapping virtual address %P to physical address %P.\n", PAGE1, KA2PA(frame1)); 61 page_mapping_insert( PAGE1, ASID_KERNEL, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE, 0);61 page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE, 0); 62 62 63 63 printf("Value at virtual address %P is %L.\n", PAGE0, v0 = *((__u32 *) PAGE0));
Note:
See TracChangeset
for help on using the changeset viewer.