Changes in kernel/generic/src/mm/km.c [f7f47a7:1ccd0aa] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/km.c
rf7f47a7 r1ccd0aa 46 46 #include <debug.h> 47 47 #include <arch.h> 48 #include <align.h> 49 #include <macros.h> 50 #include <bitops.h> 48 51 49 52 static ra_arena_t *km_ni_arena; … … 120 123 ra_free(km_ni_arena, page, size); 121 124 } 125 126 uintptr_t km_map(uintptr_t paddr, size_t size, unsigned int flags) 127 { 128 uintptr_t vaddr; 129 size_t asize; 130 size_t align; 131 uintptr_t offs; 132 133 asize = ALIGN_UP(size, PAGE_SIZE); 134 align = ispwr2(size) ? size : (1U << (fnzb(size) + 1)); 135 vaddr = km_page_alloc(asize, max(PAGE_SIZE, align)); 136 137 page_table_lock(AS_KERNEL, true); 138 for (offs = 0; offs < asize; offs += PAGE_SIZE) { 139 page_mapping_insert(AS_KERNEL, vaddr + offs, paddr + offs, 140 flags); 141 } 142 page_table_unlock(AS_KERNEL, true); 143 144 return vaddr; 145 } 146 122 147 123 148 /** Unmap kernen non-identity page. … … 165 190 FRAME_HIGHMEM | FRAME_ATOMIC | flags); 166 191 if (frame) { 167 page = km_page_alloc(PAGE_SIZE, PAGE_SIZE); 192 page = km_map(frame, PAGE_SIZE, 193 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 168 194 ASSERT(page); // FIXME 169 page_table_lock(AS_KERNEL, true);170 page_mapping_insert(AS_KERNEL, page, frame,171 PAGE_CACHEABLE | PAGE_READ | PAGE_WRITE);172 page_table_unlock(AS_KERNEL, true);173 195 } else { 174 196 frame = (uintptr_t) frame_alloc_noreserve(ONE_FRAME,
Note:
See TracChangeset
for help on using the changeset viewer.