Changeset 00aece0 in mainline for kernel/arch/ia64
- Timestamp:
- 2012-02-18T16:47:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4449c6c
- Parents:
- bd5f3b7 (diff), f943dd3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/arch/ia64
- Files:
-
- 3 added
- 12 edited
-
Makefile.inc (modified) (1 diff)
-
include/arch.h (modified) (1 diff)
-
include/asm.h (modified) (6 diffs)
-
include/interrupt.h (modified) (1 diff)
-
include/legacyio.h (added)
-
include/mm/frame.h (modified) (1 diff)
-
include/mm/km.h (added)
-
include/mm/page.h (modified) (1 diff)
-
src/drivers/ski.c (modified) (1 diff)
-
src/ia64.c (modified) (8 diffs)
-
src/mm/frame.c (modified) (1 diff)
-
src/mm/km.c (added)
-
src/mm/page.c (modified) (1 diff)
-
src/mm/tlb.c (modified) (19 diffs)
-
src/start.S (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/Makefile.inc
rbd5f3b7 r00aece0 52 52 arch/$(KARCH)/src/ivt.S \ 53 53 arch/$(KARCH)/src/interrupt.c \ 54 arch/$(KARCH)/src/mm/km.c \ 54 55 arch/$(KARCH)/src/mm/as.c \ 55 56 arch/$(KARCH)/src/mm/frame.c \ -
kernel/arch/ia64/include/arch.h
rbd5f3b7 r00aece0 36 36 #define KERN_ia64_ARCH_H_ 37 37 38 #include <arch/drivers/ski.h>39 40 38 extern void arch_pre_main(void); 41 39 -
kernel/arch/ia64/include/asm.h
rbd5f3b7 r00aece0 38 38 #include <config.h> 39 39 #include <typedefs.h> 40 #include <typedefs.h>41 40 #include <arch/register.h> 41 #include <arch/legacyio.h> 42 42 #include <trace.h> 43 43 44 #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL45 46 44 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 47 45 46 /** Map the I/O port address to a legacy I/O address. */ 47 NO_TRACE static inline uintptr_t p2a(volatile void *p) 48 { 49 uintptr_t prt = (uintptr_t) p; 50 51 return legacyio_virt_base + (((prt >> 2) << 12) | (prt & 0xfff)); 52 } 53 48 54 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v) 49 55 { 50 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 51 uintptr_t prt = (uintptr_t) port; 52 53 *((ioport8_t *) (IA64_IOSPACE_ADDRESS + 54 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 55 } else { 56 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) 57 *((ioport8_t *) p2a(port)) = v; 58 else 56 59 *port = v; 57 }58 60 59 61 asm volatile ( … … 65 67 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v) 66 68 { 67 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 68 uintptr_t prt = (uintptr_t) port; 69 70 *((ioport16_t *) (IA64_IOSPACE_ADDRESS + 71 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 72 } else { 69 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) 70 *((ioport16_t *) p2a(port)) = v; 71 else 73 72 *port = v; 74 }75 73 76 74 asm volatile ( … … 82 80 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v) 83 81 { 84 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 85 uintptr_t prt = (uintptr_t) port; 86 87 *((ioport32_t *) (IA64_IOSPACE_ADDRESS + 88 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 89 } else { 82 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) 83 *((ioport32_t *) p2a(port)) = v; 84 else 90 85 *port = v; 91 }92 86 93 87 asm volatile ( … … 106 100 ); 107 101 108 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 109 uintptr_t prt = (uintptr_t) port; 110 111 v = *((ioport8_t *) (IA64_IOSPACE_ADDRESS + 112 ((prt & 0xfff) | ((prt >> 2) << 12)))); 113 } else { 102 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) 103 v = *((ioport8_t *) p2a(port)); 104 else 114 105 v = *port; 115 }116 106 117 107 return v; … … 127 117 ); 128 118 129 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 130 uintptr_t prt = (uintptr_t) port; 131 132 v = *((ioport16_t *) (IA64_IOSPACE_ADDRESS + 133 ((prt & 0xfff) | ((prt >> 2) << 12)))); 134 } else { 119 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) 120 v = *((ioport16_t *) p2a(port)); 121 else 135 122 v = *port; 136 }137 123 138 124 return v; … … 148 134 ); 149 135 150 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 151 uintptr_t prt = (uintptr_t) port; 152 153 v = *((ioport32_t *) (IA64_IOSPACE_ADDRESS + 154 ((prt & 0xfff) | ((prt >> 2) << 12)))); 155 } else { 136 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) 137 v = *((ioport32_t *) p2a(port)); 138 else 156 139 v = *port; 157 }158 140 159 141 return v; -
kernel/arch/ia64/include/interrupt.h
rbd5f3b7 r00aece0 61 61 #define IRQ_KBD (0x01 + LEGACY_INTERRUPT_BASE) 62 62 #define IRQ_MOUSE (0x0c + LEGACY_INTERRUPT_BASE) 63 #define IRQ_NE2000 (0x09 + LEGACY_INTERRUPT_BASE)64 63 65 64 /** General Exception codes. */ -
kernel/arch/ia64/include/mm/frame.h
rbd5f3b7 r00aece0 43 43 #include <typedefs.h> 44 44 45 extern uintptr_t last_frame;45 extern uintptr_t end_of_identity; 46 46 47 extern void frame_arch_init(void); 47 extern void frame_low_arch_init(void); 48 extern void frame_high_arch_init(void); 48 49 #define physmem_print() 49 50 -
kernel/arch/ia64/include/mm/page.h
rbd5f3b7 r00aece0 43 43 44 44 /** Bit width of the TLB-locked portion of kernel address space. */ 45 #define KERNEL_PAGE_WIDTH 28 /* 256M */ 46 #define IO_PAGE_WIDTH 26 /* 64M */ 47 #define FW_PAGE_WIDTH 28 /* 256M */ 48 49 #define USPACE_IO_PAGE_WIDTH 12 /* 4K */ 50 51 52 /* 53 * Statically mapped IO spaces - offsets to 0xe...00 of virtual addresses 54 * because of "minimal virtual bits implemented is 51" it is possible to 55 * have values up to 0x0007000000000000 56 */ 57 58 /* Firmware area (bellow 4GB in phys mem) */ 59 #define FW_OFFSET 0x00000000F0000000 60 /* Legacy IO space */ 61 #define IO_OFFSET 0x0001000000000000 62 /* Videoram - now mapped to 0 as VGA text mode vram on 0xb8000 */ 63 #define VIO_OFFSET 0x0002000000000000 64 45 #define KERNEL_PAGE_WIDTH 28 /* 256M */ 65 46 66 47 #define PPN_SHIFT 12 -
kernel/arch/ia64/src/drivers/ski.c
rbd5f3b7 r00aece0 219 219 * self-sufficient. 220 220 */ 221 sysinfo_set_item_val("fb", NULL, true); 221 222 sysinfo_set_item_val("fb.kind", NULL, 6); 222 223 -
kernel/arch/ia64/src/ia64.c
rbd5f3b7 r00aece0 34 34 35 35 #include <arch.h> 36 #include <arch/drivers/ski.h>37 #include <arch/drivers/it.h>38 #include <arch/interrupt.h>39 #include <arch/barrier.h>40 #include <arch/asm.h>41 #include <arch/register.h>42 36 #include <typedefs.h> 43 #include <arch/context.h> 44 #include <arch/stack.h> 45 #include <arch/mm/page.h> 37 #include <errno.h> 46 38 #include <interrupt.h> 47 #include <mm/as.h>48 #include <config.h>49 39 #include <macros.h> 40 #include <str.h> 50 41 #include <userspace.h> 51 42 #include <console/console.h> 52 #include <abi/proc/uarg.h>53 43 #include <syscall/syscall.h> 54 #include <ddi/irq.h> 55 #include <arch/bootinfo.h> 44 #include <sysinfo/sysinfo.h> 45 #include <arch/drivers/it.h> 46 #include <arch/drivers/kbd.h> 47 #include <arch/legacyio.h> 48 #include <genarch/drivers/ega/ega.h> 49 #include <genarch/drivers/i8042/i8042.h> 50 #include <genarch/drivers/ns16550/ns16550.h> 56 51 #include <genarch/drivers/legacy/ia32/io.h> 57 #include <genarch/drivers/ega/ega.h>58 52 #include <genarch/kbrd/kbrd.h> 59 53 #include <genarch/srln/srln.h> 60 #include <genarch/drivers/i8042/i8042.h> 61 #include <genarch/drivers/ns16550/ns16550.h> 62 #include <arch/drivers/kbd.h> 63 #include <smp/smp.h> 64 #include <smp/ipi.h> 65 #include <arch/atomic.h> 66 #include <panic.h> 67 #include <print.h> 68 #include <sysinfo/sysinfo.h> 69 #include <str.h> 54 #include <mm/page.h> 55 #include <mm/km.h> 56 57 #ifdef MACHINE_ski 58 #include <arch/drivers/ski.h> 59 #endif 70 60 71 61 /* NS16550 as a COM 1 */ … … 75 65 76 66 static uint64_t iosapic_base = 0xfec00000; 67 uintptr_t legacyio_virt_base = 0; 77 68 78 69 /** Performs ia64-specific initialization before main_bsp() is called. */ 79 70 void arch_pre_main(void) 80 71 { 81 init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); 72 init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, 73 CONFIG_INIT_TASKS); 82 74 size_t i; 75 83 76 for (i = 0; i < init.cnt; i++) { 84 init.tasks[i].addr = 85 ((unsigned long) bootinfo->taskmap.tasks[i].addr) | 86 VRN_MASK; 77 init.tasks[i].paddr = 78 (uintptr_t) bootinfo->taskmap.tasks[i].addr; 87 79 init.tasks[i].size = bootinfo->taskmap.tasks[i].size; 88 80 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, … … 93 85 void arch_pre_mm_init(void) 94 86 { 95 /*96 * Set Interruption Vector Address (i.e. location of interruption vector97 * table).98 */99 iva_write((uintptr_t) &ivt);100 srlz_d();101 102 87 } 103 88 104 89 static void iosapic_init(void) 105 90 { 106 uint64_t IOSAPIC = PA2KA((sysarg_t)(iosapic_base)) | FW_OFFSET; 91 uintptr_t IOSAPIC = km_map(iosapic_base, PAGE_SIZE, 92 PAGE_WRITE | PAGE_NOT_CACHEABLE); 107 93 int i; 108 94 … … 131 117 { 132 118 if (config.cpu_active == 1) { 119 /* Map the page with legacy I/O. */ 120 legacyio_virt_base = km_map(LEGACYIO_PHYS_BASE, LEGACYIO_SIZE, 121 PAGE_WRITE | PAGE_NOT_CACHEABLE); 122 133 123 iosapic_init(); 134 124 irq_init(INR_COUNT, INR_COUNT); … … 198 188 sysinfo_set_item_val("kbd.address.physical", NULL, 199 189 (uintptr_t) NS16550_BASE); 200 sysinfo_set_item_val("kbd.address.kernel", NULL,201 (uintptr_t) NS16550_BASE);202 190 #endif 203 191 204 192 #ifdef CONFIG_I8042 205 i8042_instance_t *i8042_instance = i8042_init((i8042_t *) I8042_BASE, IRQ_KBD); 193 i8042_instance_t *i8042_instance = i8042_init((i8042_t *) I8042_BASE, 194 IRQ_KBD); 206 195 if (i8042_instance) { 207 196 kbrd_instance_t *kbrd_instance = kbrd_init(); … … 212 201 } 213 202 } 214 215 sysinfo_set_item_val("i8042", NULL, true); 216 sysinfo_set_item_val("i8042.inr_a", NULL, IRQ_KBD); 217 sysinfo_set_item_val("i8042.inr_b", NULL, IRQ_MOUSE); 218 sysinfo_set_item_val("i8042.address.physical", NULL, 219 (uintptr_t) I8042_BASE); 220 sysinfo_set_item_val("i8042.address.kernel", NULL, 221 (uintptr_t) I8042_BASE); 222 #endif 223 224 sysinfo_set_item_val("netif.ne2000.inr", NULL, IRQ_NE2000); 225 203 #endif 204 226 205 sysinfo_set_item_val("ia64_iospace", NULL, true); 227 206 sysinfo_set_item_val("ia64_iospace.address", NULL, true); 228 sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET);207 sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, LEGACYIO_USER_BASE); 229 208 } 230 209 … … 269 248 * We use r13 (a.k.a. tp) for this purpose. 270 249 */ 271 sysarg_t sys_tls_set( sysarg_t addr)272 { 273 return 0;250 sysarg_t sys_tls_set(uintptr_t addr) 251 { 252 return EOK; 274 253 } 275 254 … … 277 256 { 278 257 pio_write_8((ioport8_t *)0x64, 0xfe); 279 while (1) 280 ; 258 while (1); 281 259 } 282 260 -
kernel/arch/ia64/src/mm/frame.c
rbd5f3b7 r00aece0 51 51 #define MINCONF 1 52 52 53 uintptr_t last_frame = 0;53 uintptr_t end_of_identity = -1ULL; 54 54 55 void frame_arch_init(void)55 static void frame_common_arch_init(bool low) 56 56 { 57 if (config.cpu_active == 1) { 58 unsigned int i; 59 for (i = 0; i < bootinfo->memmap_items; i++) { 60 if (bootinfo->memmap[i].type == MEMMAP_FREE_MEM) { 61 uint64_t base = bootinfo->memmap[i].base; 62 uint64_t size = bootinfo->memmap[i].size; 63 uint64_t abase = ALIGN_UP(base, FRAME_SIZE); 57 unsigned int i; 64 58 65 if (size > FRAME_SIZE) 66 size -= abase - base; 59 for (i = 0; i < bootinfo->memmap_items; i++) { 60 if (bootinfo->memmap[i].type != MEMMAP_FREE_MEM) 61 continue; 67 62 68 if (size > MIN_ZONE_SIZE) { 69 zone_create(abase >> FRAME_WIDTH, 70 size >> FRAME_WIDTH, 71 max(MINCONF, abase >> FRAME_WIDTH), 72 0); 73 } 74 if (abase + size > last_frame) 75 last_frame = abase + size; 63 uintptr_t base = bootinfo->memmap[i].base; 64 size_t size = bootinfo->memmap[i].size; 65 uintptr_t abase = ALIGN_UP(base, FRAME_SIZE); 66 67 if (size > FRAME_SIZE) 68 size -= abase - base; 69 70 if (!frame_adjust_zone_bounds(low, &abase, &size)) 71 continue; 72 73 if (size > MIN_ZONE_SIZE) { 74 pfn_t pfn = ADDR2PFN(abase); 75 size_t count = SIZE2FRAMES(size); 76 77 if (low) { 78 zone_create(pfn, count, max(MINCONF, pfn), 79 ZONE_AVAILABLE | ZONE_LOWMEM); 80 } else { 81 pfn_t conf = zone_external_conf_alloc(count); 82 if (conf != 0) 83 zone_create(pfn, count, conf, 84 ZONE_AVAILABLE | ZONE_HIGHMEM); 76 85 } 77 86 } 78 79 /* 80 * Blacklist ROM regions. 81 */ 82 frame_mark_unavailable(ADDR2PFN(ROM_BASE), 83 SIZE2FRAMES(ROM_SIZE)); 87 } 88 } 84 89 85 frame_mark_unavailable(ADDR2PFN(KERNEL_RESERVED_AREA_BASE), 86 SIZE2FRAMES(KERNEL_RESERVED_AREA_SIZE)); 87 } 90 void frame_low_arch_init(void) 91 { 92 if (config.cpu_active > 1) 93 return; 94 95 frame_common_arch_init(true); 96 97 /* 98 * Blacklist ROM regions. 99 */ 100 frame_mark_unavailable(ADDR2PFN(ROM_BASE), 101 SIZE2FRAMES(ROM_SIZE)); 102 103 frame_mark_unavailable(ADDR2PFN(KERNEL_RESERVED_AREA_BASE), 104 SIZE2FRAMES(KERNEL_RESERVED_AREA_SIZE)); 105 106 /* PA2KA will work only on low-memory. */ 107 end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE; 108 } 109 110 void frame_high_arch_init(void) 111 { 112 if (config.cpu_active > 1) 113 return; 114 115 frame_common_arch_init(false); 88 116 } 89 117 -
kernel/arch/ia64/src/mm/page.c
rbd5f3b7 r00aece0 255 255 } 256 256 257 uintptr_t hw_map(uintptr_t physaddr, size_t size __attribute__ ((unused)))258 {259 /* THIS is a dirty hack. */260 return (uintptr_t)((uint64_t)(PA2KA(physaddr)) + VIO_OFFSET);261 }262 263 257 /** @} 264 258 */ -
kernel/arch/ia64/src/mm/tlb.c
rbd5f3b7 r00aece0 52 52 #include <arch.h> 53 53 #include <interrupt.h> 54 55 #define IO_FRAME_BASE 0xFFFFC000000 54 #include <arch/legacyio.h> 56 55 57 56 /** Invalidate all TLB entries. */ … … 467 466 } 468 467 468 static bool is_kernel_fault(uintptr_t va) 469 { 470 region_register_t rr; 471 472 rr.word = rr_read(VA2VRN(va)); 473 rid_t rid = rr.map.rid; 474 return (RID2ASID(rid) == ASID_KERNEL) && (VA2VRN(va) == VRN_KERNEL); 475 } 476 469 477 /** Instruction TLB fault handler for faults with VHPT turned off. 470 478 * … … 480 488 va = istate->cr_ifa; /* faulting address */ 481 489 482 page_table_lock(AS, true); 490 ASSERT(!is_kernel_fault(va)); 491 483 492 t = page_mapping_find(AS, va, true); 484 493 if (t) { … … 488 497 */ 489 498 itc_pte_copy(t); 490 page_table_unlock(AS, true);491 499 } else { 492 500 /* 493 501 * Forward the page fault to address space page fault handler. 494 502 */ 495 page_table_unlock(AS, true);496 503 if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) { 497 504 fault_if_from_uspace(istate, "Page fault at %p.", … … 522 529 static int try_memmap_io_insertion(uintptr_t va, istate_t *istate) 523 530 { 524 if ((va >= IO_OFFSET ) && (va < IO_OFFSET + (1 <<IO_PAGE_WIDTH))) {531 if ((va >= LEGACYIO_USER_BASE) && (va < LEGACYIO_USER_BASE + (1 << LEGACYIO_PAGE_WIDTH))) { 525 532 if (TASK) { 526 uint64_t io_page = (va & ((1 << IO_PAGE_WIDTH) - 1)) >>527 USPACE_IO_PAGE_WIDTH;533 uint64_t io_page = (va & ((1 << LEGACYIO_PAGE_WIDTH) - 1)) >> 534 LEGACYIO_SINGLE_PAGE_WIDTH; 528 535 529 536 if (is_io_page_accessible(io_page)) { 530 537 uint64_t page, frame; 531 538 532 page = IO_OFFSET+533 (1 << USPACE_IO_PAGE_WIDTH) * io_page;534 frame = IO_FRAME_BASE +535 (1 << USPACE_IO_PAGE_WIDTH) * io_page;539 page = LEGACYIO_USER_BASE + 540 (1 << LEGACYIO_SINGLE_PAGE_WIDTH) * io_page; 541 frame = LEGACYIO_PHYS_BASE + 542 (1 << LEGACYIO_SINGLE_PAGE_WIDTH) * io_page; 536 543 537 544 tlb_entry_t entry; … … 547 554 entry.ar = AR_READ | AR_WRITE; 548 555 entry.ppn = frame >> PPN_SHIFT; 549 entry.ps = USPACE_IO_PAGE_WIDTH;556 entry.ps = LEGACYIO_SINGLE_PAGE_WIDTH; 550 557 551 558 dtc_mapping_insert(page, TASK->as->asid, entry); … … 570 577 { 571 578 if (istate->cr_isr.sp) { 572 /* Speculative load. Deffer the exception573 until a more clever approach can be used.574 575 Currently if we try to find the mapping576 for the speculative load while in the kernel,577 we might introduce a livelock because of578 the possibly invalid values of the address.*/579 /* 580 * Speculative load. Deffer the exception until a more clever 581 * approach can be used. Currently if we try to find the 582 * mapping for the speculative load while in the kernel, we 583 * might introduce a livelock because of the possibly invalid 584 * values of the address. 585 */ 579 586 istate->cr_ipsr.ed = true; 580 587 return; … … 582 589 583 590 uintptr_t va = istate->cr_ifa; /* faulting address */ 584 585 region_register_t rr; 586 rr.word = rr_read(VA2VRN(va)); 587 rid_t rid = rr.map.rid; 588 if (RID2ASID(rid) == ASID_KERNEL) { 589 if (VA2VRN(va) == VRN_KERNEL) { 591 as_t *as = AS; 592 593 if (is_kernel_fault(va)) { 594 if (va < end_of_identity) { 590 595 /* 591 * Provide KA2PA(identity) mapping for faulting piece of 592 * kernel address space. 596 * Create kernel identity mapping for low memory. 593 597 */ 594 598 dtlb_kernel_mapping_insert(va, KA2PA(va), false, 0); 595 599 return; 600 } else { 601 as = AS_KERNEL; 596 602 } 597 603 } 598 604 599 605 600 page_table_lock(AS, true); 601 pte_t *entry = page_mapping_find(AS, va, true); 606 pte_t *entry = page_mapping_find(as, va, true); 602 607 if (entry) { 603 608 /* … … 606 611 */ 607 612 dtc_pte_copy(entry); 608 page_table_unlock(AS, true);609 613 } else { 610 page_table_unlock(AS, true);611 614 if (try_memmap_io_insertion(va, istate)) 612 615 return; … … 647 650 uintptr_t va; 648 651 pte_t *t; 652 as_t *as = AS; 649 653 650 654 va = istate->cr_ifa; /* faulting address */ 651 655 652 page_table_lock(AS, true); 653 t = page_mapping_find(AS, va, true); 656 if (is_kernel_fault(va)) 657 as = AS_KERNEL; 658 659 t = page_mapping_find(as, va, true); 654 660 ASSERT((t) && (t->p)); 655 661 if ((t) && (t->p) && (t->w)) { … … 667 673 } 668 674 } 669 page_table_unlock(AS, true);670 675 } 671 676 … … 682 687 683 688 va = istate->cr_ifa; /* faulting address */ 684 685 page_table_lock(AS, true); 689 690 ASSERT(!is_kernel_fault(va)); 691 686 692 t = page_mapping_find(AS, va, true); 687 693 ASSERT((t) && (t->p)); … … 700 706 } 701 707 } 702 page_table_unlock(AS, true);703 708 } 704 709 … … 713 718 uintptr_t va; 714 719 pte_t *t; 720 as_t *as = AS; 715 721 716 722 va = istate->cr_ifa; /* faulting address */ 717 723 718 page_table_lock(AS, true); 719 t = page_mapping_find(AS, va, true); 724 if (is_kernel_fault(va)) 725 as = AS_KERNEL; 726 727 t = page_mapping_find(as, va, true); 720 728 ASSERT((t) && (t->p)); 721 729 if ((t) && (t->p)) { … … 733 741 } 734 742 } 735 page_table_unlock(AS, true);736 743 } 737 744 … … 748 755 749 756 va = istate->cr_ifa; /* faulting address */ 757 758 ASSERT(!is_kernel_fault(va)); 750 759 751 760 /* 752 761 * Assume a write to a read-only page. 753 762 */ 754 page_table_lock(AS, true);755 763 t = page_mapping_find(AS, va, true); 756 764 ASSERT((t) && (t->p)); … … 761 769 panic_memtrap(istate, PF_ACCESS_WRITE, va, NULL); 762 770 } 763 page_table_unlock(AS, true);764 771 } 765 772 … … 777 784 va = istate->cr_ifa; /* faulting address */ 778 785 779 page_table_lock(AS, true); 786 ASSERT(!is_kernel_fault(va)); 787 780 788 t = page_mapping_find(AS, va, true); 781 789 ASSERT(t); … … 790 798 else 791 799 dtc_pte_copy(t); 792 page_table_unlock(AS, true);793 800 } else { 794 page_table_unlock(AS, true);795 801 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 796 802 fault_if_from_uspace(istate, "Page fault at %p.", -
kernel/arch/ia64/src/start.S
rbd5f3b7 r00aece0 38 38 #define KERNEL_TRANSLATION_I 0x0010000000000661 39 39 #define KERNEL_TRANSLATION_D 0x0010000000000661 40 #define KERNEL_TRANSLATION_VIO 0x001000000000067141 #define KERNEL_TRANSLATION_IO 0x00100FFFFC00067142 #define KERNEL_TRANSLATION_FW 0x00100000F000067143 40 44 41 .section K_TEXT_START, "ax" … … 88 85 itr.d dtr[r0] = r10 89 86 90 movl r7 = 1 91 movl r8 = (VRN_KERNEL << VRN_SHIFT) | VIO_OFFSET 92 mov cr.ifa = r8 93 movl r10 = (KERNEL_TRANSLATION_VIO) 94 itr.d dtr[r7] = r10 95 96 mov r11 = cr.itir 97 movl r10 = ~0xfc 98 and r10 = r10, r11 99 movl r11 = (IO_PAGE_WIDTH << PS_SHIFT) 100 or r10 = r10, r11 101 mov cr.itir = r10 102 103 movl r7 = 2 104 movl r8 = (VRN_KERNEL << VRN_SHIFT) | IO_OFFSET 105 mov cr.ifa = r8 106 movl r10 = (KERNEL_TRANSLATION_IO) 107 itr.d dtr[r7] = r10 108 109 # Setup mapping for firmware area (also SAPIC) 110 111 mov r11 = cr.itir 112 movl r10 = ~0xfc 113 and r10 = r10, r11 114 movl r11 = (FW_PAGE_WIDTH << PS_SHIFT) 115 or r10 = r10, r11 116 mov cr.itir = r10 117 118 movl r7 = 3 119 movl r8 = (VRN_KERNEL << VRN_SHIFT) | FW_OFFSET 120 mov cr.ifa = r8 121 movl r10 = (KERNEL_TRANSLATION_FW) 122 itr.d dtr[r7] = r10 123 124 # Initialize DSR 87 # Initialize DCR 125 88 126 89 movl r10 = (DCR_DP_MASK | DCR_DK_MASK | DCR_DX_MASK | DCR_DR_MASK | DCR_DA_MASK | DCR_DD_MASK | DCR_LC_MASK) … … 156 119 * Now we are paging. 157 120 */ 121 122 # 123 # Set Interruption Vector Address 124 # (i.e. location of interruption vector table) 125 # 126 movl r8 = ivt ;; 127 mov cr.iva = r8 128 srlz.d ;; 129 158 130 159 131 # Switch to register bank 1 … … 167 139 168 140 # 169 # Initialize memory stack to some sane value and allocate a scratch are 141 # Initialize memory stack to some sane value and allocate a scratch area 170 142 # on it. 171 143 #
Note:
See TracChangeset
for help on using the changeset viewer.
