Changeset adec5b45 in mainline for kernel/generic/src/mm/km.c
- Timestamp:
- 2012-01-27T22:19:12Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1ccd0aa
- Parents:
- d4673296
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/km.c
rd4673296 radec5b45 124 124 } 125 125 126 uintptr_t hw_map(uintptr_t physaddr, size_t size)127 { 128 uintptr_t v irtaddr;126 uintptr_t km_map(uintptr_t paddr, size_t size, unsigned int flags) 127 { 128 uintptr_t vaddr; 129 129 size_t asize; 130 130 size_t align; 131 pfn_t i;131 uintptr_t offs; 132 132 133 133 asize = ALIGN_UP(size, PAGE_SIZE); 134 134 align = ispwr2(size) ? size : (1U << (fnzb(size) + 1)); 135 v irtaddr = km_page_alloc(asize, max(PAGE_SIZE, align));135 vaddr = km_page_alloc(asize, max(PAGE_SIZE, align)); 136 136 137 137 page_table_lock(AS_KERNEL, true); 138 for (i = 0; i < ADDR2PFN(asize); i++) { 139 uintptr_t addr = PFN2ADDR(i); 140 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, 141 PAGE_NOT_CACHEABLE | PAGE_WRITE); 138 for (offs = 0; offs < asize; offs += PAGE_SIZE) { 139 page_mapping_insert(AS_KERNEL, vaddr + offs, paddr + offs, 140 flags); 142 141 } 143 142 page_table_unlock(AS_KERNEL, true); 144 143 145 return v irtaddr;144 return vaddr; 146 145 } 147 146
Note:
See TracChangeset
for help on using the changeset viewer.