Rev 3766 | Rev 3908 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3766 | Rev 3777 | ||
|---|---|---|---|
| Line 266... | Line 266... | ||
| 266 | v->present.ps = PAGE_WIDTH; |
266 | v->present.ps = PAGE_WIDTH; |
| 267 | v->present.key = 0; |
267 | v->present.key = 0; |
| 268 | v->present.tag.tag_word = tag; |
268 | v->present.tag.tag_word = tag; |
| 269 | } |
269 | } |
| 270 | 270 | ||
| 271 | extern uintptr_t last_frame; |
- | |
| 272 | - | ||
| 273 | uintptr_t hw_map(uintptr_t physaddr, size_t size) |
271 | uintptr_t hw_map(uintptr_t physaddr, size_t size __attribute__ ((unused))) |
| 274 | { |
272 | { |
| 275 | if (last_frame + ALIGN_UP(size, PAGE_SIZE) > |
- | |
| 276 | KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) |
- | |
| 277 | panic("Unable to map physical memory %p (%d bytes)", physaddr, |
- | |
| 278 | size) |
- | |
| 279 | - | ||
| 280 | uintptr_t virtaddr = PA2KA(last_frame); |
- | |
| 281 | pfn_t i; |
- | |
| 282 | for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { |
- | |
| 283 | uintptr_t addr = PFN2ADDR(i); |
273 | /* This is a dirty hack. */ |
| 284 | page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, |
- | |
| 285 | PAGE_NOT_CACHEABLE | PAGE_WRITE); |
- | |
| 286 | } |
- | |
| 287 | - | ||
| 288 | last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
- | |
| 289 | - | ||
| 290 | return virtaddr; |
274 | return PA2KA(physaddr); |
| 291 | } |
275 | } |
| 292 | 276 | ||
| 293 | /** @} |
277 | /** @} |
| 294 | */ |
278 | */ |