Changeset 46c20c8 in mainline for kernel/arch/ia64/src
- Timestamp:
- 2010-11-26T20:08:10Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 45df59a
- Parents:
- fb150d78 (diff), ffdd2b9 (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/src
- Files:
-
- 12 edited
-
asm.S (modified) (8 diffs)
-
cpu/cpu.c (modified) (1 diff)
-
ddi/ddi.c (modified) (1 diff)
-
debug/stacktrace.c (modified) (1 diff)
-
drivers/it.c (modified) (7 diffs)
-
drivers/ski.c (modified) (2 diffs)
-
ia64.c (modified) (5 diffs)
-
interrupt.c (modified) (12 diffs)
-
mm/page.c (modified) (1 diff)
-
mm/tlb.c (modified) (8 diffs)
-
smp/smp.c (modified) (1 diff)
-
start.S (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/asm.S
rfb150d78 r46c20c8 1 # 2 #Copyright (c) 2005 Jakub Jermar3 #All rights reserved.4 # 5 #Redistribution and use in source and binary forms, with or without6 #modification, are permitted provided that the following conditions7 #are met:8 # 9 #- Redistributions of source code must retain the above copyright10 #notice, this list of conditions and the following disclaimer.11 #- Redistributions in binary form must reproduce the above copyright12 #notice, this list of conditions and the following disclaimer in the13 #documentation and/or other materials provided with the distribution.14 #- The name of the author may not be used to endorse or promote products15 #derived from this software without specific prior written permission.16 # 17 #THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR18 #IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES19 #OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.20 #IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,21 #INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT22 #NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23 #DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24 #THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25 #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF26 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.27 # 1 /* 2 * Copyright (c) 2005 Jakub Jermar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 28 29 29 #include <arch/register.h> 30 30 31 31 .text 32 33 /** Copy memory from/to userspace.34 *35 * This memcpy() has been taken from the assembler output of36 * the generic _memcpy() and modified to have the failover part.37 *38 * @param in0 Destination address.39 * @param in1 Source address.40 * @param in2 Number of byte to copy.41 */42 32 .global memcpy 43 33 .global memcpy_from_uspace … … 45 35 .global memcpy_from_uspace_failover_address 46 36 .global memcpy_to_uspace_failover_address 37 38 /** Copy memory from/to userspace. 39 * 40 * This memcpy() has been taken from the assembler output of 41 * the generic _memcpy() and modified to have the failover part. 42 * 43 * @param in0 Destination address. 44 * @param in1 Source address. 45 * @param in2 Number of byte to copy. 46 * 47 */ 47 48 memcpy: 48 49 memcpy_from_uspace: 49 50 memcpy_to_uspace: 50 51 alloc loc0 = ar.pfs, 3, 1, 0, 0 51 52 52 53 adds r14 = 7, in1 53 54 mov r2 = ar.lc … … 55 56 and r14 = -8, r14 ;; 56 57 cmp.ne p6, p7 = r14, in1 57 (p7) br.cond.dpnt 3f ;; 58 0: 59 cmp.ne p6, p7 = 0, in2 60 (p7) br.cond.dpnt 2f ;; 61 (p6) adds r14 = -1, in2 62 (p6) mov r16 = r0 63 (p6) mov r17 = r0 ;; 64 (p6) mov ar.lc = r14 65 1: 66 add r14 = r16, in1 67 add r15 = r16, in0 68 adds r17 = 1, r17 ;; 69 ld1 r14 = [r14] 70 mov r16 = r17 ;; 71 st1 [r15] = r14 72 br.cloop.sptk.few 1b ;; 73 2: 74 mov ar.lc = r2 75 mov ar.pfs = loc0 76 br.ret.sptk.many rp 77 3: 78 adds r14 = 7, in0 ;; 79 and r14 = -8, r14 ;; 80 cmp.eq p6, p7 = r14, in0 81 (p7) br.cond.dptk 0b 82 shr.u r18 = in2, 3 ;; 83 cmp.ne p6, p7 = 0, r18 84 (p7) br.cond.dpnt 5f ;; 85 (p6) adds r14 = -1, r18 86 (p6) mov r16 = r0 87 (p6) mov r17 = r0 ;; 88 (p6) mov ar.lc = r14 89 4: 90 shladd r14 = r16, 3, r0 91 adds r16 = 1, r17 ;; 92 add r15 = in1, r14 93 add r14 = in0, r14 94 mov r17 = r16 ;; 95 ld8 r15 = [r15] ;; 96 st8 [r14] = r15 97 br.cloop.sptk.few 4b 98 5: 99 and r15 = 7, in2 100 shladd r14 = r18, 3, r0 101 mov r16 = r0 102 mov r18 = r0 ;; 103 cmp.eq p6, p7 = 0, r15 104 add in0 = r14, in0 105 adds r15 = -1, r15 106 add r17 = r14, in1 107 (p6) br.cond.dpnt 2b ;; 108 mov ar.lc = r15 109 6: 110 add r14 = r16, r17 111 add r15 = r16, in0 112 adds r16 = 1, r18 ;; 113 ld1 r14 = [r14] 114 mov r18 = r16 ;; 115 st1 [r15] = r14 116 br.cloop.sptk.few 6b ;; 117 mov ar.lc = r2 118 mov ar.pfs = loc0 119 br.ret.sptk.many rp 120 58 (p7) br.cond.dpnt 3f ;; 59 60 0: 61 62 cmp.ne p6, p7 = 0, in2 63 (p7) br.cond.dpnt 2f ;; 64 (p6) adds r14 = -1, in2 65 (p6) mov r16 = r0 66 (p6) mov r17 = r0 ;; 67 (p6) mov ar.lc = r14 68 69 1: 70 71 add r14 = r16, in1 72 add r15 = r16, in0 73 adds r17 = 1, r17 ;; 74 ld1 r14 = [r14] 75 mov r16 = r17 ;; 76 st1 [r15] = r14 77 br.cloop.sptk.few 1b ;; 78 79 2: 80 81 mov ar.lc = r2 82 mov ar.pfs = loc0 83 br.ret.sptk.many rp 84 85 3: 86 87 adds r14 = 7, in0 ;; 88 and r14 = -8, r14 ;; 89 cmp.eq p6, p7 = r14, in0 90 (p7) br.cond.dptk 0b 91 shr.u r18 = in2, 3 ;; 92 cmp.ne p6, p7 = 0, r18 93 (p7) br.cond.dpnt 5f ;; 94 (p6) adds r14 = -1, r18 95 (p6) mov r16 = r0 96 (p6) mov r17 = r0 ;; 97 (p6) mov ar.lc = r14 98 99 4: 100 101 shladd r14 = r16, 3, r0 102 adds r16 = 1, r17 ;; 103 add r15 = in1, r14 104 add r14 = in0, r14 105 mov r17 = r16 ;; 106 ld8 r15 = [r15] ;; 107 st8 [r14] = r15 108 br.cloop.sptk.few 4b 109 110 5: 111 112 and r15 = 7, in2 113 shladd r14 = r18, 3, r0 114 mov r16 = r0 115 mov r18 = r0 ;; 116 cmp.eq p6, p7 = 0, r15 117 add in0 = r14, in0 118 adds r15 = -1, r15 119 add r17 = r14, in1 120 (p6) br.cond.dpnt 2b ;; 121 mov ar.lc = r15 122 123 6: 124 125 add r14 = r16, r17 126 add r15 = r16, in0 127 adds r16 = 1, r18 ;; 128 ld1 r14 = [r14] 129 mov r18 = r16 ;; 130 st1 [r15] = r14 131 br.cloop.sptk.few 6b ;; 132 mov ar.lc = r2 133 mov ar.pfs = loc0 134 br.ret.sptk.many rp 135 121 136 memcpy_from_uspace_failover_address: 122 137 memcpy_to_uspace_failover_address: 123 mov r8 = r0 /* return 0 on failure */ 138 /* Return 0 on failure */ 139 mov r8 = r0 124 140 mov ar.pfs = loc0 125 141 br.ret.sptk.many rp … … 136 152 cpu_halt: 137 153 br cpu_halt 138 139 .global panic_printf140 panic_printf:141 {142 br.call.sptk.many b0=printf143 }144 br halt145 154 146 155 /** Switch to userspace - low level code. … … 152 161 * @param in4 Value to be stored in IPSR. 153 162 * @param in5 Value to be stored in RSC. 163 * 154 164 */ 155 165 .global switch_to_userspace 156 166 switch_to_userspace: 157 167 alloc loc0 = ar.pfs, 6, 3, 0, 0 158 rsm (PSR_IC_MASK | PSR_I_MASK) /* disable interruption collection and interrupts */ 168 169 /* Disable interruption collection and interrupts */ 170 rsm (PSR_IC_MASK | PSR_I_MASK) 159 171 srlz.d ;; 160 172 srlz.i ;; … … 163 175 mov cr.iip = in0 164 176 mov r12 = in1 165 177 166 178 xor r1 = r1, r1 167 179 … … 172 184 movl loc2 = PFM_MASK ;; 173 185 and loc1 = loc2, loc1 ;; 174 mov cr.ifs = loc1 ;; /* prevent decrementing BSP by rfi */175 186 mov cr.ifs = loc1 ;; /* prevent decrementing BSP by rfi */ 187 176 188 invala 177 189 178 190 mov loc1 = ar.rsc ;; 179 and loc1 = ~3, loc1 ;; 180 mov ar.rsc = loc1 ;; /* put RSE into enforced lazy mode */181 191 and loc1 = ~3, loc1 ;; 192 mov ar.rsc = loc1 ;; /* put RSE into enforced lazy mode */ 193 182 194 flushrs ;; 183 195 … … 188 200 189 201 rfi ;; 202 203 .global early_putchar 204 early_putchar: 205 br.ret.sptk.many b0 -
kernel/arch/ia64/src/cpu/cpu.c
rfb150d78 r46c20c8 52 52 void cpu_print_report(cpu_t *m) 53 53 { 54 c har *family_str;54 const char *family_str; 55 55 char vendor[2 * sizeof(uint64_t) + 1]; 56 56 -
kernel/arch/ia64/src/ddi/ddi.c
rfb150d78 r46c20c8 36 36 #include <ddi/ddi.h> 37 37 #include <proc/task.h> 38 #include < arch/types.h>38 #include <typedefs.h> 39 39 #include <mm/slab.h> 40 40 #include <errno.h> -
kernel/arch/ia64/src/debug/stacktrace.c
rfb150d78 r46c20c8 35 35 #include <stacktrace.h> 36 36 #include <syscall/copy.h> 37 #include <arch/types.h>38 37 #include <typedefs.h> 39 38 40 bool kernel_ frame_pointer_validate(uintptr_t fp)39 bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx) 41 40 { 42 41 return false; 43 42 } 44 43 45 bool kernel_frame_pointer_prev( uintptr_t fp, uintptr_t *prev)44 bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev) 46 45 { 47 46 return false; 48 47 } 49 48 50 bool kernel_return_address_get( uintptr_t fp, uintptr_t *ra)49 bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra) 51 50 { 52 51 return false; 53 52 } 54 53 55 bool uspace_ frame_pointer_validate(uintptr_t fp)54 bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx) 56 55 { 57 56 return false; 58 57 } 59 58 60 bool uspace_frame_pointer_prev( uintptr_t fp, uintptr_t *prev)59 bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev) 61 60 { 62 61 return false; 63 62 } 64 63 65 bool uspace_return_address_get( uintptr_t fp, uintptr_t *ra)64 bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra) 66 65 { 67 66 return false; -
kernel/arch/ia64/src/drivers/it.c
rfb150d78 r46c20c8 34 34 35 35 /** Interval Timer driver. */ 36 36 37 37 #include <arch/drivers/it.h> 38 38 #include <arch/interrupt.h> … … 45 45 #include <arch.h> 46 46 47 #define IT_SERVICE_CLOCKS 6447 #define IT_SERVICE_CLOCKS 64 48 48 49 #define FREQ_NUMERATOR_SHIFT 3250 #define FREQ_NUMERATOR_MASK 0xffffffff00000000ULL49 #define FREQ_NUMERATOR_SHIFT 32 50 #define FREQ_NUMERATOR_MASK 0xffffffff00000000ULL 51 51 52 #define FREQ_DENOMINATOR_SHIFT 053 #define FREQ_DENOMINATOR_MASK 0xffffffffULL52 #define FREQ_DENOMINATOR_SHIFT 0 53 #define FREQ_DENOMINATOR_MASK 0xffffffffULL 54 54 55 55 uint64_t it_delta; … … 63 63 void it_init(void) 64 64 { 65 cr_itv_t itv;66 67 65 if (config.cpu_active == 1) { 68 66 irq_initialize(&it_irq); … … 83 81 } 84 82 85 /* initialize Interval Timer external interrupt vector */ 83 /* Initialize Interval Timer external interrupt vector */ 84 cr_itv_t itv; 85 86 86 itv.value = itv_read(); 87 87 itv.vector = INTERRUPT_TIMER; 88 88 itv.m = 0; 89 89 itv_write(itv.value); 90 91 /* set Interval Timer Counter to zero */90 91 /* Set Interval Timer Counter to zero */ 92 92 itc_write(0); 93 93 94 /* generate first Interval Timer interrupt in IT_DELTA ticks */94 /* Generate first Interval Timer interrupt in IT_DELTA ticks */ 95 95 itm_write(IT_DELTA); 96 97 /* propagate changes */96 97 /* Propagate changes */ 98 98 srlz_d(); 99 99 } … … 104 104 * 105 105 * @return Always IRQ_ACCEPT. 106 * 106 107 */ 107 108 irq_ownership_t it_claim(irq_t *irq) … … 113 114 void it_interrupt(irq_t *irq) 114 115 { 115 int64_t c;116 int64_t m;117 118 116 eoi_write(EOI); 119 117 120 m = itm_read();118 int64_t itm = itm_read(); 121 119 122 while ( 1) {123 c = itc_read();124 c += IT_SERVICE_CLOCKS;125 126 m += IT_DELTA;127 if ( m -c < 0)120 while (true) { 121 int64_t itc = itc_read(); 122 itc += IT_SERVICE_CLOCKS; 123 124 itm += IT_DELTA; 125 if (itm - itc < 0) 128 126 CPU->missed_clock_ticks++; 129 127 else … … 131 129 } 132 130 133 itm_write( m);134 srlz_d(); /* propagate changes */135 131 itm_write(itm); 132 srlz_d(); /* Propagate changes */ 133 136 134 /* 137 135 * We are holding a lock which prevents preemption. 138 136 * Release the lock, call clock() and reacquire the lock again. 139 137 */ 140 spinlock_unlock(&irq->lock);138 irq_spinlock_unlock(&irq->lock, false); 141 139 clock(); 142 spinlock_lock(&irq->lock);140 irq_spinlock_lock(&irq->lock, false); 143 141 } 144 142 -
kernel/arch/ia64/src/drivers/ski.c
rfb150d78 r46c20c8 37 37 #include <console/chardev.h> 38 38 #include <sysinfo/sysinfo.h> 39 #include < arch/types.h>39 #include <typedefs.h> 40 40 #include <proc/thread.h> 41 41 #include <synch/spinlock.h> 42 42 #include <arch/asm.h> 43 43 #include <arch/drivers/kbd.h> 44 #include <str ing.h>44 #include <str.h> 45 45 #include <arch.h> 46 46 … … 216 216 * self-sufficient. 217 217 */ 218 sysinfo_set_item_val("fb ", NULL, false);218 sysinfo_set_item_val("fb.kind", NULL, 6); 219 219 220 220 fb_exported = true; -
kernel/arch/ia64/src/ia64.c
rfb150d78 r46c20c8 40 40 #include <arch/asm.h> 41 41 #include <arch/register.h> 42 #include < arch/types.h>42 #include <typedefs.h> 43 43 #include <arch/context.h> 44 44 #include <arch/stack.h> … … 47 47 #include <mm/as.h> 48 48 #include <config.h> 49 #include <macros.h> 49 50 #include <userspace.h> 50 51 #include <console/console.h> … … 66 67 #include <print.h> 67 68 #include <sysinfo/sysinfo.h> 68 #include <str ing.h>69 #include <str.h> 69 70 70 71 /* NS16550 as a COM 1 */ … … 78 79 void arch_pre_main(void) 79 80 { 80 /* Setup usermode init tasks. */ 81 82 unsigned int i; 83 84 init.cnt = bootinfo->taskmap.count; 85 81 init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); 82 size_t i; 86 83 for (i = 0; i < init.cnt; i++) { 87 84 init.tasks[i].addr = … … 212 209 (uintptr_t) I8042_BASE); 213 210 #endif 214 211 212 sysinfo_set_item_val("netif.dp8390.inr", NULL, IRQ_DP8390); 213 215 214 sysinfo_set_item_val("ia64_iospace", NULL, true); 216 215 sysinfo_set_item_val("ia64_iospace.address", NULL, true); -
kernel/arch/ia64/src/interrupt.c
rfb150d78 r46c20c8 41 41 #include <debug.h> 42 42 #include <console/console.h> 43 #include < arch/types.h>43 #include <typedefs.h> 44 44 #include <arch/asm.h> 45 45 #include <arch/barrier.h> … … 57 57 #include <putchar.h> 58 58 59 #define VECTORS_64_BUNDLE 20 60 #define VECTORS_16_BUNDLE 48 61 #define VECTORS_16_BUNDLE_START 0x5000 62 #define VECTOR_MAX 0x7f00 63 64 #define BUNDLE_SIZE 16 65 66 char *vector_names_64_bundle[VECTORS_64_BUNDLE] = { 59 #define VECTORS_64_BUNDLE 20 60 #define VECTORS_16_BUNDLE 48 61 #define VECTORS_16_BUNDLE_START 0x5000 62 63 #define VECTOR_MAX 0x7f00 64 65 #define BUNDLE_SIZE 16 66 67 static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = { 67 68 "VHPT Translation vector", 68 69 "Instruction TLB vector", … … 87 88 }; 88 89 89 char *vector_names_16_bundle[VECTORS_16_BUNDLE] = {90 static const char *vector_names_16_bundle[VECTORS_16_BUNDLE] = { 90 91 "Page Not Present vector", 91 92 "Key Permission vector", … … 121 122 }; 122 123 123 static char *vector_to_string(uint16_t vector); 124 static void dump_interrupted_context(istate_t *istate); 125 126 char *vector_to_string(uint16_t vector) 124 static const char *vector_to_string(uint16_t vector) 127 125 { 128 126 ASSERT(vector <= VECTOR_MAX); … … 135 133 } 136 134 137 void dump_interrupted_context(istate_t *istate) 138 { 139 char *ifa, *iipa, *iip; 140 141 ifa = symtab_fmt_name_lookup(istate->cr_ifa); 142 iipa = symtab_fmt_name_lookup(istate->cr_iipa); 143 iip = symtab_fmt_name_lookup(istate->cr_iip); 144 145 putchar('\n'); 146 printf("Interrupted context dump:\n"); 147 printf("ar.bsp=%p\tar.bspstore=%p\n", istate->ar_bsp, 148 istate->ar_bspstore); 149 printf("ar.rnat=%#018llx\tar.rsc=%#018llx\n", istate->ar_rnat, 150 istate->ar_rsc); 151 printf("ar.ifs=%#018llx\tar.pfs=%#018llx\n", istate->ar_ifs, 152 istate->ar_pfs); 153 printf("cr.isr=%#018llx\tcr.ipsr=%#018llx\t\n", istate->cr_isr.value, 154 istate->cr_ipsr); 155 156 printf("cr.iip=%#018llx, #%d\t(%s)\n", istate->cr_iip, 157 istate->cr_isr.ei, iip); 158 printf("cr.iipa=%#018llx\t(%s)\n", istate->cr_iipa, iipa); 159 printf("cr.ifa=%#018llx\t(%s)\n", istate->cr_ifa, ifa); 135 void istate_decode(istate_t *istate) 136 { 137 printf("ar.bsp=%p\tar.bspstore=%p\n", 138 (void *) istate->ar_bsp, (void *) istate->ar_bspstore); 139 printf("ar.rnat=%#0" PRIx64 "\tar.rsc=%#0" PRIx64 "\n", 140 istate->ar_rnat, istate->ar_rsc); 141 printf("ar.ifs=%#0" PRIx64 "\tar.pfs=%#0" PRIx64 "\n", 142 istate->ar_ifs, istate->ar_pfs); 143 printf("cr.isr=%#0" PRIx64 "\tcr.ipsr=%#0" PRIx64 "\n", 144 istate->cr_isr.value, istate->cr_ipsr.value); 145 146 printf("cr.iip=%#0" PRIx64 ", #%u\t(%s)\n", 147 istate->cr_iip, istate->cr_isr.ei, 148 symtab_fmt_name_lookup(istate->cr_iip)); 149 printf("cr.iipa=%#0" PRIx64 "\t(%s)\n", istate->cr_iipa, 150 symtab_fmt_name_lookup(istate->cr_iipa)); 151 printf("cr.ifa=%#0" PRIx64 "\t(%s)\n", istate->cr_ifa, 152 symtab_fmt_name_lookup(istate->cr_ifa)); 160 153 } 161 154 162 155 void general_exception(uint64_t vector, istate_t *istate) 163 156 { 164 c har *desc = "";165 157 const char *desc; 158 166 159 switch (istate->cr_isr.ge_code) { 167 160 case GE_ILLEGALOP: … … 187 180 break; 188 181 } 189 182 190 183 fault_if_from_uspace(istate, "General Exception (%s).", desc); 191 192 dump_interrupted_context(istate); 193 panic("General Exception (%s).", desc); 184 panic_badtrap(istate, vector, "General Exception (%s).", desc); 194 185 } 195 186 … … 201 192 fault_if_from_uspace(istate, "Interruption: %#hx (%s).", 202 193 (uint16_t) vector, vector_to_string(vector)); 203 dump_interrupted_context(istate); 204 panic("Interruption: %#hx (%s).", (uint16_t) vector, 205 vector_to_string(vector)); 194 panic_badtrap(istate, vector, "Interruption: %#hx (%s).", 195 (uint16_t) vector, vector_to_string(vector)); 206 196 #endif 207 197 } … … 223 213 istate->cr_ipsr.ri++; 224 214 } 225 215 226 216 return syscall_handler(istate->in0, istate->in1, istate->in2, 227 217 istate->in3, istate->in4, istate->in5, istate->in6); … … 232 222 fault_if_from_uspace(istate, "Interruption: %#hx (%s).", 233 223 (uint16_t) vector, vector_to_string(vector)); 234 dump_interrupted_context(istate); 235 panic("Interruption: %#hx (%s).", (uint16_t) vector, 236 vector_to_string(vector)); 224 panic_badtrap(istate, vector, "Interruption: %#hx (%s).", 225 (uint16_t) vector, vector_to_string(vector)); 237 226 } 238 227 239 228 static void end_of_local_irq(void) 240 229 { 241 asm volatile ("mov cr.eoi=r0;;"); 242 } 243 230 asm volatile ( 231 "mov cr.eoi=r0;;" 232 ); 233 } 244 234 245 235 void external_interrupt(uint64_t vector, istate_t *istate) 246 236 { 247 237 cr_ivr_t ivr; 248 irq_t *irq;249 238 250 239 ivr.value = ivr_read(); 251 240 srlz_d(); 252 241 242 irq_t *irq; 243 253 244 switch (ivr.vector) { 254 245 case INTERRUPT_SPURIOUS: … … 257 248 #endif 258 249 break; 259 250 260 251 #ifdef CONFIG_SMP 261 252 case VECTOR_TLB_SHOOTDOWN_IPI: … … 264 255 break; 265 256 #endif 266 257 267 258 case INTERRUPT_TIMER: 268 259 irq = irq_dispatch_and_lock(ivr.vector); 269 260 if (irq) { 270 261 irq->handler(irq); 271 spinlock_unlock(&irq->lock);262 irq_spinlock_unlock(&irq->lock, false); 272 263 } else { 273 264 panic("Unhandled Internal Timer Interrupt (%d).", … … 288 279 if (!irq->preack) 289 280 end_of_local_irq(); 290 spinlock_unlock(&irq->lock);281 irq_spinlock_unlock(&irq->lock, false); 291 282 } else { 292 283 /* -
kernel/arch/ia64/src/mm/page.c
rfb150d78 r46c20c8 39 39 #include <arch/mm/asid.h> 40 40 #include <arch/mm/vhpt.h> 41 #include < arch/types.h>41 #include <typedefs.h> 42 42 #include <print.h> 43 43 #include <mm/page.h> -
kernel/arch/ia64/src/mm/tlb.c
rfb150d78 r46c20c8 499 499 page_table_unlock(AS, true); 500 500 if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) { 501 fault_if_from_uspace(istate, "Page fault at %p.", va);502 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid,503 istate->cr_iip);501 fault_if_from_uspace(istate, "Page fault at %p.", 502 (void *) va); 503 panic_memtrap(istate, PF_ACCESS_EXEC, va, NULL); 504 504 } 505 505 } … … 557 557 } else { 558 558 fault_if_from_uspace(istate, 559 "IO access fault at %p.", va);559 "IO access fault at %p.", (void *) va); 560 560 } 561 561 } … … 621 621 */ 622 622 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 623 fault_if_from_uspace(istate, "Page fault at %p.", va);624 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid,625 istate->cr_iip);623 fault_if_from_uspace(istate, "Page fault at %p.", 624 (void *) va); 625 panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, NULL); 626 626 } 627 627 } … … 670 670 } else { 671 671 if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) { 672 fault_if_from_uspace(istate, "Page fault at %p.", va);673 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid,674 istate->cr_iip);672 fault_if_from_uspace(istate, "Page fault at %p.", 673 (void *) va); 674 panic_memtrap(istate, PF_ACCESS_WRITE, va, NULL); 675 675 } 676 676 } … … 707 707 } else { 708 708 if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) { 709 fault_if_from_uspace(istate, "Page fault at %p.", va);710 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid,711 istate->cr_iip);709 fault_if_from_uspace(istate, "Page fault at %p.", 710 (void *) va); 711 panic_memtrap(istate, PF_ACCESS_EXEC, va, NULL); 712 712 } 713 713 } … … 744 744 } else { 745 745 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 746 fault_if_from_uspace(istate, "Page fault at %p.", va);747 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid,748 istate->cr_iip);746 fault_if_from_uspace(istate, "Page fault at %p.", 747 (void *) va); 748 panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, NULL); 749 749 } 750 750 } … … 777 777 ASSERT(!t->w); 778 778 if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) { 779 fault_if_from_uspace(istate, "Page fault at %p.", va);780 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid,781 istate->cr_iip);779 fault_if_from_uspace(istate, "Page fault at %p.", 780 (void *) va); 781 panic_memtrap(istate, PF_ACCESS_WRITE, va, NULL); 782 782 } 783 783 page_table_unlock(AS, true); … … 818 818 page_table_unlock(AS, true); 819 819 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 820 fault_if_from_uspace(istate, "Page fault at %p.", va); 821 panic("%s: va=%p, rid=%d.", __func__, va, rid); 820 fault_if_from_uspace(istate, "Page fault at %p.", 821 (void *) va); 822 panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, NULL); 822 823 } 823 824 } -
kernel/arch/ia64/src/smp/smp.c
rfb150d78 r46c20c8 33 33 */ 34 34 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 #include <arch/types.h>43 #include <arch/context.h>44 #include <arch/stack.h>45 #include <arch/mm/page.h>46 #include <mm/as.h>47 #include <config.h>48 #include <userspace.h>49 #include <console/console.h>50 #include <proc/uarg.h>51 #include <syscall/syscall.h>52 #include <ddi/irq.h>53 #include <ddi/device.h>54 #include <arch/bootinfo.h>55 35 #include <smp/smp.h> 56 36 #include <smp/ipi.h> 57 #include <arch/atomic.h>58 #include <panic.h>59 #include <print.h>60 37 61 38 #ifdef CONFIG_SMP 62 39 63 extern char cpu_by_id_eid_list[256][256]; 64 65 static void sapic_init(void) 40 void ipi_broadcast_arch(int ipi) 66 41 { 67 bootinfo->sapic = (unative_t *)(PA2KA((unative_t)(bootinfo->sapic)) |68 FW_OFFSET);69 }70 71 static void ipi_broadcast_arch_all(int ipi)72 {73 int id, eid;74 int myid, myeid;75 76 myid = ia64_get_cpu_id();77 myeid = ia64_get_cpu_eid();78 79 for (id = 0; id < 256; id++)80 for (eid = 0; eid < 256; eid++)81 if ((id != myid) || (eid != myeid))82 ipi_send_ipi(id, eid, ipi);83 }84 85 void ipi_broadcast_arch(int ipi )86 {87 int id, eid;88 int myid, myeid;89 90 myid = ia64_get_cpu_id();91 myeid = ia64_get_cpu_eid();92 93 for (id = 0; id < 256; id++)94 for (eid = 0; eid < 256; eid++)95 if ((id != myid) || (eid != myeid))96 if (cpu_by_id_eid_list[id][eid])97 ipi_send_ipi(id, eid, ipi);98 42 } 99 43 100 44 void smp_init(void) 101 45 { 102 if (!bootinfo->hello_configured)103 return;104 105 /*106 * If we have not got system prepared by hello, we are not able to start107 * AP's. This means we are running on a simulator.108 */109 110 sapic_init();111 ipi_broadcast_arch_all(bootinfo->wakeup_intno);112 volatile long long brk;113 for (brk = 0; brk < 100LL * 1024LL * 1024LL; brk++)114 ; /* wait a while before CPUs starts */115 116 config.cpu_count = 0;117 int id, eid;118 119 for (id = 0; id < 256; id++)120 for (eid = 0; eid < 256; eid++)121 if (cpu_by_id_eid_list[id][eid] == 1) {122 config.cpu_count++;123 cpu_by_id_eid_list[id][eid] = 2;124 }125 46 } 126 47 127 48 void kmp(void *arg __attribute__((unused))) 128 49 { 129 int id, eid;130 int myid, myeid;131 132 myid = ia64_get_cpu_id();133 myeid = ia64_get_cpu_eid();134 135 for (id = 0; id < 256; id++)136 for (eid = 0; eid < 256; eid++)137 if ((id != myid) || (eid != myeid))138 if (cpu_by_id_eid_list[id][eid] != 0) {139 if (cpu_by_id_eid_list[id][eid] == 1) {140 printf("Found Late CPU ID:%d "141 "EDI:%d Not added to "142 "system!!!\n", id, eid);143 continue;144 }145 cpu_by_id_eid_list[id][eid] = 3;146 /*147 * There may be just one AP being148 * initialized at the time. After149 * it comes completely up, it is150 * supposed to wake us up.151 */152 if (waitq_sleep_timeout(153 &ap_completion_wq, 1000000,154 SYNCH_FLAGS_NONE) ==155 ESYNCH_TIMEOUT) {156 printf("%s: waiting for cpu "157 "ID:%d EID:%d timed out\n",158 __FUNCTION__, id, eid);159 }160 }161 50 } 162 51 -
kernel/arch/ia64/src/start.S
rfb150d78 r46c20c8 47 47 48 48 stack0: 49 50 # 51 # Kernel entry point. 52 # 53 # This is where we are passed control from the boot code. 54 # Register contents: 55 # 56 # r2 Address of the boot code's bootinfo structure. 57 # 49 58 kernel_image_start: 50 59 .auto 51 52 #ifdef CONFIG_SMP53 # Identify self(CPU) in OS structures by ID / EID54 55 mov r9 = cr6456 mov r10 = 157 movl r12 = 0xffffffff58 movl r8 = cpu_by_id_eid_list59 and r8 = r8, r1260 shr r9 = r9, 1661 add r8 = r8, r962 st1 [r8] = r1063 #endif64 60 65 61 mov psr.l = r0 … … 164 160 bsw.1 165 161 166 #ifdef CONFIG_SMP167 # Am I BSP or AP?168 movl r20 = bsp_started ;;169 ld8 r20 = [r20] ;;170 cmp.eq p3, p2 = r20, r0 ;;171 #else172 cmp.eq p3, p2 = r0, r0 ;; /* you are BSP */173 #endif /* CONFIG_SMP */174 175 162 # Initialize register stack 176 163 mov ar.rsc = r0 … … 179 166 loadrs 180 167 181 # Initialize memory stack to some sane value 182 movl r12 = stack0 ;; 183 add r12 = -16, r12 /* allocate a scratch area on the stack */ 168 # 169 # Initialize memory stack to some sane value and allocate a scratch are 170 # on it. 171 # 172 movl sp = stack0 ;; 173 add sp = -16, sp 184 174 185 175 # Initialize gp (Global Pointer) register 176 movl gp = kernel_image_start 177 178 # 179 # Initialize bootinfo on BSP. 180 # 186 181 movl r20 = (VRN_KERNEL << VRN_SHIFT) ;; 187 or r20 = r20, r1 ;; 188 movl r1 = kernel_image_start 189 190 /* 191 * Initialize bootinfo on BSP. 192 */ 193 (p3) addl r21 = @gprel(bootinfo), gp ;; 194 (p3) st8 [r21] = r20 182 or r20 = r20, r2 ;; 183 addl r21 = @gprel(bootinfo), gp ;; 184 st8 [r21] = r20 195 185 196 186 ssm (1 << 19) ;; /* Disable f32 - f127 */ … … 198 188 srlz.d ;; 199 189 200 #ifdef CONFIG_SMP201 (p2) movl r18 = main_ap ;;202 (p2) mov b1 = r18 ;;203 (p2) br.call.sptk.many b0 = b1204 205 # Mark that BSP is on206 207 mov r20 = 1 ;;208 movl r21 = bsp_started ;;209 st8 [r21] = r20 ;;210 #endif211 212 190 br.call.sptk.many b0 = arch_pre_main 213 214 movl r18 = main_bsp ;; 215 mov b1 = r18 ;; 216 br.call.sptk.many b0 = b1 217 191 0: 192 br.call.sptk.many b0 = main_bsp 218 193 0: 219 194 br 0b 220 221 #ifdef CONFIG_SMP222 223 .align 4096224 kernel_image_ap_start:225 .auto226 227 # Identify self(CPU) in OS structures by ID / EID228 229 mov r9 = cr64230 mov r10 = 1231 movl r12 = 0xffffffff232 movl r8 = cpu_by_id_eid_list233 and r8 = r8, r12234 shr r9 = r9, 16235 add r8 = r8, r9236 st1 [r8] = r10237 238 # Wait for wakeup synchro signal (#3 in cpu_by_id_eid_list)239 240 kernel_image_ap_start_loop:241 movl r11 = kernel_image_ap_start_loop242 and r11 = r11, r12243 mov b1 = r11244 245 ld1 r20 = [r8]246 movl r21 = 3247 cmp.eq p2, p3 = r20, r21248 (p3) br.call.sptk.many b0 = b1249 250 movl r11 = kernel_image_start251 and r11 = r11, r12252 mov b1 = r11253 br.call.sptk.many b0 = b1254 255 .align 16256 .global bsp_started257 bsp_started:258 .space 8259 260 .align 4096261 .global cpu_by_id_eid_list262 cpu_by_id_eid_list:263 .space 65536264 265 #endif /* CONFIG_SMP */
Note:
See TracChangeset
for help on using the changeset viewer.
