Changes in kernel/arch/arm32/src/mm/page.c [a538808:7e752b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mm/page.c
ra538808 r7e752b2 37 37 #include <genarch/mm/page_pt.h> 38 38 #include <mm/page.h> 39 #include <arch/mm/frame.h>40 39 #include <align.h> 41 40 #include <config.h> … … 43 42 #include <typedefs.h> 44 43 #include <interrupt.h> 45 #include < macros.h>44 #include <arch/mm/frame.h> 46 45 47 46 /** Initializes page tables. … … 58 57 59 58 uintptr_t cur; 60 61 59 /* Kernel identity mapping */ 62 for (cur = PHYSMEM_START_ADDR; 63 cur < min(config.identity_size, config.physmem_end); 64 cur += FRAME_SIZE) 60 for (cur = PHYSMEM_START_ADDR; cur < last_frame; cur += FRAME_SIZE) 65 61 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags); 66 62 63 /* Create mapping for exception table at high offset */ 67 64 #ifdef HIGH_EXCEPTION_VECTORS 68 /* Create mapping for exception table at high offset */ 69 uintptr_t ev_frame = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_NONE); 70 page_mapping_insert(AS_KERNEL, EXC_BASE_ADDRESS, ev_frame, flags); 65 void *virtaddr = frame_alloc(ONE_FRAME, FRAME_KA); 66 page_mapping_insert(AS_KERNEL, EXC_BASE_ADDRESS, KA2PA(virtaddr), flags); 71 67 #else 72 68 #error "Only high exception vector supported now" 73 69 #endif 70 cur = ALIGN_DOWN(0x50008010, FRAME_SIZE); 71 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags); 74 72 75 73 page_table_unlock(AS_KERNEL, true); … … 80 78 } 81 79 80 /** Maps device into the kernel space. 81 * 82 * Maps physical address of device into kernel virtual address space (so it can 83 * be accessed only by kernel through virtual address). 84 * 85 * @param physaddr Physical address where device is connected. 86 * @param size Length of area where device is present. 87 * 88 * @return Virtual address where device will be accessible. 89 */ 90 uintptr_t hw_map(uintptr_t physaddr, size_t size) 91 { 92 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > 93 KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) { 94 panic("Unable to map physical memory %p (%d bytes).", 95 (void *) physaddr, size); 96 } 97 98 uintptr_t virtaddr = PA2KA(last_frame); 99 pfn_t i; 100 101 page_table_lock(AS_KERNEL, true); 102 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { 103 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), 104 physaddr + PFN2ADDR(i), 105 PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL); 106 } 107 page_table_unlock(AS_KERNEL, true); 108 109 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); 110 return virtaddr; 111 } 112 82 113 /** @} 83 114 */
Note:
See TracChangeset
for help on using the changeset viewer.