Changes in / [9970a5a:d81eaf94] in mainline
- Location:
- kernel
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/arm32.c
r9970a5a rd81eaf94 57 57 size_t i; 58 58 for (i = 0; i < init.cnt; i++) { 59 init.tasks[i]. paddr = KA2PA(bootinfo->tasks[i].addr);59 init.tasks[i].addr = (uintptr_t) bootinfo->tasks[i].addr; 60 60 init.tasks[i].size = bootinfo->tasks[i].size; 61 61 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, -
kernel/arch/arm32/src/mach/gta02/gta02.c
r9970a5a rd81eaf94 38 38 #include <arch/mm/page.h> 39 39 #include <mm/page.h> 40 #include <mm/km.h>41 40 #include <genarch/fb/fb.h> 42 41 #include <abi/fb/visuals.h> … … 102 101 s3c24xx_irqc_regs_t *irqc_regs; 103 102 104 gta02_timer = (void *) km_map(S3C24XX_TIMER_ADDRESS, PAGE_SIZE, 105 PAGE_NOT_CACHEABLE); 106 irqc_regs = (void *) km_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE, 107 PAGE_NOT_CACHEABLE); 103 gta02_timer = (void *) hw_map(S3C24XX_TIMER_ADDRESS, PAGE_SIZE); 104 irqc_regs = (void *) hw_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE); 108 105 109 106 /* Initialize interrupt controller. */ -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
r9970a5a rd81eaf94 45 45 #include <mm/page.h> 46 46 #include <mm/frame.h> 47 #include <mm/km.h>48 47 #include <arch/mm/frame.h> 49 48 #include <arch/mach/integratorcp/integratorcp.h> … … 129 128 void icp_init(void) 130 129 { 131 icp_hw_map.uart = km_map(ICP_UART, PAGE_SIZE, 132 PAGE_WRITE | PAGE_NOT_CACHEABLE); 133 icp_hw_map.kbd_ctrl = km_map(ICP_KBD, PAGE_SIZE, PAGE_NOT_CACHEABLE); 130 icp_hw_map.uart = hw_map(ICP_UART, PAGE_SIZE); 131 icp_hw_map.kbd_ctrl = hw_map(ICP_KBD, PAGE_SIZE); 134 132 icp_hw_map.kbd_stat = icp_hw_map.kbd_ctrl + ICP_KBD_STAT; 135 133 icp_hw_map.kbd_data = icp_hw_map.kbd_ctrl + ICP_KBD_DATA; 136 134 icp_hw_map.kbd_intstat = icp_hw_map.kbd_ctrl + ICP_KBD_INTR_STAT; 137 icp_hw_map.rtc = km_map(ICP_RTC, PAGE_SIZE, 138 PAGE_WRITE | PAGE_NOT_CACHEABLE); 135 icp_hw_map.rtc = hw_map(ICP_RTC, PAGE_SIZE); 139 136 icp_hw_map.rtc1_load = icp_hw_map.rtc + ICP_RTC1_LOAD_OFFSET; 140 137 icp_hw_map.rtc1_read = icp_hw_map.rtc + ICP_RTC1_READ_OFFSET; … … 144 141 icp_hw_map.rtc1_intrstat = icp_hw_map.rtc + ICP_RTC1_INTRSTAT_OFFSET; 145 142 146 icp_hw_map.irqc = km_map(ICP_IRQC, PAGE_SIZE, 147 PAGE_WRITE | PAGE_NOT_CACHEABLE); 143 icp_hw_map.irqc = hw_map(ICP_IRQC, PAGE_SIZE); 148 144 icp_hw_map.irqc_mask = icp_hw_map.irqc + ICP_IRQC_MASK_OFFSET; 149 145 icp_hw_map.irqc_unmask = icp_hw_map.irqc + ICP_IRQC_UNMASK_OFFSET; 150 icp_hw_map.cmcr = km_map(ICP_CMCR, PAGE_SIZE, 151 PAGE_WRITE | PAGE_NOT_CACHEABLE); 146 icp_hw_map.cmcr = hw_map(ICP_CMCR, PAGE_SIZE); 152 147 icp_hw_map.sdramcr = icp_hw_map.cmcr + ICP_SDRAMCR_OFFSET; 153 icp_hw_map.vga = km_map(ICP_VGA, PAGE_SIZE, 154 PAGE_WRITE | PAGE_NOT_CACHEABLE); 148 icp_hw_map.vga = hw_map(ICP_VGA, PAGE_SIZE); 155 149 156 150 hw_map_init_called = true; -
kernel/arch/arm32/src/mach/testarm/testarm.c
r9970a5a rd81eaf94 37 37 #include <arch/mach/testarm/testarm.h> 38 38 #include <mm/page.h> 39 #include <mm/km.h>40 39 #include <genarch/fb/fb.h> 41 40 #include <abi/fb/visuals.h> … … 72 71 void gxemul_init(void) 73 72 { 74 gxemul_kbd = (void *) km_map(GXEMUL_KBD_ADDRESS, PAGE_SIZE, 75 PAGE_WRITE | PAGE_NOT_CACHEABLE); 76 gxemul_rtc = (void *) km_map(GXEMUL_RTC_ADDRESS, PAGE_SIZE, 77 PAGE_WRITE | PAGE_NOT_CACHEABLE); 78 gxemul_irqc = (void *) km_map(GXEMUL_IRQC_ADDRESS, PAGE_SIZE, 79 PAGE_WRITE | PAGE_NOT_CACHEABLE); 73 gxemul_kbd = (void *) hw_map(GXEMUL_KBD_ADDRESS, PAGE_SIZE); 74 gxemul_rtc = (void *) hw_map(GXEMUL_RTC_ADDRESS, PAGE_SIZE); 75 gxemul_irqc = (void *) hw_map(GXEMUL_IRQC_ADDRESS, PAGE_SIZE); 80 76 } 81 77 -
kernel/arch/ia32/src/smp/smp.c
r9970a5a rd81eaf94 47 47 #include <debug.h> 48 48 #include <arch/asm.h> 49 #include <mm/frame.h> 49 50 #include <mm/page.h> 50 #include <mm/frame.h>51 #include <mm/km.h>52 51 #include <mm/slab.h> 53 52 #include <mm/as.h> … … 73 72 74 73 if (config.cpu_count > 1) { 75 l_apic = (uint32_t *) km_map((uintptr_t) l_apic, PAGE_SIZE, 76 PAGE_WRITE | PAGE_NOT_CACHEABLE); 77 io_apic = (uint32_t *) km_map((uintptr_t) io_apic, PAGE_SIZE, 78 PAGE_WRITE | PAGE_NOT_CACHEABLE); 74 l_apic = (uint32_t *) hw_map((uintptr_t) l_apic, PAGE_SIZE); 75 io_apic = (uint32_t *) hw_map((uintptr_t) io_apic, PAGE_SIZE); 79 76 } 80 77 } -
kernel/arch/ia64/src/ia64.c
r9970a5a rd81eaf94 53 53 #include <genarch/srln/srln.h> 54 54 #include <mm/page.h> 55 #include <mm/km.h>56 55 57 56 #ifdef MACHINE_ski … … 70 69 void arch_pre_main(void) 71 70 { 72 init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, 73 CONFIG_INIT_TASKS); 71 init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); 74 72 size_t i; 75 76 73 for (i = 0; i < init.cnt; i++) { 77 init.tasks[i].paddr = 78 (uintptr_t) bootinfo->taskmap.tasks[i].addr; 74 init.tasks[i].addr = 75 ((unsigned long) bootinfo->taskmap.tasks[i].addr) | 76 VRN_MASK; 79 77 init.tasks[i].size = bootinfo->taskmap.tasks[i].size; 80 78 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, … … 89 87 static void iosapic_init(void) 90 88 { 91 uintptr_t IOSAPIC = km_map(iosapic_base, PAGE_SIZE, 92 PAGE_WRITE | PAGE_NOT_CACHEABLE); 89 uintptr_t IOSAPIC = hw_map(iosapic_base, PAGE_SIZE); 93 90 int i; 94 91 … … 118 115 if (config.cpu_active == 1) { 119 116 /* Map the page with legacy I/O. */ 120 legacyio_virt_base = km_map(LEGACYIO_PHYS_BASE, LEGACYIO_SIZE, 121 PAGE_WRITE | PAGE_NOT_CACHEABLE); 117 legacyio_virt_base = hw_map(LEGACYIO_PHYS_BASE, LEGACYIO_SIZE); 122 118 123 119 iosapic_init(); -
kernel/arch/mips32/src/mips32.c
r9970a5a rd81eaf94 78 78 size_t i; 79 79 for (i = 0; i < init.cnt; i++) { 80 init.tasks[i]. paddr = KA2PA(bootinfo->tasks[i].addr);80 init.tasks[i].addr = (uintptr_t) bootinfo->tasks[i].addr; 81 81 init.tasks[i].size = bootinfo->tasks[i].size; 82 82 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, -
kernel/arch/mips32/src/mm/frame.c
r9970a5a rd81eaf94 123 123 for (i = 0; i < init.cnt; i++) 124 124 if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE, 125 init.tasks[i].paddr, init.tasks[i].size)) {125 KA2PA(init.tasks[i].addr), init.tasks[i].size)) { 126 126 safe = false; 127 127 break; -
kernel/arch/mips64/src/mips64.c
r9970a5a rd81eaf94 78 78 size_t i; 79 79 for (i = 0; i < init.cnt; i++) { 80 init.tasks[i]. paddr = KA2PA(bootinfo->tasks[i].addr);80 init.tasks[i].addr = (uintptr_t) bootinfo->tasks[i].addr; 81 81 init.tasks[i].size = bootinfo->tasks[i].size; 82 82 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, -
kernel/arch/mips64/src/mm/frame.c
r9970a5a rd81eaf94 115 115 for (i = 0; i < init.cnt; i++) 116 116 if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE, 117 init.tasks[i].paddr, init.tasks[i].size)) {117 KA2PA(init.tasks[i].addr), init.tasks[i].size)) { 118 118 safe = false; 119 119 break; -
kernel/arch/ppc32/src/drivers/pic.c
r9970a5a rd81eaf94 34 34 35 35 #include <arch/drivers/pic.h> 36 #include <mm/ km.h>36 #include <mm/page.h> 37 37 #include <byteorder.h> 38 38 #include <bitops.h> … … 42 42 void pic_init(uintptr_t base, size_t size, cir_t *cir, void **cir_arg) 43 43 { 44 pic = (uint32_t *) km_map(base, size, PAGE_WRITE | PAGE_NOT_CACHEABLE);44 pic = (uint32_t *) hw_map(base, size); 45 45 *cir = pic_ack_interrupt; 46 46 *cir_arg = NULL; -
kernel/arch/ppc32/src/ppc32.c
r9970a5a rd81eaf94 46 46 #include <userspace.h> 47 47 #include <mm/page.h> 48 #include <mm/km.h>49 48 #include <abi/proc/uarg.h> 50 49 #include <console/console.h> … … 72 71 size_t i; 73 72 for (i = 0; i < init.cnt; i++) { 74 init.tasks[i]. paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);73 init.tasks[i].addr = (uintptr_t) bootinfo->taskmap.tasks[i].addr; 75 74 init.tasks[i].size = bootinfo->taskmap.tasks[i].size; 76 75 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, … … 209 208 size_t size = 2 * PAGE_SIZE; 210 209 211 cuda_t *cuda = (cuda_t *) (km_map(aligned_addr, offset + size,212 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset);210 cuda_t *cuda = (cuda_t *) 211 (hw_map(aligned_addr, offset + size) + offset); 213 212 214 213 /* Initialize I/O controller */ -
kernel/arch/sparc64/src/drivers/kbd.c
r9970a5a rd81eaf94 40 40 #include <mm/page.h> 41 41 #include <arch/mm/page.h> 42 #include <mm/km.h>43 42 #include <typedefs.h> 44 43 #include <align.h> … … 114 113 size_t offset = pa - aligned_addr; 115 114 116 ns16550_t *ns16550 = (ns16550_t *) (km_map(aligned_addr, offset + size,117 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset);115 ns16550_t *ns16550 = (ns16550_t *) 116 (hw_map(aligned_addr, offset + size) + offset); 118 117 119 118 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, cir_arg); -
kernel/arch/sparc64/src/drivers/pci.c
r9970a5a rd81eaf94 39 39 #include <genarch/ofw/upa.h> 40 40 #include <arch/trap/interrupt.h> 41 #include <mm/ km.h>41 #include <mm/page.h> 42 42 #include <mm/slab.h> 43 43 #include <typedefs.h> … … 109 109 pci->model = PCI_SABRE; 110 110 pci->op = &pci_sabre_ops; 111 pci->reg = (uint64_t *) km_map(paddr, reg[SABRE_INTERNAL_REG].size, 112 PAGE_WRITE | PAGE_NOT_CACHEABLE); 111 pci->reg = (uint64_t *) hw_map(paddr, reg[SABRE_INTERNAL_REG].size); 113 112 114 113 /* … … 157 156 pci->model = PCI_PSYCHO; 158 157 pci->op = &pci_psycho_ops; 159 pci->reg = (uint64_t *) km_map(paddr, reg[PSYCHO_INTERNAL_REG].size, 160 PAGE_WRITE | PAGE_NOT_CACHEABLE); 158 pci->reg = (uint64_t *) hw_map(paddr, reg[PSYCHO_INTERNAL_REG].size); 161 159 162 160 /* -
kernel/arch/sparc64/src/sun4u/sparc64.c
r9970a5a rd81eaf94 62 62 size_t i; 63 63 for (i = 0; i < init.cnt; i++) { 64 init.tasks[i]. paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);64 init.tasks[i].addr = (uintptr_t) bootinfo->taskmap.tasks[i].addr; 65 65 init.tasks[i].size = bootinfo->taskmap.tasks[i].size; 66 66 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, -
kernel/arch/sparc64/src/sun4v/sparc64.c
r9970a5a rd81eaf94 64 64 size_t i; 65 65 for (i = 0; i < init.cnt; i++) { 66 init.tasks[i]. paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);66 init.tasks[i].addr = (uintptr_t) bootinfo->taskmap.tasks[i].addr; 67 67 init.tasks[i].size = bootinfo->taskmap.tasks[i].size; 68 68 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, -
kernel/genarch/src/drivers/ega/ega.c
r9970a5a rd81eaf94 37 37 #include <genarch/drivers/ega/ega.h> 38 38 #include <putchar.h> 39 #include <mm/ km.h>39 #include <mm/page.h> 40 40 #include <mm/as.h> 41 41 #include <mm/slab.h> 42 #include <arch/mm/page.h> 42 43 #include <typedefs.h> 43 44 #include <arch/asm.h> … … 597 598 598 599 instance->base = base; 599 instance->addr = (uint8_t *) km_map(addr, EGA_VRAM_SIZE, 600 PAGE_WRITE | PAGE_NOT_CACHEABLE); 600 instance->addr = (uint8_t *) hw_map(addr, EGA_VRAM_SIZE); 601 601 if (!instance->addr) { 602 602 LOG("Unable to EGA video memory."); -
kernel/genarch/src/drivers/s3c24xx_uart/s3c24xx_uart.c
r9970a5a rd81eaf94 45 45 #include <mm/slab.h> 46 46 #include <mm/page.h> 47 #include <mm/km.h>48 47 #include <sysinfo/sysinfo.h> 49 48 #include <str.h> … … 114 113 uart_dev->data = uart; 115 114 116 uart->io = (s3c24xx_uart_io_t *) km_map(paddr, PAGE_SIZE, 117 PAGE_WRITE | PAGE_NOT_CACHEABLE); 115 uart->io = (s3c24xx_uart_io_t *) hw_map(paddr, PAGE_SIZE); 118 116 uart->indev = NULL; 119 117 -
kernel/genarch/src/fb/fb.c
r9970a5a rd81eaf94 40 40 #include <console/console.h> 41 41 #include <sysinfo/sysinfo.h> 42 #include <mm/ km.h>42 #include <mm/page.h> 43 43 #include <mm/slab.h> 44 44 #include <align.h> … … 587 587 size_t glyphsize = FONT_GLYPHS * instance->glyphbytes; 588 588 589 instance->addr = (uint8_t *) km_map((uintptr_t) props->addr, fbsize, 590 PAGE_WRITE | PAGE_NOT_CACHEABLE); 589 instance->addr = (uint8_t *) hw_map((uintptr_t) props->addr, fbsize); 591 590 if (!instance->addr) { 592 591 LOG("Unable to map framebuffer."); -
kernel/genarch/src/multiboot/multiboot.c
r9970a5a rd81eaf94 77 77 break; 78 78 79 init.tasks[init.cnt]. paddr = mods[i].start;79 init.tasks[init.cnt].addr = PA2KA(mods[i].start); 80 80 init.tasks[init.cnt].size = mods[i].end - mods[i].start; 81 81 -
kernel/genarch/src/multiboot/multiboot2.c
r9970a5a rd81eaf94 45 45 { 46 46 if (init.cnt < CONFIG_INIT_TASKS) { 47 init.tasks[init.cnt]. paddr = module->start;47 init.tasks[init.cnt].addr = PA2KA(module->start); 48 48 init.tasks[init.cnt].size = module->end - module->start; 49 49 multiboot_extract_command(init.tasks[init.cnt].name, -
kernel/generic/include/config.h
r9970a5a rd81eaf94 53 53 54 54 typedef struct { 55 uintptr_t paddr;55 uintptr_t addr; 56 56 size_t size; 57 57 char name[CONFIG_TASK_NAME_BUFLEN]; -
kernel/generic/include/mm/km.h
r9970a5a rd81eaf94 49 49 extern bool km_is_non_identity(uintptr_t); 50 50 51 extern uintptr_t km_map(uintptr_t, size_t, unsigned int);52 53 51 extern uintptr_t km_temporary_page_get(uintptr_t *, frame_flags_t); 54 52 extern void km_temporary_page_put(uintptr_t); -
kernel/generic/include/mm/page.h
r9970a5a rd81eaf94 66 66 extern void map_structure(uintptr_t, size_t); 67 67 68 extern uintptr_t hw_map(uintptr_t, size_t); 69 68 70 extern int page_find_mapping(uintptr_t, void **); 69 71 extern sysarg_t sys_page_find_mapping(uintptr_t, void *); -
kernel/generic/src/lib/rd.c
r9970a5a rd81eaf94 54 54 void init_rd(void *data, size_t size) 55 55 { 56 uintptr_t base = (uintptr_t) data;56 uintptr_t base = KA2PA((uintptr_t) data); 57 57 ASSERT((base % FRAME_SIZE) == 0); 58 58 -
kernel/generic/src/main/kinit.c
r9970a5a rd81eaf94 57 57 #include <mm/as.h> 58 58 #include <mm/frame.h> 59 #include <mm/km.h>60 59 #include <print.h> 61 60 #include <memstr.h> … … 69 68 #include <str.h> 70 69 #include <sysinfo/stats.h> 71 #include <align.h>72 70 73 71 #ifdef CONFIG_SMP … … 180 178 181 179 for (i = 0; i < init.cnt; i++) { 182 if (init.tasks[i]. paddr % FRAME_SIZE) {180 if (init.tasks[i].addr % FRAME_SIZE) { 183 181 printf("init[%zu]: Address is not frame aligned\n", i); 184 182 programs[i].task = NULL; … … 201 199 str_cpy(namebuf + INIT_PREFIX_LEN, 202 200 TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name); 203 204 /* 205 * Create virtual memory mappings for init task images. 206 */ 207 uintptr_t page = km_map(init.tasks[i].paddr, 208 init.tasks[i].size, 209 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 210 ASSERT(page); 211 212 int rc = program_create_from_image((void *) page, namebuf, 213 &programs[i]); 201 202 int rc = program_create_from_image((void *) init.tasks[i].addr, 203 namebuf, &programs[i]); 214 204 215 205 if (rc == 0) { … … 234 224 * Assume the last task is the RAM disk. 235 225 */ 236 init_rd((void *) init.tasks[i]. paddr, init.tasks[i].size);226 init_rd((void *) init.tasks[i].addr, init.tasks[i].size); 237 227 } else 238 228 printf("init[%zu]: Init binary load failed (error %d)\n", i, rc); -
kernel/generic/src/main/main.c
r9970a5a rd81eaf94 151 151 size_t i; 152 152 for (i = 0; i < init.cnt; i++) { 153 if (overlaps(KA2PA(config.stack_base), config.stack_size, 154 init.tasks[i].paddr, init.tasks[i].size)) { 155 /* 156 * The init task overlaps with the memory behind the 157 * kernel image so it must be in low memory and we can 158 * use PA2KA on the init task's physical address. 159 */ 160 config.stack_base = ALIGN_UP( 161 PA2KA(init.tasks[i].paddr) + init.tasks[i].size, 162 config.stack_size); 163 } 153 if (PA_OVERLAPS(config.stack_base, config.stack_size, 154 init.tasks[i].addr, init.tasks[i].size)) 155 config.stack_base = ALIGN_UP(init.tasks[i].addr + 156 init.tasks[i].size, config.stack_size); 164 157 } 165 158 -
kernel/generic/src/mm/backend_elf.c
r9970a5a rd81eaf94 318 318 dirty = true; 319 319 } else { 320 pte_t *pte = page_mapping_find(AS_KERNEL, 321 base + i * FRAME_SIZE, true); 322 323 ASSERT(pte); 324 ASSERT(PTE_PRESENT(pte)); 325 326 frame = PTE_GET_FRAME(pte); 320 frame = KA2PA(base + i * FRAME_SIZE); 327 321 } 328 322 } else if (upage >= start_anon) { -
kernel/generic/src/mm/frame.c
r9970a5a rd81eaf94 924 924 for (i = 0; i < init.cnt; i++) 925 925 if (overlaps(addr, PFN2ADDR(confcount), 926 init.tasks[i].paddr,926 KA2PA(init.tasks[i].addr), 927 927 init.tasks[i].size)) { 928 928 overlap = true; … … 1251 1251 size_t i; 1252 1252 for (i = 0; i < init.cnt; i++) { 1253 pfn_t pfn = ADDR2PFN( init.tasks[i].paddr);1253 pfn_t pfn = ADDR2PFN(KA2PA(init.tasks[i].addr)); 1254 1254 frame_mark_unavailable(pfn, 1255 1255 SIZE2FRAMES(init.tasks[i].size)); -
kernel/generic/src/mm/km.c
r9970a5a rd81eaf94 46 46 #include <debug.h> 47 47 #include <arch.h> 48 #include <align.h>49 #include <macros.h>50 #include <bitops.h>51 48 52 49 static ra_arena_t *km_ni_arena; … … 123 120 ra_free(km_ni_arena, page, size); 124 121 } 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 147 122 148 123 /** Unmap kernen non-identity page. … … 190 165 FRAME_HIGHMEM | FRAME_ATOMIC | flags); 191 166 if (frame) { 192 page = km_map(frame, PAGE_SIZE, 193 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 167 page = km_page_alloc(PAGE_SIZE, PAGE_SIZE); 194 168 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); 195 173 } else { 196 174 frame = (uintptr_t) frame_alloc_noreserve(ONE_FRAME, -
kernel/generic/src/mm/page.c
r9970a5a rd81eaf94 65 65 #include <arch/mm/asid.h> 66 66 #include <mm/as.h> 67 #include <mm/km.h> 67 68 #include <mm/frame.h> 68 69 #include <arch/barrier.h> … … 75 76 #include <errno.h> 76 77 #include <align.h> 78 #include <macros.h> 79 #include <bitops.h> 77 80 78 81 /** Virtual operations for page subsystem. */ … … 190 193 } 191 194 195 uintptr_t hw_map(uintptr_t physaddr, size_t size) 196 { 197 uintptr_t virtaddr; 198 size_t asize; 199 size_t align; 200 pfn_t i; 201 202 asize = ALIGN_UP(size, PAGE_SIZE); 203 align = ispwr2(size) ? size : (1U << (fnzb(size) + 1)); 204 virtaddr = km_page_alloc(asize, max(PAGE_SIZE, align)); 205 206 page_table_lock(AS_KERNEL, true); 207 for (i = 0; i < ADDR2PFN(asize); i++) { 208 uintptr_t addr = PFN2ADDR(i); 209 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, 210 PAGE_NOT_CACHEABLE | PAGE_WRITE); 211 } 212 page_table_unlock(AS_KERNEL, true); 213 214 return virtaddr; 215 } 216 192 217 int page_find_mapping(uintptr_t virt, void **phys) 193 218 {
Note:
See TracChangeset
for help on using the changeset viewer.