Changeset 235d31d in mainline for kernel/arch
- Timestamp:
- 2014-12-22T17:47:40Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8c7d5ad
- Parents:
- eae91e0 (diff), 759ea0d (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
- Files:
-
- 8 added
- 62 edited
-
abs32le/Makefile.inc (modified) (1 diff)
-
abs32le/src/cpu/cpu.c (modified) (1 diff)
-
abs32le/src/smp/smp_call.c (added)
-
amd64/Makefile.inc (modified) (1 diff)
-
amd64/include/arch/atomic.h (modified) (2 diffs)
-
amd64/include/arch/cpu.h (modified) (1 diff)
-
amd64/include/arch/interrupt.h (modified) (1 diff)
-
amd64/src/amd64.c (modified) (1 diff)
-
amd64/src/cpu/cpu.c (modified) (1 diff)
-
amd64/src/interrupt.c (modified) (3 diffs)
-
amd64/src/smp/smp_call.c (added)
-
arm32/Makefile.inc (modified) (1 diff)
-
arm32/include/arch/cp15.h (modified) (1 diff)
-
arm32/src/atomic.c (added)
-
arm32/src/cpu/cpu.c (modified) (2 diffs)
-
arm32/src/exception.c (modified) (1 diff)
-
ia32/Makefile.inc (modified) (1 diff)
-
ia32/include/arch/atomic.h (modified) (3 diffs)
-
ia32/include/arch/cpu.h (modified) (1 diff)
-
ia32/include/arch/interrupt.h (modified) (1 diff)
-
ia32/include/arch/smp/apic.h (modified) (1 diff)
-
ia32/src/cpu/cpu.c (modified) (1 diff)
-
ia32/src/ia32.c (modified) (1 diff)
-
ia32/src/interrupt.c (modified) (3 diffs)
-
ia32/src/smp/apic.c (modified) (3 diffs)
-
ia32/src/smp/smp.c (modified) (3 diffs)
-
ia32/src/smp/smp_call.c (added)
-
ia64/Makefile.inc (modified) (1 diff)
-
ia64/include/arch/interrupt.h (modified) (2 diffs)
-
ia64/include/arch/mm/tlb.h (modified) (1 diff)
-
ia64/src/ia64.c (modified) (2 diffs)
-
ia64/src/interrupt.c (modified) (9 diffs)
-
ia64/src/ivt.S (modified) (6 diffs)
-
ia64/src/mm/tlb.c (modified) (8 diffs)
-
ia64/src/smp/smp_call.c (added)
-
mips32/Makefile.inc (modified) (1 diff)
-
mips32/src/smp/smp_call.c (added)
-
sparc32/include/arch/stack.h (modified) (1 diff)
-
sparc32/src/cpu/cpu.c (modified) (1 diff)
-
sparc32/src/debug/stacktrace.c (modified) (1 diff)
-
sparc32/src/sparc32.c (modified) (2 diffs)
-
sparc64/Makefile.inc (modified) (1 diff)
-
sparc64/include/arch/barrier.h (modified) (1 diff)
-
sparc64/include/arch/interrupt.h (modified) (2 diffs)
-
sparc64/include/arch/istate_struct.ag (modified) (2 diffs)
-
sparc64/include/arch/mm/sun4u/tlb.h (modified) (1 diff)
-
sparc64/include/arch/mm/sun4v/tlb.h (modified) (1 diff)
-
sparc64/include/arch/smp/sun4u/ipi.h (added)
-
sparc64/include/arch/trap/exception.h (modified) (1 diff)
-
sparc64/include/arch/trap/interrupt.h (modified) (1 diff)
-
sparc64/include/arch/trap/sun4u/interrupt.h (modified) (1 diff)
-
sparc64/include/arch/trap/sun4u/mmu.h (modified) (4 diffs)
-
sparc64/include/arch/trap/sun4v/interrupt.h (modified) (1 diff)
-
sparc64/include/arch/trap/sun4v/mmu.h (modified) (4 diffs)
-
sparc64/include/arch/trap/trap_table.h (modified) (2 diffs)
-
sparc64/src/debug/stacktrace.c (modified) (2 diffs)
-
sparc64/src/drivers/tick.c (modified) (4 diffs)
-
sparc64/src/mm/sun4u/tlb.c (modified) (5 diffs)
-
sparc64/src/mm/sun4v/tlb.c (modified) (3 diffs)
-
sparc64/src/smp/sun4u/ipi.c (modified) (3 diffs)
-
sparc64/src/smp/sun4u/smp_call.c (added)
-
sparc64/src/sun4u/sparc64.c (modified) (1 diff)
-
sparc64/src/sun4u/start.S (modified) (2 diffs)
-
sparc64/src/sun4v/sparc64.c (modified) (1 diff)
-
sparc64/src/trap/exception.c (modified) (19 diffs)
-
sparc64/src/trap/interrupt.c (modified) (3 diffs)
-
sparc64/src/trap/sun4u/interrupt.c (modified) (1 diff)
-
sparc64/src/trap/sun4u/trap_table.S (modified) (54 diffs)
-
sparc64/src/trap/sun4v/interrupt.c (modified) (1 diff)
-
sparc64/src/trap/sun4v/trap_table.S (modified) (66 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/abs32le/Makefile.inc
reae91e0 r235d31d 51 51 arch/$(KARCH)/src/cpu/cpu.c \ 52 52 arch/$(KARCH)/src/smp/smp.c \ 53 arch/$(KARCH)/src/smp/smp_call.c \ 53 54 arch/$(KARCH)/src/smp/ipi.c \ 54 55 arch/$(KARCH)/src/mm/km.c \ -
kernel/arch/abs32le/src/cpu/cpu.c
reae91e0 r235d31d 34 34 35 35 #include <arch/cpu.h> 36 #include <cpu.h> 36 37 #include <arch.h> 37 38 #include <typedefs.h> -
kernel/arch/amd64/Makefile.inc
reae91e0 r235d31d 84 84 arch/$(KARCH)/src/smp/ipi.c \ 85 85 arch/$(KARCH)/src/smp/mps.c \ 86 arch/$(KARCH)/src/smp/smp_call.c \ 86 87 arch/$(KARCH)/src/smp/smp.c 87 88 endif -
kernel/arch/amd64/include/arch/atomic.h
reae91e0 r235d31d 1 1 /* 2 2 * Copyright (c) 2001-2004 Jakub Jermar 3 * Copyright (c) 2012 Adam Hraska 3 4 * All rights reserved. 4 5 * … … 140 141 } 141 142 143 144 #define _atomic_cas_impl(pptr, exp_val, new_val, old_val, prefix) \ 145 ({ \ 146 switch (sizeof(typeof(*(pptr)))) { \ 147 case 1: \ 148 asm volatile ( \ 149 prefix " cmpxchgb %[newval], %[ptr]\n" \ 150 : /* Output operands. */ \ 151 /* Old/current value is returned in eax. */ \ 152 [oldval] "=a" (old_val), \ 153 /* (*ptr) will be read and written to, hence "+" */ \ 154 [ptr] "+m" (*pptr) \ 155 : /* Input operands. */ \ 156 /* Expected value must be in eax. */ \ 157 [expval] "a" (exp_val), \ 158 /* The new value may be in any register. */ \ 159 [newval] "r" (new_val) \ 160 : "memory" \ 161 ); \ 162 break; \ 163 case 2: \ 164 asm volatile ( \ 165 prefix " cmpxchgw %[newval], %[ptr]\n" \ 166 : /* Output operands. */ \ 167 /* Old/current value is returned in eax. */ \ 168 [oldval] "=a" (old_val), \ 169 /* (*ptr) will be read and written to, hence "+" */ \ 170 [ptr] "+m" (*pptr) \ 171 : /* Input operands. */ \ 172 /* Expected value must be in eax. */ \ 173 [expval] "a" (exp_val), \ 174 /* The new value may be in any register. */ \ 175 [newval] "r" (new_val) \ 176 : "memory" \ 177 ); \ 178 break; \ 179 case 4: \ 180 asm volatile ( \ 181 prefix " cmpxchgl %[newval], %[ptr]\n" \ 182 : /* Output operands. */ \ 183 /* Old/current value is returned in eax. */ \ 184 [oldval] "=a" (old_val), \ 185 /* (*ptr) will be read and written to, hence "+" */ \ 186 [ptr] "+m" (*pptr) \ 187 : /* Input operands. */ \ 188 /* Expected value must be in eax. */ \ 189 [expval] "a" (exp_val), \ 190 /* The new value may be in any register. */ \ 191 [newval] "r" (new_val) \ 192 : "memory" \ 193 ); \ 194 break; \ 195 case 8: \ 196 asm volatile ( \ 197 prefix " cmpxchgq %[newval], %[ptr]\n" \ 198 : /* Output operands. */ \ 199 /* Old/current value is returned in eax. */ \ 200 [oldval] "=a" (old_val), \ 201 /* (*ptr) will be read and written to, hence "+" */ \ 202 [ptr] "+m" (*pptr) \ 203 : /* Input operands. */ \ 204 /* Expected value must be in eax. */ \ 205 [expval] "a" (exp_val), \ 206 /* The new value may be in any register. */ \ 207 [newval] "r" (new_val) \ 208 : "memory" \ 209 ); \ 210 break; \ 211 } \ 212 }) 213 214 215 #ifndef local_atomic_cas 216 217 #define local_atomic_cas(pptr, exp_val, new_val) \ 218 ({ \ 219 /* Use proper types and avoid name clashes */ \ 220 typeof(*(pptr)) _old_val_cas; \ 221 typeof(*(pptr)) _exp_val_cas = exp_val; \ 222 typeof(*(pptr)) _new_val_cas = new_val; \ 223 _atomic_cas_impl(pptr, _exp_val_cas, _new_val_cas, _old_val_cas, ""); \ 224 \ 225 _old_val_cas; \ 226 }) 227 228 #else 229 /* Check if arch/atomic.h does not accidentally include /atomic.h .*/ 230 #error Architecture specific cpu local atomics already defined! Check your includes. 142 231 #endif 143 232 233 234 #ifndef local_atomic_exchange 235 /* 236 * Issuing a xchg instruction always implies lock prefix semantics. 237 * Therefore, it is cheaper to use a cmpxchg without a lock prefix 238 * in a loop. 239 */ 240 #define local_atomic_exchange(pptr, new_val) \ 241 ({ \ 242 /* Use proper types and avoid name clashes */ \ 243 typeof(*(pptr)) _exp_val_x; \ 244 typeof(*(pptr)) _old_val_x; \ 245 typeof(*(pptr)) _new_val_x = new_val; \ 246 \ 247 do { \ 248 _exp_val_x = *pptr; \ 249 _old_val_x = local_atomic_cas(pptr, _exp_val_x, _new_val_x); \ 250 } while (_old_val_x != _exp_val_x); \ 251 \ 252 _old_val_x; \ 253 }) 254 255 #else 256 /* Check if arch/atomic.h does not accidentally include /atomic.h .*/ 257 #error Architecture specific cpu local atomics already defined! Check your includes. 258 #endif 259 260 261 #endif 262 144 263 /** @} 145 264 */ -
kernel/arch/amd64/include/arch/cpu.h
reae91e0 r235d31d 73 73 tss_t *tss; 74 74 75 unsigned int id; /** CPU's local, ie physical, APIC ID. */ 76 75 77 size_t iomapver_copy; /** Copy of TASK's I/O Permission bitmap generation count. */ 76 78 } cpu_arch_t; -
kernel/arch/amd64/include/arch/interrupt.h
reae91e0 r235d31d 71 71 #define VECTOR_TLB_SHOOTDOWN_IPI (IVT_FREEBASE + 1) 72 72 #define VECTOR_DEBUG_IPI (IVT_FREEBASE + 2) 73 #define VECTOR_SMP_CALL_IPI (IVT_FREEBASE + 3) 73 74 74 75 extern void (* disable_irqs_function)(uint16_t); -
kernel/arch/amd64/src/amd64.c
reae91e0 r235d31d 170 170 } 171 171 172 void arch_post_cpu_init( )172 void arch_post_cpu_init(void) 173 173 { 174 174 #ifdef CONFIG_SMP -
kernel/arch/amd64/src/cpu/cpu.c
reae91e0 r235d31d 158 158 void cpu_print_report(cpu_t* m) 159 159 { 160 printf("cpu%d: (%s family=%d model=%d stepping=%d ) %dMHz\n",160 printf("cpu%d: (%s family=%d model=%d stepping=%d apicid=%u) %dMHz\n", 161 161 m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model, 162 m->arch.stepping, m-> frequency_mhz);162 m->arch.stepping, m->arch.id, m->frequency_mhz); 163 163 } 164 164 -
kernel/arch/amd64/src/interrupt.c
reae91e0 r235d31d 55 55 #include <symtab.h> 56 56 #include <stacktrace.h> 57 #include <smp/smp_call.h> 57 58 58 59 /* … … 161 162 trap_virtual_eoi(); 162 163 tlb_shootdown_ipi_recv(); 164 } 165 166 static void arch_smp_call_ipi_recv(unsigned int n, istate_t *istate) 167 { 168 trap_virtual_eoi(); 169 smp_call_ipi_recv(); 163 170 } 164 171 #endif … … 224 231 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", true, 225 232 (iroutine_t) tlb_shootdown_ipi); 233 exc_register(VECTOR_SMP_CALL_IPI, "smp_call", true, 234 (iroutine_t) arch_smp_call_ipi_recv); 226 235 #endif 227 236 } -
kernel/arch/arm32/Makefile.inc
reae91e0 r235d31d 65 65 arch/$(KARCH)/src/mm/tlb.c \ 66 66 arch/$(KARCH)/src/mm/page_fault.c \ 67 arch/$(KARCH)/src/atomic.c \ 67 68 arch/$(KARCH)/src/ras.c 68 69 -
kernel/arch/arm32/include/arch/cp15.h
reae91e0 r235d31d 37 37 #define KERN_arm32_CP15_H_ 38 38 39 #if defined(KERNEL) || defined(BOOT) 40 #include <typedefs.h> 41 #else 42 #include <sys/types.h> 43 #endif 39 44 40 45 /** See ARM Architecture reference manual ch. B3.17.1 page B3-1456 -
kernel/arch/arm32/src/cpu/cpu.c
reae91e0 r235d31d 41 41 #include <print.h> 42 42 43 #ifdef CONFIG_FPU 44 #include <arch/fpu_context.h> 45 #endif 46 43 47 static inline unsigned log2(unsigned val) 44 48 { … … 60 64 static const char * implementer(unsigned id) 61 65 { 62 switch (id) 63 { 66 switch (id) { 64 67 case 0x41: return "ARM Limited"; 65 68 case 0x44: return "Digital Equipment Corporation"; -
kernel/arch/arm32/src/exception.c
reae91e0 r235d31d 88 88 static void swi_exception(unsigned int exc_no, istate_t *istate) 89 89 { 90 interrupts_enable(); 90 91 istate->r0 = syscall_handler(istate->r0, istate->r1, istate->r2, 91 92 istate->r3, istate->r4, istate->r5, istate->r6); 93 interrupts_disable(); 92 94 } 93 95 -
kernel/arch/ia32/Makefile.inc
reae91e0 r235d31d 85 85 arch/$(KARCH)/src/smp/mps.c \ 86 86 arch/$(KARCH)/src/smp/smp.c \ 87 arch/$(KARCH)/src/smp/smp_call.c \ 87 88 arch/$(KARCH)/src/atomic.S \ 88 89 arch/$(KARCH)/src/smp/ipi.c \ -
kernel/arch/ia32/include/arch/atomic.h
reae91e0 r235d31d 1 1 /* 2 2 * Copyright (c) 2001-2004 Jakub Jermar 3 * Copyright (c) 2012 Adam Hraska 3 4 * All rights reserved. 4 5 * … … 113 114 } 114 115 116 115 117 /** ia32 specific fast spinlock */ 116 118 NO_TRACE static inline void atomic_lock_arch(atomic_t *val) … … 142 144 } 143 145 146 147 #define _atomic_cas_impl(pptr, exp_val, new_val, old_val, prefix) \ 148 ({ \ 149 switch (sizeof(typeof(*(pptr)))) { \ 150 case 1: \ 151 asm volatile ( \ 152 prefix " cmpxchgb %[newval], %[ptr]\n" \ 153 : /* Output operands. */ \ 154 /* Old/current value is returned in eax. */ \ 155 [oldval] "=a" (old_val), \ 156 /* (*ptr) will be read and written to, hence "+" */ \ 157 [ptr] "+m" (*pptr) \ 158 : /* Input operands. */ \ 159 /* Expected value must be in eax. */ \ 160 [expval] "a" (exp_val), \ 161 /* The new value may be in any register. */ \ 162 [newval] "r" (new_val) \ 163 : "memory" \ 164 ); \ 165 break; \ 166 case 2: \ 167 asm volatile ( \ 168 prefix " cmpxchgw %[newval], %[ptr]\n" \ 169 : /* Output operands. */ \ 170 /* Old/current value is returned in eax. */ \ 171 [oldval] "=a" (old_val), \ 172 /* (*ptr) will be read and written to, hence "+" */ \ 173 [ptr] "+m" (*pptr) \ 174 : /* Input operands. */ \ 175 /* Expected value must be in eax. */ \ 176 [expval] "a" (exp_val), \ 177 /* The new value may be in any register. */ \ 178 [newval] "r" (new_val) \ 179 : "memory" \ 180 ); \ 181 break; \ 182 case 4: \ 183 asm volatile ( \ 184 prefix " cmpxchgl %[newval], %[ptr]\n" \ 185 : /* Output operands. */ \ 186 /* Old/current value is returned in eax. */ \ 187 [oldval] "=a" (old_val), \ 188 /* (*ptr) will be read and written to, hence "+" */ \ 189 [ptr] "+m" (*pptr) \ 190 : /* Input operands. */ \ 191 /* Expected value must be in eax. */ \ 192 [expval] "a" (exp_val), \ 193 /* The new value may be in any register. */ \ 194 [newval] "r" (new_val) \ 195 : "memory" \ 196 ); \ 197 break; \ 198 } \ 199 }) 200 201 202 #ifndef local_atomic_cas 203 204 #define local_atomic_cas(pptr, exp_val, new_val) \ 205 ({ \ 206 /* Use proper types and avoid name clashes */ \ 207 typeof(*(pptr)) _old_val_cas; \ 208 typeof(*(pptr)) _exp_val_cas = exp_val; \ 209 typeof(*(pptr)) _new_val_cas = new_val; \ 210 _atomic_cas_impl(pptr, _exp_val_cas, _new_val_cas, _old_val_cas, ""); \ 211 \ 212 _old_val_cas; \ 213 }) 214 215 #else 216 /* Check if arch/atomic.h does not accidentally include /atomic.h .*/ 217 #error Architecture specific cpu local atomics already defined! Check your includes. 218 #endif 219 220 221 #ifndef local_atomic_exchange 222 /* 223 * Issuing a xchg instruction always implies lock prefix semantics. 224 * Therefore, it is cheaper to use a cmpxchg without a lock prefix 225 * in a loop. 226 */ 227 #define local_atomic_exchange(pptr, new_val) \ 228 ({ \ 229 /* Use proper types and avoid name clashes */ \ 230 typeof(*(pptr)) _exp_val_x; \ 231 typeof(*(pptr)) _old_val_x; \ 232 typeof(*(pptr)) _new_val_x = new_val; \ 233 \ 234 do { \ 235 _exp_val_x = *pptr; \ 236 _old_val_x = local_atomic_cas(pptr, _exp_val_x, _new_val_x); \ 237 } while (_old_val_x != _exp_val_x); \ 238 \ 239 _old_val_x; \ 240 }) 241 242 #else 243 /* Check if arch/atomic.h does not accidentally include /atomic.h .*/ 244 #error Architecture specific cpu local atomics already defined! Check your includes. 245 #endif 246 247 144 248 #endif 145 249 -
kernel/arch/ia32/include/arch/cpu.h
reae91e0 r235d31d 61 61 unsigned int stepping; 62 62 cpuid_feature_info_t fi; 63 63 64 unsigned int id; /** CPU's local, ie physical, APIC ID. */ 65 64 66 tss_t *tss; 65 67 -
kernel/arch/ia32/include/arch/interrupt.h
reae91e0 r235d31d 71 71 #define VECTOR_TLB_SHOOTDOWN_IPI (IVT_FREEBASE + 1) 72 72 #define VECTOR_DEBUG_IPI (IVT_FREEBASE + 2) 73 #define VECTOR_SMP_CALL_IPI (IVT_FREEBASE + 3) 73 74 74 75 extern void (* disable_irqs_function)(uint16_t); -
kernel/arch/ia32/include/arch/smp/apic.h
reae91e0 r235d31d 353 353 extern void l_apic_init(void); 354 354 extern void l_apic_eoi(void); 355 extern int l_apic_send_custom_ipi(uint8_t, uint8_t); 355 356 extern int l_apic_broadcast_custom_ipi(uint8_t); 356 357 extern int l_apic_send_init_ipi(uint8_t); -
kernel/arch/ia32/src/cpu/cpu.c
reae91e0 r235d31d 160 160 void cpu_print_report(cpu_t* cpu) 161 161 { 162 printf("cpu%u: (%s family=%u model=%u stepping=%u ) %" PRIu16 " MHz\n",163 cpu->id, vendor_str[cpu->arch.vendor], cpu->arch.family,164 cpu->arch.model, cpu->arch.stepping, cpu-> frequency_mhz);162 printf("cpu%u: (%s family=%u model=%u stepping=%u apicid=%u) %" PRIu16 163 " MHz\n", cpu->id, vendor_str[cpu->arch.vendor], cpu->arch.family, 164 cpu->arch.model, cpu->arch.stepping, cpu->arch.id, cpu->frequency_mhz); 165 165 } 166 166 -
kernel/arch/ia32/src/ia32.c
reae91e0 r235d31d 124 124 } 125 125 126 void arch_post_cpu_init( )126 void arch_post_cpu_init(void) 127 127 { 128 128 #ifdef CONFIG_SMP -
kernel/arch/ia32/src/interrupt.c
reae91e0 r235d31d 54 54 #include <symtab.h> 55 55 #include <stacktrace.h> 56 #include <smp/smp_call.h> 57 #include <proc/task.h> 56 58 57 59 /* … … 170 172 tlb_shootdown_ipi_recv(); 171 173 } 174 175 static void arch_smp_call_ipi_recv(unsigned int n, istate_t *istate) 176 { 177 trap_virtual_eoi(); 178 smp_call_ipi_recv(); 179 } 172 180 #endif 173 181 … … 230 238 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", true, 231 239 (iroutine_t) tlb_shootdown_ipi); 240 exc_register(VECTOR_SMP_CALL_IPI, "smp_call", true, 241 (iroutine_t) arch_smp_call_ipi_recv); 232 242 #endif 233 243 } -
kernel/arch/ia32/src/smp/apic.c
reae91e0 r235d31d 264 264 } 265 265 266 #define DELIVS_PENDING_SILENT_RETRIES 4 267 266 /* Waits for the destination cpu to accept the previous ipi. */ 268 267 static void l_apic_wait_for_delivery(void) 269 268 { 270 269 icr_t icr; 271 unsigned retries = 0; 272 270 273 271 do { 274 if (retries++ > DELIVS_PENDING_SILENT_RETRIES) {275 retries = 0;276 #ifdef CONFIG_DEBUG277 log(LF_ARCH, LVL_DEBUG, "IPI is pending.");278 #endif279 delay(20);280 }281 272 icr.lo = l_apic[ICRlo]; 282 } while (icr.delivs == DELIVS_PENDING); 283 273 } while (icr.delivs != DELIVS_IDLE); 274 } 275 276 /** Send one CPU an IPI vector. 277 * 278 * @param apicid Physical APIC ID of the destination CPU. 279 * @param vector Interrupt vector to be sent. 280 * 281 * @return 0 on failure, 1 on success. 282 */ 283 int l_apic_send_custom_ipi(uint8_t apicid, uint8_t vector) 284 { 285 icr_t icr; 286 287 /* Wait for a destination cpu to accept our previous ipi. */ 288 l_apic_wait_for_delivery(); 289 290 icr.lo = l_apic[ICRlo]; 291 icr.hi = l_apic[ICRhi]; 292 293 icr.delmod = DELMOD_FIXED; 294 icr.destmod = DESTMOD_PHYS; 295 icr.level = LEVEL_ASSERT; 296 icr.shorthand = SHORTHAND_NONE; 297 icr.trigger_mode = TRIGMOD_LEVEL; 298 icr.vector = vector; 299 icr.dest = apicid; 300 301 /* Send the IPI by writing to l_apic[ICRlo]. */ 302 l_apic[ICRhi] = icr.hi; 303 l_apic[ICRlo] = icr.lo; 304 305 return apic_poll_errors(); 284 306 } 285 307 … … 294 316 { 295 317 icr_t icr; 318 319 /* Wait for a destination cpu to accept our previous ipi. */ 320 l_apic_wait_for_delivery(); 296 321 297 322 icr.lo = l_apic[ICRlo]; … … 304 329 305 330 l_apic[ICRlo] = icr.lo; 306 307 l_apic_wait_for_delivery();308 331 309 332 return apic_poll_errors(); -
kernel/arch/ia32/src/smp/smp.c
reae91e0 r235d31d 55 55 #include <memstr.h> 56 56 #include <arch/drivers/i8259.h> 57 #include <cpu.h> 57 58 58 59 #ifdef CONFIG_SMP … … 77 78 io_apic = (uint32_t *) km_map((uintptr_t) io_apic, PAGE_SIZE, 78 79 PAGE_WRITE | PAGE_NOT_CACHEABLE); 80 } 81 } 82 83 static void cpu_arch_id_init(void) 84 { 85 ASSERT(ops != NULL); 86 ASSERT(cpus != NULL); 87 88 for (unsigned int i = 0; i < config.cpu_count; ++i) { 89 cpus[i].arch.id = ops->cpu_apic_id(i); 79 90 } 80 91 } … … 92 103 93 104 ASSERT(ops != NULL); 105 106 /* 107 * SMP initialized, cpus array allocated. Assign each CPU its 108 * physical APIC ID. 109 */ 110 cpu_arch_id_init(); 94 111 95 112 /* -
kernel/arch/ia64/Makefile.inc
reae91e0 r235d31d 61 61 arch/$(KARCH)/src/ddi/ddi.c \ 62 62 arch/$(KARCH)/src/smp/smp.c \ 63 arch/$(KARCH)/src/smp/smp_call.c \ 63 64 arch/$(KARCH)/src/drivers/it.c 64 65 -
kernel/arch/ia64/include/arch/interrupt.h
reae91e0 r235d31d 36 36 #define KERN_ia64_INTERRUPT_H_ 37 37 38 #ifndef __ASM__ 38 39 #include <typedefs.h> 39 40 #include <arch/istate.h> 41 #endif 42 43 #define EXC_ALT_ITLB_FAULT 0xc 44 #define EXC_ALT_DTLB_FAULT 0x10 45 #define EXC_NESTED_TLB_FAULT 0x14 46 #define EXC_DATA_D_BIT_FAULT 0x20 47 #define EXC_INST_A_BIT_FAULT 0x24 48 #define EXC_DATA_A_BIT_FAULT 0x28 49 #define EXC_BREAK_INSTRUCTION 0x2c 50 #define EXC_EXT_INTERRUPT 0x30 51 #define EXC_PAGE_NOT_PRESENT 0x50 52 #define EXC_DATA_AR_FAULT 0x53 53 #define EXC_GENERAL_EXCEPTION 0x54 54 #define EXC_DISABLED_FP_REG 0x55 55 #define EXC_SPECULATION 0x57 40 56 41 57 /** ia64 has 256 INRs. */ 42 58 #define INR_COUNT 256 43 59 44 /* 45 * We need to keep this just to compile. 46 * We might eventually move interrupt/ stuff 47 * to genarch. 48 */ 49 #define IVT_ITEMS 0 60 #define IVT_ITEMS 128 50 61 #define IVT_FIRST 0 51 62 … … 72 83 #define EOI 0 /**< The actual value doesn't matter. */ 73 84 85 #ifndef __ASM__ 74 86 extern void *ivt; 75 87 76 extern void general_exception(uint64_t, istate_t *); 77 extern int break_instruction(uint64_t, istate_t *); 78 extern void universal_handler(uint64_t, istate_t *); 79 extern void nop_handler(uint64_t, istate_t *); 80 extern void external_interrupt(uint64_t, istate_t *); 81 extern void disabled_fp_register(uint64_t, istate_t *); 88 extern void general_exception(unsigned int, istate_t *); 89 extern sysarg_t break_instruction(unsigned int, istate_t *); 90 extern void universal_handler(unsigned int, istate_t *); 91 extern void external_interrupt(unsigned int, istate_t *); 92 extern void disabled_fp_register(unsigned int, istate_t *); 82 93 83 94 extern void trap_virtual_enable_irqs(uint16_t); 95 96 void exception_init(void); 97 #endif 84 98 85 99 #endif -
kernel/arch/ia64/include/arch/mm/tlb.h
reae91e0 r235d31d 86 86 extern void itc_pte_copy(pte_t *t); 87 87 88 extern void alternate_instruction_tlb_fault(u int64_t vector, istate_t *istate);89 extern void alternate_data_tlb_fault(u int64_t vector, istate_t *istate);90 extern void data_nested_tlb_fault(u int64_t vector, istate_t *istate);91 extern void data_dirty_bit_fault(u int64_t vector, istate_t *istate);92 extern void instruction_access_bit_fault(u int64_t vector, istate_t *istate);93 extern void data_access_bit_fault(u int64_t vector, istate_t *istate);94 extern void data_access_rights_fault(u int64_t vector, istate_t *istate);95 extern void page_not_present(u int64_t vector, istate_t *istate);88 extern void alternate_instruction_tlb_fault(unsigned int, istate_t *); 89 extern void alternate_data_tlb_fault(unsigned int, istate_t *); 90 extern void data_nested_tlb_fault(unsigned int, istate_t *); 91 extern void data_dirty_bit_fault(unsigned int, istate_t *); 92 extern void instruction_access_bit_fault(unsigned int, istate_t *); 93 extern void data_access_bit_fault(unsigned int, istate_t *); 94 extern void data_access_rights_fault(unsigned int, istate_t *); 95 extern void page_not_present(unsigned int, istate_t *); 96 96 97 97 #endif -
kernel/arch/ia64/src/ia64.c
reae91e0 r235d31d 37 37 #include <errno.h> 38 38 #include <interrupt.h> 39 #include <arch/interrupt.h> 39 40 #include <macros.h> 40 41 #include <str.h> … … 85 86 void arch_pre_mm_init(void) 86 87 { 88 if (config.cpu_active == 1) 89 exception_init(); 87 90 } 88 91 -
kernel/arch/ia64/src/interrupt.c
reae91e0 r235d31d 54 54 #include <synch/spinlock.h> 55 55 #include <mm/tlb.h> 56 #include <arch/mm/tlb.h> 56 57 #include <symtab.h> 57 58 #include <putchar.h> … … 59 60 #define VECTORS_64_BUNDLE 20 60 61 #define VECTORS_16_BUNDLE 48 61 #define VECTORS_16_BUNDLE_START 0x5000 62 63 #define VECTOR_MAX 0x7f00 64 65 #define BUNDLE_SIZE 16 62 #define VECTORS_16_BUNDLE_START 0x50 63 64 #define VECTOR_MAX 0x7f 66 65 67 66 static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = { … … 122 121 }; 123 122 124 static const char *vector_to_string(uint16_t vector) 125 { 126 ASSERT(vector <= VECTOR_MAX); 127 128 if (vector >= VECTORS_16_BUNDLE_START) 129 return vector_names_16_bundle[(vector - 130 VECTORS_16_BUNDLE_START) / (16 * BUNDLE_SIZE)]; 123 static const char *vector_to_string(unsigned int n) 124 { 125 ASSERT(n <= VECTOR_MAX); 126 127 if (n >= VECTORS_16_BUNDLE_START) 128 return vector_names_16_bundle[n - VECTORS_16_BUNDLE_START]; 131 129 else 132 return vector_names_64_bundle[ vector / (64 * BUNDLE_SIZE)];130 return vector_names_64_bundle[n / 4]; 133 131 } 134 132 … … 153 151 } 154 152 155 void general_exception(u int64_t vector, istate_t *istate)153 void general_exception(unsigned int n, istate_t *istate) 156 154 { 157 155 const char *desc; … … 182 180 183 181 fault_if_from_uspace(istate, "General Exception (%s).", desc); 184 panic_badtrap(istate, vector, "General Exception (%s).", desc);185 } 186 187 void disabled_fp_register(u int64_t vector, istate_t *istate)182 panic_badtrap(istate, n, "General Exception (%s).", desc); 183 } 184 185 void disabled_fp_register(unsigned int n, istate_t *istate) 188 186 { 189 187 #ifdef CONFIG_FPU_LAZY … … 191 189 #else 192 190 fault_if_from_uspace(istate, "Interruption: %#hx (%s).", 193 (uint16_t) vector, vector_to_string(vector));191 (uint16_t) n, vector_to_string(n)); 194 192 panic_badtrap(istate, vector, "Interruption: %#hx (%s).", 195 (uint16_t) vector, vector_to_string(vector));193 (uint16_t) n, vector_to_string(n)); 196 194 #endif 197 195 } 198 196 199 void nop_handler(uint64_t vector, istate_t *istate)200 {201 }202 203 197 /** Handle syscall. */ 204 int break_instruction(uint64_t vector, istate_t *istate) 205 { 198 sysarg_t break_instruction(unsigned int n, istate_t *istate) 199 { 200 sysarg_t ret; 201 206 202 /* 207 203 * Move to next instruction after BREAK. … … 214 210 } 215 211 216 return syscall_handler(istate->in0, istate->in1, istate->in2, 212 interrupts_enable(); 213 ret = syscall_handler(istate->in0, istate->in1, istate->in2, 217 214 istate->in3, istate->in4, istate->in5, istate->in6); 218 } 219 220 void universal_handler(uint64_t vector, istate_t *istate) 215 interrupts_disable(); 216 217 return ret; 218 } 219 220 void universal_handler(unsigned int n, istate_t *istate) 221 221 { 222 222 fault_if_from_uspace(istate, "Interruption: %#hx (%s).", 223 (uint16_t) vector, vector_to_string(vector));224 panic_badtrap(istate, vector, "Interruption: %#hx (%s).",225 (uint16_t) vector, vector_to_string(vector));223 n, vector_to_string(n)); 224 panic_badtrap(istate, n, "Interruption: %#hx (%s).", 225 n, vector_to_string(n)); 226 226 } 227 227 … … 229 229 { 230 230 asm volatile ( 231 "mov cr.eoi =r0;;"231 "mov cr.eoi = r0 ;;" 232 232 ); 233 233 } 234 234 235 void external_interrupt(u int64_t vector, istate_t *istate)235 void external_interrupt(unsigned int n, istate_t *istate) 236 236 { 237 237 cr_ivr_t ivr; … … 298 298 } 299 299 300 void exception_init(void) 301 { 302 unsigned int i; 303 304 for (i = 0; i < IVT_ITEMS; i++) 305 exc_register(i, "universal_handler", false, universal_handler); 306 307 exc_register(EXC_ALT_ITLB_FAULT, 308 vector_to_string(EXC_ALT_ITLB_FAULT), true, 309 alternate_instruction_tlb_fault); 310 exc_register(EXC_ALT_DTLB_FAULT, 311 vector_to_string(EXC_ALT_DTLB_FAULT), true, 312 alternate_data_tlb_fault); 313 exc_register(EXC_NESTED_TLB_FAULT, 314 vector_to_string(EXC_NESTED_TLB_FAULT), false, 315 data_nested_tlb_fault); 316 exc_register(EXC_DATA_D_BIT_FAULT, 317 vector_to_string(EXC_DATA_D_BIT_FAULT), true, 318 data_dirty_bit_fault); 319 exc_register(EXC_INST_A_BIT_FAULT, 320 vector_to_string(EXC_INST_A_BIT_FAULT), true, 321 instruction_access_bit_fault); 322 exc_register(EXC_DATA_A_BIT_FAULT, 323 vector_to_string(EXC_DATA_A_BIT_FAULT), true, 324 data_access_bit_fault); 325 exc_register(EXC_EXT_INTERRUPT, 326 vector_to_string(EXC_EXT_INTERRUPT), true, 327 external_interrupt); 328 329 exc_register(EXC_PAGE_NOT_PRESENT, 330 vector_to_string(EXC_PAGE_NOT_PRESENT), true, 331 page_not_present); 332 exc_register(EXC_DATA_AR_FAULT, 333 vector_to_string(EXC_DATA_AR_FAULT), true, 334 data_access_rights_fault); 335 exc_register(EXC_GENERAL_EXCEPTION, 336 vector_to_string(EXC_GENERAL_EXCEPTION), false, 337 general_exception); 338 exc_register(EXC_DISABLED_FP_REG, 339 vector_to_string(EXC_DISABLED_FP_REG), true, 340 disabled_fp_register); 341 } 342 300 343 /** @} 301 344 */ -
kernel/arch/ia64/src/ivt.S
reae91e0 r235d31d 31 31 #include <arch/register.h> 32 32 #include <arch/mm/page.h> 33 #include <arch/interrupt.h> 33 34 #include <arch/istate_struct.h> 34 35 #include <align.h> … … 39 40 40 41 /** Partitioning of bank 0 registers. */ 41 #define R_ OFFSr1642 #define R_VECTOR r16 42 43 #define R_HANDLER r17 43 44 #define R_RET r18 44 #define R_TMP r1945 45 #define R_KSTACK_BSP r22 /* keep in sync with before_thread_runs_arch() */ 46 46 #define R_KSTACK r23 /* keep in sync with before_thread_runs_arch() */ 47 47 48 48 /* Speculation vector handler */ 49 .macro SPECULATION_VECTOR_HANDLER offs50 .org ivt + \ offs49 .macro SPECULATION_VECTOR_HANDLER vector 50 .org ivt + \vector * 0x100 51 51 52 52 /* 1. Save predicates, IIM, IIP, IPSR and ISR CR's in bank 0 registers. */ … … 94 94 * @param handler Interrupt handler address. 95 95 */ 96 .macro HEAVYWEIGHT_HANDLER offs, handler=universal_handler97 .org ivt + \ offs98 mov R_ OFFS = \offs96 .macro HEAVYWEIGHT_HANDLER vector, handler=exc_dispatch 97 .org ivt + \vector * 0x100 98 mov R_VECTOR = \vector 99 99 movl R_HANDLER = \handler ;; 100 100 br heavyweight_handler … … 165 165 * copy input parameters to stack. 166 166 */ 167 mov R_TMP = 0x2c00 ;; 168 cmp.eq p6, p5 = R_OFFS, R_TMP ;; 167 cmp.eq p6, p5 = EXC_BREAK_INSTRUCTION, R_VECTOR ;; 169 168 170 169 /* … … 309 308 mov loc1 = R_RET /* b0 belonging to interrupted context */ 310 309 mov loc2 = R_HANDLER 311 mov out0 = R_ OFFS310 mov out0 = R_VECTOR 312 311 313 312 add out1 = STACK_SCRATCH_AREA_SIZE, r12 … … 543 542 .align 32768 544 543 ivt: 545 HEAVYWEIGHT_HANDLER 0x00 00546 HEAVYWEIGHT_HANDLER 0x04 00547 HEAVYWEIGHT_HANDLER 0x08 00548 HEAVYWEIGHT_HANDLER 0x0c 00 alternate_instruction_tlb_fault549 HEAVYWEIGHT_HANDLER 0x10 00 alternate_data_tlb_fault550 HEAVYWEIGHT_HANDLER 0x14 00 data_nested_tlb_fault551 HEAVYWEIGHT_HANDLER 0x18 00552 HEAVYWEIGHT_HANDLER 0x1c 00553 HEAVYWEIGHT_HANDLER 0x20 00 data_dirty_bit_fault554 HEAVYWEIGHT_HANDLER 0x24 00 instruction_access_bit_fault555 HEAVYWEIGHT_HANDLER 0x28 00 data_access_bit_fault556 HEAVYWEIGHT_HANDLER 0x2c 00break_instruction557 HEAVYWEIGHT_HANDLER 0x30 00 external_interrupt /* For external interrupt, heavyweight handler is used. */558 HEAVYWEIGHT_HANDLER 0x34 00559 HEAVYWEIGHT_HANDLER 0x38 00560 HEAVYWEIGHT_HANDLER 0x3c 00561 HEAVYWEIGHT_HANDLER 0x40 00562 HEAVYWEIGHT_HANDLER 0x44 00563 HEAVYWEIGHT_HANDLER 0x48 00564 HEAVYWEIGHT_HANDLER 0x4c 00565 566 HEAVYWEIGHT_HANDLER 0x50 00 page_not_present567 HEAVYWEIGHT_HANDLER 0x51 00568 HEAVYWEIGHT_HANDLER 0x52 00569 HEAVYWEIGHT_HANDLER 0x53 00 data_access_rights_fault570 HEAVYWEIGHT_HANDLER 0x54 00 general_exception571 HEAVYWEIGHT_HANDLER 0x55 00 disabled_fp_register572 HEAVYWEIGHT_HANDLER 0x56 00573 SPECULATION_VECTOR_HANDLER 0x57 00574 HEAVYWEIGHT_HANDLER 0x58 00575 HEAVYWEIGHT_HANDLER 0x59 00576 HEAVYWEIGHT_HANDLER 0x5a 00577 HEAVYWEIGHT_HANDLER 0x5b 00578 HEAVYWEIGHT_HANDLER 0x5c 00579 HEAVYWEIGHT_HANDLER 0x5d 00580 HEAVYWEIGHT_HANDLER 0x5e 00581 HEAVYWEIGHT_HANDLER 0x5f 00582 583 HEAVYWEIGHT_HANDLER 0x60 00584 HEAVYWEIGHT_HANDLER 0x61 00585 HEAVYWEIGHT_HANDLER 0x62 00586 HEAVYWEIGHT_HANDLER 0x63 00587 HEAVYWEIGHT_HANDLER 0x64 00588 HEAVYWEIGHT_HANDLER 0x65 00589 HEAVYWEIGHT_HANDLER 0x66 00590 HEAVYWEIGHT_HANDLER 0x67 00591 HEAVYWEIGHT_HANDLER 0x68 00592 HEAVYWEIGHT_HANDLER 0x69 00593 HEAVYWEIGHT_HANDLER 0x6a 00594 HEAVYWEIGHT_HANDLER 0x6b 00595 HEAVYWEIGHT_HANDLER 0x6c 00596 HEAVYWEIGHT_HANDLER 0x6d 00597 HEAVYWEIGHT_HANDLER 0x6e 00598 HEAVYWEIGHT_HANDLER 0x6f 00599 600 HEAVYWEIGHT_HANDLER 0x70 00601 HEAVYWEIGHT_HANDLER 0x71 00602 HEAVYWEIGHT_HANDLER 0x72 00603 HEAVYWEIGHT_HANDLER 0x73 00604 HEAVYWEIGHT_HANDLER 0x74 00605 HEAVYWEIGHT_HANDLER 0x75 00606 HEAVYWEIGHT_HANDLER 0x76 00607 HEAVYWEIGHT_HANDLER 0x77 00608 HEAVYWEIGHT_HANDLER 0x78 00609 HEAVYWEIGHT_HANDLER 0x79 00610 HEAVYWEIGHT_HANDLER 0x7a 00611 HEAVYWEIGHT_HANDLER 0x7b 00612 HEAVYWEIGHT_HANDLER 0x7c 00613 HEAVYWEIGHT_HANDLER 0x7d 00614 HEAVYWEIGHT_HANDLER 0x7e 00615 HEAVYWEIGHT_HANDLER 0x7f 00544 HEAVYWEIGHT_HANDLER 0x00 545 HEAVYWEIGHT_HANDLER 0x04 546 HEAVYWEIGHT_HANDLER 0x08 547 HEAVYWEIGHT_HANDLER 0x0c 548 HEAVYWEIGHT_HANDLER 0x10 549 HEAVYWEIGHT_HANDLER 0x14 550 HEAVYWEIGHT_HANDLER 0x18 551 HEAVYWEIGHT_HANDLER 0x1c 552 HEAVYWEIGHT_HANDLER 0x20 553 HEAVYWEIGHT_HANDLER 0x24 554 HEAVYWEIGHT_HANDLER 0x28 555 HEAVYWEIGHT_HANDLER 0x2c break_instruction 556 HEAVYWEIGHT_HANDLER 0x30 557 HEAVYWEIGHT_HANDLER 0x34 558 HEAVYWEIGHT_HANDLER 0x38 559 HEAVYWEIGHT_HANDLER 0x3c 560 HEAVYWEIGHT_HANDLER 0x40 561 HEAVYWEIGHT_HANDLER 0x44 562 HEAVYWEIGHT_HANDLER 0x48 563 HEAVYWEIGHT_HANDLER 0x4c 564 565 HEAVYWEIGHT_HANDLER 0x50 566 HEAVYWEIGHT_HANDLER 0x51 567 HEAVYWEIGHT_HANDLER 0x52 568 HEAVYWEIGHT_HANDLER 0x53 569 HEAVYWEIGHT_HANDLER 0x54 570 HEAVYWEIGHT_HANDLER 0x55 571 HEAVYWEIGHT_HANDLER 0x56 572 SPECULATION_VECTOR_HANDLER 0x57 573 HEAVYWEIGHT_HANDLER 0x58 574 HEAVYWEIGHT_HANDLER 0x59 575 HEAVYWEIGHT_HANDLER 0x5a 576 HEAVYWEIGHT_HANDLER 0x5b 577 HEAVYWEIGHT_HANDLER 0x5c 578 HEAVYWEIGHT_HANDLER 0x5d 579 HEAVYWEIGHT_HANDLER 0x5e 580 HEAVYWEIGHT_HANDLER 0x5f 581 582 HEAVYWEIGHT_HANDLER 0x60 583 HEAVYWEIGHT_HANDLER 0x61 584 HEAVYWEIGHT_HANDLER 0x62 585 HEAVYWEIGHT_HANDLER 0x63 586 HEAVYWEIGHT_HANDLER 0x64 587 HEAVYWEIGHT_HANDLER 0x65 588 HEAVYWEIGHT_HANDLER 0x66 589 HEAVYWEIGHT_HANDLER 0x67 590 HEAVYWEIGHT_HANDLER 0x68 591 HEAVYWEIGHT_HANDLER 0x69 592 HEAVYWEIGHT_HANDLER 0x6a 593 HEAVYWEIGHT_HANDLER 0x6b 594 HEAVYWEIGHT_HANDLER 0x6c 595 HEAVYWEIGHT_HANDLER 0x6d 596 HEAVYWEIGHT_HANDLER 0x6e 597 HEAVYWEIGHT_HANDLER 0x6f 598 599 HEAVYWEIGHT_HANDLER 0x70 600 HEAVYWEIGHT_HANDLER 0x71 601 HEAVYWEIGHT_HANDLER 0x72 602 HEAVYWEIGHT_HANDLER 0x73 603 HEAVYWEIGHT_HANDLER 0x74 604 HEAVYWEIGHT_HANDLER 0x75 605 HEAVYWEIGHT_HANDLER 0x76 606 HEAVYWEIGHT_HANDLER 0x77 607 HEAVYWEIGHT_HANDLER 0x78 608 HEAVYWEIGHT_HANDLER 0x79 609 HEAVYWEIGHT_HANDLER 0x7a 610 HEAVYWEIGHT_HANDLER 0x7b 611 HEAVYWEIGHT_HANDLER 0x7c 612 HEAVYWEIGHT_HANDLER 0x7d 613 HEAVYWEIGHT_HANDLER 0x7e 614 HEAVYWEIGHT_HANDLER 0x7f -
kernel/arch/ia64/src/mm/tlb.c
reae91e0 r235d31d 477 477 /** Instruction TLB fault handler for faults with VHPT turned off. 478 478 * 479 * @param vectorInterruption vector.480 * @param istate Structure with saved interruption state. 481 * 482 */ 483 void alternate_instruction_tlb_fault(u int64_t vector, istate_t *istate)479 * @param n Interruption vector. 480 * @param istate Structure with saved interruption state. 481 * 482 */ 483 void alternate_instruction_tlb_fault(unsigned int n, istate_t *istate) 484 484 { 485 485 uintptr_t va; … … 566 566 /** Data TLB fault handler for faults with VHPT turned off. 567 567 * 568 * @param vectorInterruption vector.569 * @param istate Structure with saved interruption state. 570 * 571 */ 572 void alternate_data_tlb_fault(u int64_t vector, istate_t *istate)568 * @param n Interruption vector. 569 * @param istate Structure with saved interruption state. 570 * 571 */ 572 void alternate_data_tlb_fault(unsigned int n, istate_t *istate) 573 573 { 574 574 if (istate->cr_isr.sp) { … … 623 623 * This fault should not occur. 624 624 * 625 * @param vectorInterruption vector.626 * @param istate Structure with saved interruption state. 627 * 628 */ 629 void data_nested_tlb_fault(u int64_t vector, istate_t *istate)625 * @param n Interruption vector. 626 * @param istate Structure with saved interruption state. 627 * 628 */ 629 void data_nested_tlb_fault(unsigned int n, istate_t *istate) 630 630 { 631 631 ASSERT(false); … … 634 634 /** Data Dirty bit fault handler. 635 635 * 636 * @param vectorInterruption vector.637 * @param istate Structure with saved interruption state. 638 * 639 */ 640 void data_dirty_bit_fault(u int64_t vector, istate_t *istate)636 * @param n Interruption vector. 637 * @param istate Structure with saved interruption state. 638 * 639 */ 640 void data_dirty_bit_fault(unsigned int n, istate_t *istate) 641 641 { 642 642 uintptr_t va; … … 665 665 /** Instruction access bit fault handler. 666 666 * 667 * @param vectorInterruption vector.668 * @param istate Structure with saved interruption state. 669 * 670 */ 671 void instruction_access_bit_fault(u int64_t vector, istate_t *istate)667 * @param n Interruption vector. 668 * @param istate Structure with saved interruption state. 669 * 670 */ 671 void instruction_access_bit_fault(unsigned int n, istate_t *istate) 672 672 { 673 673 uintptr_t va; … … 694 694 /** Data access bit fault handler. 695 695 * 696 * @param vectorInterruption vector.697 * @param istate Structure with saved interruption state. 698 * 699 */ 700 void data_access_bit_fault(u int64_t vector, istate_t *istate)696 * @param n Interruption vector. 697 * @param istate Structure with saved interruption state. 698 * 699 */ 700 void data_access_bit_fault(unsigned int n, istate_t *istate) 701 701 { 702 702 uintptr_t va; … … 729 729 /** Data access rights fault handler. 730 730 * 731 * @param vectorInterruption vector.732 * @param istate Structure with saved interruption state. 733 * 734 */ 735 void data_access_rights_fault(u int64_t vector, istate_t *istate)731 * @param n Interruption vector. 732 * @param istate Structure with saved interruption state. 733 * 734 */ 735 void data_access_rights_fault(unsigned int n, istate_t *istate) 736 736 { 737 737 uintptr_t va; … … 753 753 /** Page not present fault handler. 754 754 * 755 * @param vectorInterruption vector.756 * @param istate Structure with saved interruption state. 757 * 758 */ 759 void page_not_present(u int64_t vector, istate_t *istate)755 * @param n Interruption vector. 756 * @param istate Structure with saved interruption state. 757 * 758 */ 759 void page_not_present(unsigned int n, istate_t *istate) 760 760 { 761 761 uintptr_t va; -
kernel/arch/mips32/Makefile.inc
reae91e0 r235d31d 71 71 arch/$(KARCH)/src/fpu_context.c \ 72 72 arch/$(KARCH)/src/smp/smp.c \ 73 arch/$(KARCH)/src/smp/smp_call.c \ 73 74 arch/$(KARCH)/src/machine_func.c 74 75 -
kernel/arch/sparc32/include/arch/stack.h
reae91e0 r235d31d 54 54 #define STACK_ARG_SAVE_AREA_SIZE (6 * STACK_ITEM_SIZE) 55 55 56 /**57 * Offsets of arguments on stack.58 */59 #define STACK_ARG0 060 #define STACK_ARG1 461 #define STACK_ARG2 862 #define STACK_ARG3 1263 #define STACK_ARG4 1664 #define STACK_ARG5 2065 #define STACK_ARG6 2466 67 56 #endif 68 57 -
kernel/arch/sparc32/src/cpu/cpu.c
reae91e0 r235d31d 34 34 35 35 #include <arch/cpu.h> 36 #include <cpu.h> 36 37 #include <arch.h> 37 38 #include <typedefs.h> -
kernel/arch/sparc32/src/debug/stacktrace.c
reae91e0 r235d31d 39 39 #include <arch.h> 40 40 #include <arch/stack.h> 41 #include <proc/thread.h> 41 42 42 43 #define FRAME_OFFSET_FP_PREV 14 -
kernel/arch/sparc32/src/sparc32.c
reae91e0 r235d31d 37 37 #include <arch/interrupt.h> 38 38 #include <arch/asm.h> 39 #include <arch/barrier.h> 39 40 #include <arch/machine_func.h> 40 41 #include <func.h> … … 169 170 } 170 171 172 bool __atomic_compare_exchange_4(uint32_t *ptr, uint32_t *expected, 173 uint32_t desired, bool weak, int success_mm, int failure_mm) 174 { 175 ipl_t ipl; 176 bool success; 177 178 /* XXX: This is a rather dummy implementation. */ 179 180 ipl = interrupts_disable(); 181 memory_barrier(); 182 if (*ptr == *expected) { 183 success = true; 184 *ptr = desired; 185 } else { 186 success = false; 187 *expected = *ptr; 188 } 189 memory_barrier(); 190 interrupts_restore(ipl); 191 192 return success; 193 } 194 171 195 /** @} 172 196 */ -
kernel/arch/sparc64/Makefile.inc
reae91e0 r235d31d 100 100 ARCH_SOURCES += \ 101 101 arch/$(KARCH)/src/smp/$(USARCH)/smp.c \ 102 arch/$(KARCH)/src/smp/$(USARCH)/smp_call.c \ 102 103 arch/$(KARCH)/src/smp/$(USARCH)/ipi.c 103 104 endif -
kernel/arch/sparc64/include/arch/barrier.h
reae91e0 r235d31d 37 37 38 38 #include <trace.h> 39 40 #ifdef KERNEL 41 #include <arch/common.h> 42 #else 43 #include <libarch/common.h> 44 #endif 39 45 40 46 /* -
kernel/arch/sparc64/include/arch/interrupt.h
reae91e0 r235d31d 40 40 #include <arch/istate.h> 41 41 42 #define IVT_ITEMS 1543 #define IVT_FIRST 142 #define IVT_ITEMS 512 43 #define IVT_FIRST 0 44 44 45 45 /* This needs to be defined for inter-architecture API portability. */ … … 47 47 48 48 enum { 49 IPI_TLB_SHOOTDOWN = VECTOR_TLB_SHOOTDOWN_IPI 49 IPI_TLB_SHOOTDOWN = VECTOR_TLB_SHOOTDOWN_IPI, 50 IPI_SMP_CALL 50 51 }; 52 53 extern void exc_arch_init(void); 51 54 52 55 #endif -
kernel/arch/sparc64/include/arch/istate_struct.ag
reae91e0 r235d31d 41 41 42 42 members : [ 43 44 # 45 # Window save area for locals and inputs. Required by ABI. 46 # Before using these, make sure that the corresponding register 47 # window has been spilled into memory, otherwise l0-l7 and 48 # i0-i7 will have undefined values. 49 # 50 { 51 name : l0, 52 type : uint64_t, 53 }, 54 { 55 name : l1, 56 type : uint64_t, 57 }, 58 { 59 name : l2, 60 type : uint64_t, 61 }, 62 { 63 name : l3, 64 type : uint64_t, 65 }, 66 { 67 name : l4, 68 type : uint64_t, 69 }, 70 { 71 name : l5, 72 type : uint64_t, 73 }, 74 { 75 name : l6, 76 type : uint64_t, 77 }, 78 { 79 name : l7, 80 type : uint64_t, 81 }, 82 { 83 name : i0, 84 type : uint64_t, 85 }, 86 { 87 name : i1, 88 type : uint64_t, 89 }, 90 { 91 name : i2, 92 type : uint64_t, 93 }, 94 { 95 name : i3, 96 type : uint64_t, 97 }, 98 { 99 name : i4, 100 type : uint64_t, 101 }, 102 { 103 name : i5, 104 type : uint64_t, 105 }, 106 { 107 name : i6, 108 type : uint64_t, 109 }, 110 { 111 name : i7, 112 type : uint64_t, 113 }, 114 115 # 116 # Six mandatory argument slots, required by the ABI, plus an 117 # optional argument slot for the 7th argument used by our 118 # syscalls. Since the preemptible handler is always passing 119 # integral arguments, undef_arg[0] - undef_arg[5] are always 120 # undefined. 121 # 122 { 123 name : undef_arg, 124 type : uint64_t, 125 elements : 6, 126 }, 127 { 128 name : arg6, 129 type : uint64_t, 130 }, 131 132 # 133 # From this point onwards, the istate layout is not dicated by 134 # the ABI. The only requirement is the stack alignment. 135 # 136 43 137 { 44 138 name : tnpc, … … 51 145 { 52 146 name : tstate, 147 type : uint64_t 148 }, 149 { 150 name : y, 151 type : uint64_t, 152 }, 153 154 # 155 # At the moment, these are defined only when needed by the 156 # preemptible handler, so consider them undefined for now. 157 # 158 { 159 name : o0, 160 type : uint64_t, 161 }, 162 { 163 name : o1, 164 type : uint64_t, 165 }, 166 { 167 name : o2, 168 type : uint64_t, 169 }, 170 { 171 name : o3, 172 type : uint64_t, 173 }, 174 { 175 name : o4, 176 type : uint64_t, 177 }, 178 { 179 name : o5, 180 type : uint64_t, 181 }, 182 { 183 name : o6, 184 type : uint64_t, 185 }, 186 { 187 name : o7, 188 type : uint64_t, 189 }, 190 191 # 192 # I/DTLB Tag Access register or zero for non-MMU traps. 193 # 194 { 195 name : tlb_tag_access, 53 196 type : uint64_t 54 197 } -
kernel/arch/sparc64/include/arch/mm/sun4u/tlb.h
reae91e0 r235d31d 678 678 } 679 679 680 extern void fast_instruction_access_mmu_miss( sysarg_t, istate_t *);681 extern void fast_data_access_mmu_miss( tlb_tag_access_reg_t, istate_t *);682 extern void fast_data_access_protection( tlb_tag_access_reg_t, istate_t *);680 extern void fast_instruction_access_mmu_miss(unsigned int, istate_t *); 681 extern void fast_data_access_mmu_miss(unsigned int, istate_t *); 682 extern void fast_data_access_protection(unsigned int, istate_t *); 683 683 684 684 extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool); -
kernel/arch/sparc64/include/arch/mm/sun4v/tlb.h
reae91e0 r235d31d 141 141 } 142 142 143 extern void fast_instruction_access_mmu_miss( sysarg_t, istate_t *);144 extern void fast_data_access_mmu_miss( sysarg_t, istate_t *);145 extern void fast_data_access_protection( sysarg_t, istate_t *);143 extern void fast_instruction_access_mmu_miss(unsigned int, istate_t *); 144 extern void fast_data_access_mmu_miss(unsigned int, istate_t *); 145 extern void fast_data_access_protection(unsigned int, istate_t *); 146 146 147 147 extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool); -
kernel/arch/sparc64/include/arch/trap/exception.h
reae91e0 r235d31d 71 71 extern void dump_istate(istate_t *istate); 72 72 73 extern void instruction_access_exception( int n, istate_t *istate);74 extern void instruction_access_error( int n, istate_t *istate);75 extern void illegal_instruction( int n, istate_t *istate);76 extern void privileged_opcode( int n, istate_t *istate);77 extern void unimplemented_LDD( int n, istate_t *istate);78 extern void unimplemented_STD( int n, istate_t *istate);79 extern void fp_disabled( int n, istate_t *istate);80 extern void fp_exception_ieee_754( int n, istate_t *istate);81 extern void fp_exception_other( int n, istate_t *istate);82 extern void tag_overflow( int n, istate_t *istate);83 extern void division_by_zero( int n, istate_t *istate);84 extern void data_access_exception( int n, istate_t *istate);85 extern void data_access_error( int n, istate_t *istate);86 extern void mem_address_not_aligned( int n, istate_t *istate);87 extern void LDDF_mem_address_not_aligned( int n, istate_t *istate);88 extern void STDF_mem_address_not_aligned( int n, istate_t *istate);89 extern void privileged_action( int n, istate_t *istate);90 extern void LDQF_mem_address_not_aligned( int n, istate_t *istate);91 extern void STQF_mem_address_not_aligned( int n, istate_t *istate);73 extern void instruction_access_exception(unsigned int, istate_t *); 74 extern void instruction_access_error(unsigned int, istate_t *); 75 extern void illegal_instruction(unsigned int, istate_t *); 76 extern void privileged_opcode(unsigned int, istate_t *); 77 extern void unimplemented_LDD(unsigned int, istate_t *); 78 extern void unimplemented_STD(unsigned int, istate_t *); 79 extern void fp_disabled(unsigned int, istate_t *); 80 extern void fp_exception_ieee_754(unsigned int, istate_t *); 81 extern void fp_exception_other(unsigned int, istate_t *); 82 extern void tag_overflow(unsigned int, istate_t *); 83 extern void division_by_zero(unsigned int, istate_t *); 84 extern void data_access_exception(unsigned int, istate_t *); 85 extern void data_access_error(unsigned int, istate_t *); 86 extern void mem_address_not_aligned(unsigned int, istate_t *); 87 extern void LDDF_mem_address_not_aligned(unsigned int, istate_t *); 88 extern void STDF_mem_address_not_aligned(unsigned int, istate_t *); 89 extern void privileged_action(unsigned int, istate_t *); 90 extern void LDQF_mem_address_not_aligned(unsigned int, istate_t *); 91 extern void STQF_mem_address_not_aligned(unsigned int, istate_t *); 92 92 93 93 #endif /* !__ASM__ */ -
kernel/arch/sparc64/include/arch/trap/interrupt.h
reae91e0 r235d31d 63 63 #define IGN_SHIFT 6 64 64 65 66 #ifdef __ASM__67 .macro INTERRUPT_LEVEL_N_HANDLER n68 mov \n - 1, %g269 PREEMPTIBLE_HANDLER exc_dispatch70 .endm71 #endif72 73 65 #ifndef __ASM__ 74 66 75 67 #include <arch/interrupt.h> 76 68 77 extern void interrupt(int n, istate_t *istate); 69 extern void interrupt(unsigned int n, istate_t *istate); 70 78 71 #endif /* !def __ASM__ */ 79 72 -
kernel/arch/sparc64/include/arch/trap/sun4u/interrupt.h
reae91e0 r235d31d 92 92 #define INTERRUPT_VECTOR_TRAP_HANDLER_SIZE TRAP_TABLE_ENTRY_SIZE 93 93 94 #ifdef __ASM__95 .macro INTERRUPT_VECTOR_TRAP_HANDLER96 PREEMPTIBLE_HANDLER interrupt97 .endm98 #endif /* __ASM__ */99 100 101 94 #endif 102 95 -
kernel/arch/sparc64/include/arch/trap/sun4u/mmu.h
reae91e0 r235d31d 74 74 0: 75 75 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate 76 PREEMPTIBLE_HANDLER fast_instruction_access_mmu_miss 76 mov TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, %g2 77 mov VA_IMMU_TAG_ACCESS, %g5 78 ldxa [%g5] ASI_IMMU, %g5 ! read the faulting Context and VPN 79 PREEMPTIBLE_HANDLER exc_dispatch 77 80 .endm 78 81 … … 107 110 wr %g0, ASI_DMMU, %asi 108 111 ldxa [VA_DMMU_TAG_ACCESS] %asi, %g1 ! read the faulting Context and VPN 109 set TLB_TAG_ACCESS_CONTEXT_MASK, %g2112 ldx [%g7 + %lo(tlb_tag_access_context_mask)], %g2 110 113 andcc %g1, %g2, %g3 ! get Context 111 114 bnz %xcc, 0f ! Context is non-zero … … 138 141 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate 139 142 140 /* 141 * Read the Tag Access register for the higher-level handler. 142 * This is necessary to survive nested DTLB misses. 143 */ 144 ldxa [VA_DMMU_TAG_ACCESS] %asi, %g2 145 146 /* 147 * g2 will be passed as an argument to fast_data_access_mmu_miss(). 148 */ 149 PREEMPTIBLE_HANDLER fast_data_access_mmu_miss 143 mov TT_FAST_DATA_ACCESS_MMU_MISS, %g2 144 ldxa [VA_DMMU_TAG_ACCESS] %asi, %g5 ! read the faulting Context and VPN 145 PREEMPTIBLE_HANDLER exc_dispatch 150 146 .endm 151 147 … … 164 160 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate 165 161 166 /* 167 * Read the Tag Access register for the higher-level handler. 168 * This is necessary to survive nested DTLB misses. 169 */ 170 mov VA_DMMU_TAG_ACCESS, %g2 171 ldxa [%g2] ASI_DMMU, %g2 172 173 /* 174 * g2 will be passed as an argument to fast_data_access_mmu_miss(). 175 */ 176 PREEMPTIBLE_HANDLER fast_data_access_protection 162 mov TT_FAST_DATA_ACCESS_PROTECTION, %g2 163 mov VA_DMMU_TAG_ACCESS, %g5 164 ldxa [%g5] ASI_DMMU, %g5 ! read the faulting Context and VPN 165 PREEMPTIBLE_HANDLER exc_dispatch 177 166 .endm 178 167 -
kernel/arch/sparc64/include/arch/trap/sun4v/interrupt.h
reae91e0 r235d31d 40 40 #ifndef __ASM__ 41 41 42 #include <arch/istate_struct.h> 43 42 44 extern void sun4v_ipi_init(void); 43 extern void cpu_mondo( void);45 extern void cpu_mondo(unsigned int, istate_t *); 44 46 45 47 #endif -
kernel/arch/sparc64/include/arch/trap/sun4v/mmu.h
reae91e0 r235d31d 73 73 74 74 .macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER 75 PREEMPTIBLE_HANDLER fast_instruction_access_mmu_miss 75 mov TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, %g2 76 clr %g5 ! XXX 77 PREEMPTIBLE_HANDLER exc_dispatch 76 78 .endm 77 79 … … 123 125 * mapped. In such a case, this handler will be called from TL = 1. 124 126 * We handle the situation by pretending that the MMU miss occurred 125 * on TL = 0. Once the MMU miss trap is service s, the instruction which127 * on TL = 0. Once the MMU miss trap is serviced, the instruction which 126 128 * caused the spill/fill trap is restarted, the spill/fill trap occurs, 127 * but this time its handler accesse memory which ISmapped.129 * but this time its handler accesses memory which is mapped. 128 130 */ 129 131 .if (\tl > 0) … … 131 133 .endif 132 134 135 mov TT_FAST_DATA_ACCESS_MMU_MISS, %g2 136 133 137 /* 134 * Save the faulting virtual page and faulting context to the %g 2135 * register. The most significant 51 bits of the %g 2register will138 * Save the faulting virtual page and faulting context to the %g5 139 * register. The most significant 51 bits of the %g5 register will 136 140 * contain the virtual address which caused the fault truncated to the 137 * page boundary. The least significant 13 bits of the %g 2register141 * page boundary. The least significant 13 bits of the %g5 register 138 142 * will contain the number of the context in which the fault occurred. 139 * The value of the %g 2 register will be passed as a parameter to the140 * higher level service routine.143 * The value of the %g5 register will be stored in the istate structure 144 * for inspeciton by the higher level service routine. 141 145 */ 142 or %g1, %g3, %g 2146 or %g1, %g3, %g5 143 147 144 PREEMPTIBLE_HANDLER fast_data_access_mmu_miss148 PREEMPTIBLE_HANDLER exc_dispatch 145 149 .endm 146 150 … … 170 174 sllx %g1, TTE_DATA_TADDR_OFFSET, %g1 171 175 176 mov TT_FAST_DATA_ACCESS_PROTECTION, %g2 177 172 178 /* the same as for FAST_DATA_ACCESS_MMU_MISS_HANDLER */ 173 or %g1, %g3, %g 2179 or %g1, %g3, %g5 174 180 175 PREEMPTIBLE_HANDLER fast_data_access_protection181 PREEMPTIBLE_HANDLER exc_dispatch 176 182 .endm 177 183 #endif /* __ASM__ */ -
kernel/arch/sparc64/include/arch/trap/trap_table.h
reae91e0 r235d31d 43 43 #define TRAP_TABLE_SIZE (TRAP_TABLE_ENTRY_COUNT * TRAP_TABLE_ENTRY_SIZE) 44 44 45 #define ISTATE_END_OFFSET(o) ((o) - ISTATE_SIZE)46 47 /*48 * The one STACK_ITEM_SIZE is counted for space holding the 7th49 * argument to syscall_handler (i.e. syscall number) and the other50 * STACK_ITEM_SIZE is counted because of the required alignment.51 */52 #define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE \53 (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \54 (2 * STACK_ITEM_SIZE) + (ISTATE_SIZE + 9 * 8))55 /* <-- istate_t ends here */56 #define SAVED_TSTATE ISTATE_END_OFFSET(ISTATE_OFFSET_TSTATE)57 #define SAVED_TPC ISTATE_END_OFFSET(ISTATE_OFFSET_TPC)58 #define SAVED_TNPC ISTATE_END_OFFSET(ISTATE_OFFSET_TNPC)59 /* <-- istate_t begins here */60 #define SAVED_Y -(1 * 8 + ISTATE_SIZE)61 #define SAVED_I0 -(2 * 8 + ISTATE_SIZE)62 #define SAVED_I1 -(3 * 8 + ISTATE_SIZE)63 #define SAVED_I2 -(4 * 8 + ISTATE_SIZE)64 #define SAVED_I3 -(5 * 8 + ISTATE_SIZE)65 #define SAVED_I4 -(6 * 8 + ISTATE_SIZE)66 #define SAVED_I5 -(7 * 8 + ISTATE_SIZE)67 #define SAVED_I6 -(8 * 8 + ISTATE_SIZE)68 #define SAVED_I7 -(9 * 8 + ISTATE_SIZE)69 70 45 #ifndef __ASM__ 71 46 … … 80 55 extern trap_table_entry_t trap_table[TRAP_TABLE_ENTRY_COUNT]; 81 56 extern trap_table_entry_t trap_table_save[TRAP_TABLE_ENTRY_COUNT]; 57 82 58 #endif /* !__ASM__ */ 83 59 -
kernel/arch/sparc64/src/debug/stacktrace.c
reae91e0 r235d31d 36 36 #include <syscall/copy.h> 37 37 #include <typedefs.h> 38 #include <proc/thread.h> 38 39 39 40 #include <arch.h> 40 41 #include <arch/stack.h> 41 42 #include <arch/trap/trap_table.h> 43 44 #include <arch/istate_struct.h> 42 45 43 46 #if defined(SUN4V) … … 61 64 62 65 kstack += STACK_BIAS; 63 kstack -= PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE;66 kstack -= ISTATE_SIZE; 64 67 65 68 if (THREAD && (ctx->fp == kstack)) -
kernel/arch/sparc64/src/drivers/tick.c
reae91e0 r235d31d 35 35 #include <arch/drivers/tick.h> 36 36 #include <arch/interrupt.h> 37 #include <arch/trap/interrupt.h> 37 38 #include <arch/sparc64.h> 38 39 #include <arch/asm.h> … … 51 52 softint_reg_t clear; 52 53 53 interrupt_register(14, "tick_int", tick_interrupt);54 54 compare.int_dis = false; 55 55 compare.tick_cmpr = tick_counter_read() + … … 79 79 /** Process tick interrupt. 80 80 * 81 * @param n Interrupt Level (14, can be ignored)81 * @param n Trap type (0x4e, can be ignored) 82 82 * @param istate Interrupted state. 83 83 * … … 93 93 * Make sure we are servicing interrupt_level_14 94 94 */ 95 ASSERT(n == 14);95 ASSERT(n == TT_INTERRUPT_LEVEL_14); 96 96 97 97 /* -
kernel/arch/sparc64/src/mm/sun4u/tlb.c
reae91e0 r235d31d 194 194 195 195 /** ITLB miss handler. */ 196 void fast_instruction_access_mmu_miss( sysarg_t unused, istate_t *istate)196 void fast_instruction_access_mmu_miss(unsigned int tt, istate_t *istate) 197 197 { 198 198 size_t index = (istate->tpc >> MMU_PAGE_WIDTH) % MMU_PAGES_PER_PAGE; … … 224 224 * low-level, assembly language part of the fast_data_access_mmu_miss handler. 225 225 * 226 * @param tag Content of the TLB Tag Access register as it existed 227 * when the trap happened. This is to prevent confusion 228 * created by clobbered Tag Access register during a nested 229 * DTLB miss. 226 * @param tt Trap type. 230 227 * @param istate Interrupted state saved on the stack. 231 228 */ 232 void fast_data_access_mmu_miss(tlb_tag_access_reg_t tag, istate_t *istate) 233 { 229 void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate) 230 { 231 tlb_tag_access_reg_t tag; 234 232 uintptr_t page_8k; 235 233 uintptr_t page_16k; … … 238 236 as_t *as = AS; 239 237 238 tag.value = istate->tlb_tag_access; 240 239 page_8k = (uint64_t) tag.vpn << MMU_PAGE_WIDTH; 241 240 page_16k = ALIGN_DOWN(page_8k, PAGE_SIZE); … … 276 275 /** DTLB protection fault handler. 277 276 * 278 * @param tag Content of the TLB Tag Access register as it existed 279 * when the trap happened. This is to prevent confusion 280 * created by clobbered Tag Access register during a nested 281 * DTLB miss. 277 * @param tt Trap type. 282 278 * @param istate Interrupted state saved on the stack. 283 279 */ 284 void fast_data_access_protection(tlb_tag_access_reg_t tag, istate_t *istate) 285 { 280 void fast_data_access_protection(unsigned int tt, istate_t *istate) 281 { 282 tlb_tag_access_reg_t tag; 286 283 uintptr_t page_16k; 287 284 size_t index; … … 289 286 as_t *as = AS; 290 287 288 tag.value = istate->tlb_tag_access; 291 289 page_16k = ALIGN_DOWN((uint64_t) tag.vpn << MMU_PAGE_WIDTH, PAGE_SIZE); 292 290 index = tag.vpn % MMU_PAGES_PER_PAGE; /* 16K-page emulation */ -
kernel/arch/sparc64/src/mm/sun4v/tlb.c
reae91e0 r235d31d 208 208 209 209 /** ITLB miss handler. */ 210 void fast_instruction_access_mmu_miss( sysarg_t unused, istate_t *istate)210 void fast_instruction_access_mmu_miss(unsigned int tt, istate_t *istate) 211 211 { 212 212 uintptr_t va = ALIGN_DOWN(istate->tpc, PAGE_SIZE); … … 239 239 * low-level, assembly language part of the fast_data_access_mmu_miss handler. 240 240 * 241 * @param page_and_ctx A 64-bit value describing the fault. The most 242 * significant 51 bits of the value contain the virtual 243 * address which caused the fault truncated to the page 244 * boundary. The least significant 13 bits of the value 245 * contain the number of the context in which the fault 246 * occurred. 241 * @param tt Trap type. 247 242 * @param istate Interrupted state saved on the stack. 248 243 */ 249 void fast_data_access_mmu_miss(u int64_t page_and_ctx, istate_t *istate)244 void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate) 250 245 { 251 246 pte_t *t; 252 uintptr_t va = DMISS_ADDRESS( page_and_ctx);253 uint16_t ctx = DMISS_CONTEXT( page_and_ctx);247 uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access); 248 uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access); 254 249 as_t *as = AS; 255 250 … … 288 283 /** DTLB protection fault handler. 289 284 * 290 * @param page_and_ctx A 64-bit value describing the fault. The most 291 * significant 51 bits of the value contain the virtual 292 * address which caused the fault truncated to the page 293 * boundary. The least significant 13 bits of the value 294 * contain the number of the context in which the fault 295 * occurred. 285 * @param tt Trap type. 296 286 * @param istate Interrupted state saved on the stack. 297 287 */ 298 void fast_data_access_protection(u int64_t page_and_ctx, istate_t *istate)288 void fast_data_access_protection(unsigned int tt, istate_t *istate) 299 289 { 300 290 pte_t *t; 301 uintptr_t va = DMISS_ADDRESS( page_and_ctx);302 uint16_t ctx = DMISS_CONTEXT( page_and_ctx);291 uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access); 292 uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access); 303 293 as_t *as = AS; 304 294 -
kernel/arch/sparc64/src/smp/sun4u/ipi.c
reae91e0 r235d31d 34 34 35 35 #include <smp/ipi.h> 36 #include <arch/smp/sun4u/ipi.h> 36 37 #include <cpu.h> 37 38 #include <arch.h> … … 40 41 #include <config.h> 41 42 #include <mm/tlb.h> 43 #include <smp/smp_call.h> 42 44 #include <arch/interrupt.h> 43 45 #include <arch/trap/interrupt.h> … … 171 173 } 172 174 175 176 /* 177 * Deliver an IPI to the specified processors (except the current one). 178 * 179 * Interrupts must be disabled. 180 * 181 * @param cpu_id Destination cpu id (index into cpus array). Must not 182 * be the current cpu. 183 * @param ipi IPI number. 184 */ 185 void ipi_unicast_arch(unsigned int cpu_id, int ipi) 186 { 187 ASSERT(&cpus[cpu_id] != CPU); 188 189 if (ipi == IPI_SMP_CALL) { 190 cross_call(cpus[cpu_id].arch.mid, smp_call_ipi_recv); 191 } else { 192 panic("Unknown IPI (%d).\n", ipi); 193 return; 194 } 195 } 196 173 197 /** @} 174 198 */ -
kernel/arch/sparc64/src/sun4u/sparc64.c
reae91e0 r235d31d 86 86 void arch_pre_mm_init(void) 87 87 { 88 if (config.cpu_active == 1) 88 if (config.cpu_active == 1) { 89 89 trap_init(); 90 exc_arch_init(); 91 } 90 92 } 91 93 -
kernel/arch/sparc64/src/sun4u/start.S
reae91e0 r235d31d 401 401 402 402 /* 403 * The fast_data_access_mmu_miss_data_hi label and the end_of_identity and404 * kernel_8k_tlb_data_template variables are meant to stay together,405 * a ligned on 16B boundary.403 * The fast_data_access_mmu_miss_data_hi label, the end_of_identity, 404 * kernel_8k_tlb_data_template and tlb_tag_access_context_mask variables 405 * are meant to stay together, aligned on a 32B boundary. 406 406 */ 407 407 .global fast_data_access_mmu_miss_data_hi 408 408 .global end_of_identity 409 409 .global kernel_8k_tlb_data_template 410 411 .align 16 410 .global tlb_tag_access_context_mask 411 412 .align 32 412 413 /* 413 414 * This label is used by the fast_data_access_MMU_miss trap handler. … … 435 436 #endif /* CONFIG_VIRT_IDX_DCACHE */ 436 437 438 /* 439 * This variable is used by the fast_data_access_MMU_miss trap handler. 440 * It allows us to save one precious instruction slot of this handler. 441 */ 442 tlb_tag_access_context_mask: 443 .quad TLB_TAG_ACCESS_CONTEXT_MASK 444 -
kernel/arch/sparc64/src/sun4v/sparc64.c
reae91e0 r235d31d 84 84 void arch_pre_mm_init(void) 85 85 { 86 if (config.cpu_active == 1) 86 if (config.cpu_active == 1) { 87 87 trap_init(); 88 exc_arch_init(); 89 } 88 90 } 89 91 -
kernel/arch/sparc64/src/trap/exception.c
reae91e0 r235d31d 55 55 56 56 /** Handle instruction_access_exception. (0x8) */ 57 void instruction_access_exception( int n, istate_t *istate)57 void instruction_access_exception(unsigned int n, istate_t *istate) 58 58 { 59 59 fault_if_from_uspace(istate, "%s.", __func__); … … 62 62 63 63 /** Handle instruction_access_error. (0xa) */ 64 void instruction_access_error( int n, istate_t *istate)64 void instruction_access_error(unsigned int n, istate_t *istate) 65 65 { 66 66 fault_if_from_uspace(istate, "%s.", __func__); … … 69 69 70 70 /** Handle illegal_instruction. (0x10) */ 71 void illegal_instruction( int n, istate_t *istate)71 void illegal_instruction(unsigned int n, istate_t *istate) 72 72 { 73 73 fault_if_from_uspace(istate, "%s.", __func__); … … 76 76 77 77 /** Handle privileged_opcode. (0x11) */ 78 void privileged_opcode( int n, istate_t *istate)78 void privileged_opcode(unsigned int n, istate_t *istate) 79 79 { 80 80 fault_if_from_uspace(istate, "%s.", __func__); … … 83 83 84 84 /** Handle unimplemented_LDD. (0x12) */ 85 void unimplemented_LDD( int n, istate_t *istate)85 void unimplemented_LDD(unsigned int n, istate_t *istate) 86 86 { 87 87 fault_if_from_uspace(istate, "%s.", __func__); … … 90 90 91 91 /** Handle unimplemented_STD. (0x13) */ 92 void unimplemented_STD( int n, istate_t *istate)92 void unimplemented_STD(unsigned int n, istate_t *istate) 93 93 { 94 94 fault_if_from_uspace(istate, "%s.", __func__); … … 97 97 98 98 /** Handle fp_disabled. (0x20) */ 99 void fp_disabled( int n, istate_t *istate)99 void fp_disabled(unsigned int n, istate_t *istate) 100 100 { 101 101 fprs_reg_t fprs; … … 117 117 118 118 /** Handle fp_exception_ieee_754. (0x21) */ 119 void fp_exception_ieee_754( int n, istate_t *istate)119 void fp_exception_ieee_754(unsigned int n, istate_t *istate) 120 120 { 121 121 fault_if_from_uspace(istate, "%s.", __func__); … … 124 124 125 125 /** Handle fp_exception_other. (0x22) */ 126 void fp_exception_other( int n, istate_t *istate)126 void fp_exception_other(unsigned int n, istate_t *istate) 127 127 { 128 128 fault_if_from_uspace(istate, "%s.", __func__); … … 131 131 132 132 /** Handle tag_overflow. (0x23) */ 133 void tag_overflow( int n, istate_t *istate)133 void tag_overflow(unsigned int n, istate_t *istate) 134 134 { 135 135 fault_if_from_uspace(istate, "%s.", __func__); … … 138 138 139 139 /** Handle division_by_zero. (0x28) */ 140 void division_by_zero( int n, istate_t *istate)140 void division_by_zero(unsigned int n, istate_t *istate) 141 141 { 142 142 fault_if_from_uspace(istate, "%s.", __func__); … … 145 145 146 146 /** Handle data_access_exception. (0x30) */ 147 void data_access_exception( int n, istate_t *istate)147 void data_access_exception(unsigned int n, istate_t *istate) 148 148 { 149 149 fault_if_from_uspace(istate, "%s.", __func__); … … 152 152 153 153 /** Handle data_access_error. (0x32) */ 154 void data_access_error( int n, istate_t *istate)154 void data_access_error(unsigned int n, istate_t *istate) 155 155 { 156 156 fault_if_from_uspace(istate, "%s.", __func__); … … 159 159 160 160 /** Handle mem_address_not_aligned. (0x34) */ 161 void mem_address_not_aligned( int n, istate_t *istate)161 void mem_address_not_aligned(unsigned int n, istate_t *istate) 162 162 { 163 163 fault_if_from_uspace(istate, "%s.", __func__); … … 166 166 167 167 /** Handle LDDF_mem_address_not_aligned. (0x35) */ 168 void LDDF_mem_address_not_aligned( int n, istate_t *istate)168 void LDDF_mem_address_not_aligned(unsigned int n, istate_t *istate) 169 169 { 170 170 fault_if_from_uspace(istate, "%s.", __func__); … … 173 173 174 174 /** Handle STDF_mem_address_not_aligned. (0x36) */ 175 void STDF_mem_address_not_aligned( int n, istate_t *istate)175 void STDF_mem_address_not_aligned(unsigned int n, istate_t *istate) 176 176 { 177 177 fault_if_from_uspace(istate, "%s.", __func__); … … 180 180 181 181 /** Handle privileged_action. (0x37) */ 182 void privileged_action( int n, istate_t *istate)182 void privileged_action(unsigned int n, istate_t *istate) 183 183 { 184 184 fault_if_from_uspace(istate, "%s.", __func__); … … 187 187 188 188 /** Handle LDQF_mem_address_not_aligned. (0x38) */ 189 void LDQF_mem_address_not_aligned( int n, istate_t *istate)189 void LDQF_mem_address_not_aligned(unsigned int n, istate_t *istate) 190 190 { 191 191 fault_if_from_uspace(istate, "%s.", __func__); … … 194 194 195 195 /** Handle STQF_mem_address_not_aligned. (0x39) */ 196 void STQF_mem_address_not_aligned( int n, istate_t *istate)196 void STQF_mem_address_not_aligned(unsigned int n, istate_t *istate) 197 197 { 198 198 fault_if_from_uspace(istate, "%s.", __func__); -
kernel/arch/sparc64/src/trap/interrupt.c
reae91e0 r235d31d 36 36 #include <arch/interrupt.h> 37 37 #include <arch/trap/interrupt.h> 38 #include <arch/trap/exception.h> 39 #include <arch/trap/mmu.h> 38 40 #include <arch/sparc64.h> 39 41 #include <interrupt.h> … … 43 45 #include <arch/asm.h> 44 46 #include <arch/barrier.h> 47 #include <arch/drivers/tick.h> 45 48 #include <print.h> 46 49 #include <arch.h> … … 49 52 #include <synch/spinlock.h> 50 53 51 /** Register Interrupt Level Handler. 52 * 53 * @param n Interrupt Level (1 - 15). 54 * @param name Short descriptive string. 55 * @param handler Handler. 56 * 57 */ 58 void interrupt_register(unsigned int n, const char *name, iroutine_t handler) 54 void exc_arch_init(void) 59 55 { 60 ASSERT(n >= IVT_FIRST); 61 ASSERT(n <= IVT_ITEMS); 62 63 exc_register(n - IVT_FIRST, name, true, handler); 56 exc_register(TT_INSTRUCTION_ACCESS_EXCEPTION, 57 "instruction_access_exception", false, 58 instruction_access_exception); 59 exc_register(TT_INSTRUCTION_ACCESS_ERROR, 60 "instruction_access_error", false, 61 instruction_access_error); 62 63 #ifdef SUN4V 64 exc_register(TT_IAE_UNAUTH_ACCESS, 65 "iae_unauth_access", false, 66 instruction_access_exception); 67 exc_register(TT_IAE_NFO_PAGE, 68 "iae_nfo_page", false, 69 instruction_access_exception); 70 #endif 71 72 exc_register(TT_ILLEGAL_INSTRUCTION, 73 "illegal_instruction", false, 74 illegal_instruction); 75 exc_register(TT_PRIVILEGED_OPCODE, 76 "privileged_opcode", false, 77 privileged_opcode); 78 exc_register(TT_UNIMPLEMENTED_LDD, 79 "unimplemented_LDD", false, 80 unimplemented_LDD); 81 exc_register(TT_UNIMPLEMENTED_STD, 82 "unimplemented_STD", false, 83 unimplemented_STD); 84 85 #ifdef SUN4V 86 exc_register(TT_DAE_INVALID_ASI, 87 "dae_invalid_asi", false, 88 data_access_exception); 89 exc_register(TT_DAE_PRIVILEGE_VIOLATION, 90 "dae_privilege_violation", false, 91 data_access_exception); 92 exc_register(TT_DAE_NC_PAGE, 93 "dae_nc_page", false, 94 data_access_exception); 95 exc_register(TT_DAE_NC_PAGE, 96 "dae_nc_page", false, 97 data_access_exception); 98 exc_register(TT_DAE_NFO_PAGE, 99 "dae_nfo_page", false, 100 data_access_exception); 101 #endif 102 103 exc_register(TT_FP_DISABLED, 104 "fp_disabled", true, 105 fp_disabled); 106 exc_register(TT_FP_EXCEPTION_IEEE_754, 107 "fp_exception_ieee_754", false, 108 fp_exception_ieee_754); 109 exc_register(TT_FP_EXCEPTION_OTHER, 110 "fp_exception_other", false, 111 fp_exception_other); 112 exc_register(TT_TAG_OVERFLOW, 113 "tag_overflow", false, 114 tag_overflow); 115 exc_register(TT_DIVISION_BY_ZERO, 116 "division_by_zero", false, 117 division_by_zero); 118 exc_register(TT_DATA_ACCESS_EXCEPTION, 119 "data_access_exception", false, 120 data_access_exception); 121 exc_register(TT_DATA_ACCESS_ERROR, 122 "data_access_error", false, 123 data_access_error); 124 exc_register(TT_MEM_ADDRESS_NOT_ALIGNED, 125 "mem_address_not_aligned", false, 126 mem_address_not_aligned); 127 exc_register(TT_LDDF_MEM_ADDRESS_NOT_ALIGNED, 128 "LDDF_mem_address_not_aligned", false, 129 LDDF_mem_address_not_aligned); 130 exc_register(TT_STDF_MEM_ADDRESS_NOT_ALIGNED, 131 "STDF_mem_address_not_aligned", false, 132 STDF_mem_address_not_aligned); 133 exc_register(TT_PRIVILEGED_ACTION, 134 "privileged_action", false, 135 privileged_action); 136 exc_register(TT_LDQF_MEM_ADDRESS_NOT_ALIGNED, 137 "LDQF_mem_address_not_aligned", false, 138 LDQF_mem_address_not_aligned); 139 exc_register(TT_STQF_MEM_ADDRESS_NOT_ALIGNED, 140 "STQF_mem_address_not_aligned", false, 141 STQF_mem_address_not_aligned); 142 143 exc_register(TT_INTERRUPT_LEVEL_14, 144 "interrupt_level_14", true, 145 tick_interrupt); 146 147 #ifdef SUN4U 148 exc_register(TT_INTERRUPT_VECTOR_TRAP, 149 "interrupt_vector_trap", true, 150 interrupt); 151 #endif 152 153 exc_register(TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, 154 "fast_instruction_access_mmu_miss", true, 155 fast_instruction_access_mmu_miss); 156 exc_register(TT_FAST_DATA_ACCESS_MMU_MISS, 157 "fast_data_access_mmu_miss", true, 158 fast_data_access_mmu_miss); 159 exc_register(TT_FAST_DATA_ACCESS_PROTECTION, 160 "fast_data_access_protection", true, 161 fast_data_access_protection); 162 163 #ifdef SUN4V 164 exc_register(TT_CPU_MONDO, 165 "cpu_mondo", true, 166 cpu_mondo); 167 #endif 168 64 169 } 65 170 -
kernel/arch/sparc64/src/trap/sun4u/interrupt.c
reae91e0 r235d31d 53 53 * @param istate Ignored. 54 54 */ 55 void interrupt( int n, istate_t *istate)55 void interrupt(unsigned int n, istate_t *istate) 56 56 { 57 57 uint64_t status = asi_u64_read(ASI_INTR_DISPATCH_STATUS, 0); -
kernel/arch/sparc64/src/trap/sun4u/trap_table.S
reae91e0 r235d31d 63 63 instruction_access_exception_tl0: 64 64 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 65 PREEMPTIBLE_HANDLER instruction_access_exception 65 mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2 66 clr %g5 67 PREEMPTIBLE_HANDLER exc_dispatch 66 68 67 69 /* TT = 0x0a, TL = 0, instruction_access_error */ … … 69 71 .global instruction_access_error_tl0 70 72 instruction_access_error_tl0: 71 PREEMPTIBLE_HANDLER instruction_access_error 73 mov TT_INSTRUCTION_ACCESS_ERROR, %g2 74 clr %g5 75 PREEMPTIBLE_HANDLER exc_dispatch 72 76 73 77 /* TT = 0x10, TL = 0, illegal_instruction */ … … 75 79 .global illegal_instruction_tl0 76 80 illegal_instruction_tl0: 77 PREEMPTIBLE_HANDLER illegal_instruction 81 mov TT_ILLEGAL_INSTRUCTION, %g2 82 clr %g5 83 PREEMPTIBLE_HANDLER exc_dispatch 78 84 79 85 /* TT = 0x11, TL = 0, privileged_opcode */ … … 81 87 .global privileged_opcode_tl0 82 88 privileged_opcode_tl0: 83 PREEMPTIBLE_HANDLER privileged_opcode 89 mov TT_PRIVILEGED_OPCODE, %g2 90 clr %g5 91 PREEMPTIBLE_HANDLER exc_dispatch 84 92 85 93 /* TT = 0x12, TL = 0, unimplemented_LDD */ … … 87 95 .global unimplemented_LDD_tl0 88 96 unimplemented_LDD_tl0: 89 PREEMPTIBLE_HANDLER unimplemented_LDD 97 mov TT_UNIMPLEMENTED_LDD, %g2 98 clr %g5 99 PREEMPTIBLE_HANDLER exc_dispatch 90 100 91 101 /* TT = 0x13, TL = 0, unimplemented_STD */ … … 93 103 .global unimplemented_STD_tl0 94 104 unimplemented_STD_tl0: 95 PREEMPTIBLE_HANDLER unimplemented_STD 105 mov TT_UNIMPLEMENTED_STD, %g2 106 clr %g5 107 PREEMPTIBLE_HANDLER exc_dispatch 96 108 97 109 /* TT = 0x20, TL = 0, fb_disabled handler */ … … 99 111 .global fb_disabled_tl0 100 112 fp_disabled_tl0: 101 PREEMPTIBLE_HANDLER fp_disabled 113 mov TT_FP_DISABLED, %g2 114 clr %g5 115 PREEMPTIBLE_HANDLER exc_dispatch 102 116 103 117 /* TT = 0x21, TL = 0, fb_exception_ieee_754 handler */ … … 105 119 .global fb_exception_ieee_754_tl0 106 120 fp_exception_ieee_754_tl0: 107 PREEMPTIBLE_HANDLER fp_exception_ieee_754 121 mov TT_FP_EXCEPTION_IEEE_754, %g2 122 clr %g5 123 PREEMPTIBLE_HANDLER exc_dispatch 108 124 109 125 /* TT = 0x22, TL = 0, fb_exception_other handler */ … … 111 127 .global fb_exception_other_tl0 112 128 fp_exception_other_tl0: 113 PREEMPTIBLE_HANDLER fp_exception_other 129 mov TT_FP_EXCEPTION_OTHER, %g2 130 clr %g5 131 PREEMPTIBLE_HANDLER exc_dispatch 114 132 115 133 /* TT = 0x23, TL = 0, tag_overflow */ … … 117 135 .global tag_overflow_tl0 118 136 tag_overflow_tl0: 119 PREEMPTIBLE_HANDLER tag_overflow 137 mov TT_TAG_OVERFLOW, %g2 138 clr %g5 139 PREEMPTIBLE_HANDLER exc_dispatch 120 140 121 141 /* TT = 0x24, TL = 0, clean_window handler */ … … 129 149 .global division_by_zero_tl0 130 150 division_by_zero_tl0: 131 PREEMPTIBLE_HANDLER division_by_zero 151 mov TT_DIVISION_BY_ZERO, %g2 152 clr %g5 153 PREEMPTIBLE_HANDLER exc_dispatch 132 154 133 155 /* TT = 0x30, TL = 0, data_access_exception */ … … 136 158 data_access_exception_tl0: 137 159 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 138 PREEMPTIBLE_HANDLER data_access_exception 160 mov TT_DATA_ACCESS_EXCEPTION, %g2 161 clr %g5 162 PREEMPTIBLE_HANDLER exc_dispatch 139 163 140 164 /* TT = 0x32, TL = 0, data_access_error */ … … 142 166 .global data_access_error_tl0 143 167 data_access_error_tl0: 144 PREEMPTIBLE_HANDLER data_access_error 168 mov TT_DATA_ACCESS_ERROR, %g2 169 clr %g5 170 PREEMPTIBLE_HANDLER exc_dispatch 145 171 146 172 /* TT = 0x34, TL = 0, mem_address_not_aligned */ … … 148 174 .global mem_address_not_aligned_tl0 149 175 mem_address_not_aligned_tl0: 150 PREEMPTIBLE_HANDLER mem_address_not_aligned 176 mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2 177 clr %g5 178 PREEMPTIBLE_HANDLER exc_dispatch 151 179 152 180 /* TT = 0x35, TL = 0, LDDF_mem_address_not_aligned */ … … 154 182 .global LDDF_mem_address_not_aligned_tl0 155 183 LDDF_mem_address_not_aligned_tl0: 156 PREEMPTIBLE_HANDLER LDDF_mem_address_not_aligned 184 mov TT_LDDF_MEM_ADDRESS_NOT_ALIGNED, %g2 185 clr %g5 186 PREEMPTIBLE_HANDLER exc_dispatch 157 187 158 188 /* TT = 0x36, TL = 0, STDF_mem_address_not_aligned */ … … 160 190 .global STDF_mem_address_not_aligned_tl0 161 191 STDF_mem_address_not_aligned_tl0: 162 PREEMPTIBLE_HANDLER STDF_mem_address_not_aligned 192 mov TT_STDF_MEM_ADDRESS_NOT_ALIGNED, %g2 193 clr %g5 194 PREEMPTIBLE_HANDLER exc_dispatch 163 195 164 196 /* TT = 0x37, TL = 0, privileged_action */ … … 166 198 .global privileged_action_tl0 167 199 privileged_action_tl0: 168 PREEMPTIBLE_HANDLER privileged_action 200 mov TT_PRIVILEGED_ACTION, %g2 201 clr %g5 202 PREEMPTIBLE_HANDLER exc_dispatch 169 203 170 204 /* TT = 0x38, TL = 0, LDQF_mem_address_not_aligned */ … … 172 206 .global LDQF_mem_address_not_aligned_tl0 173 207 LDQF_mem_address_not_aligned_tl0: 174 PREEMPTIBLE_HANDLER LDQF_mem_address_not_aligned 208 mov TT_LDQF_MEM_ADDRESS_NOT_ALIGNED, %g2 209 clr %g5 210 PREEMPTIBLE_HANDLER exc_dispatch 175 211 176 212 /* TT = 0x39, TL = 0, STQF_mem_address_not_aligned */ … … 178 214 .global STQF_mem_address_not_aligned_tl0 179 215 STQF_mem_address_not_aligned_tl0: 180 PREEMPTIBLE_HANDLER STQF_mem_address_not_aligned 216 mov TT_STQF_MEM_ADDRESS_NOT_ALIGNED, %g2 217 clr %g5 218 PREEMPTIBLE_HANDLER exc_dispatch 181 219 182 220 /* TT = 0x41, TL = 0, interrupt_level_1 handler */ … … 184 222 .global interrupt_level_1_handler_tl0 185 223 interrupt_level_1_handler_tl0: 186 INTERRUPT_LEVEL_N_HANDLER 1 224 mov TT_INTERRUPT_LEVEL_1, %g2 225 clr %g5 226 PREEMPTIBLE_HANDLER exc_dispatch 187 227 188 228 /* TT = 0x42, TL = 0, interrupt_level_2 handler */ … … 190 230 .global interrupt_level_2_handler_tl0 191 231 interrupt_level_2_handler_tl0: 192 INTERRUPT_LEVEL_N_HANDLER 2 232 mov TT_INTERRUPT_LEVEL_2, %g2 233 clr %g5 234 PREEMPTIBLE_HANDLER exc_dispatch 193 235 194 236 /* TT = 0x43, TL = 0, interrupt_level_3 handler */ … … 196 238 .global interrupt_level_3_handler_tl0 197 239 interrupt_level_3_handler_tl0: 198 INTERRUPT_LEVEL_N_HANDLER 3 240 mov TT_INTERRUPT_LEVEL_3, %g2 241 clr %g5 242 PREEMPTIBLE_HANDLER exc_dispatch 199 243 200 244 /* TT = 0x44, TL = 0, interrupt_level_4 handler */ … … 202 246 .global interrupt_level_4_handler_tl0 203 247 interrupt_level_4_handler_tl0: 204 INTERRUPT_LEVEL_N_HANDLER 4 248 mov TT_INTERRUPT_LEVEL_4, %g2 249 clr %g5 250 PREEMPTIBLE_HANDLER exc_dispatch 205 251 206 252 /* TT = 0x45, TL = 0, interrupt_level_5 handler */ … … 208 254 .global interrupt_level_5_handler_tl0 209 255 interrupt_level_5_handler_tl0: 210 INTERRUPT_LEVEL_N_HANDLER 5 256 mov TT_INTERRUPT_LEVEL_5, %g2 257 clr %g5 258 PREEMPTIBLE_HANDLER exc_dispatch 211 259 212 260 /* TT = 0x46, TL = 0, interrupt_level_6 handler */ … … 214 262 .global interrupt_level_6_handler_tl0 215 263 interrupt_level_6_handler_tl0: 216 INTERRUPT_LEVEL_N_HANDLER 6 264 mov TT_INTERRUPT_LEVEL_6, %g2 265 clr %g5 266 PREEMPTIBLE_HANDLER exc_dispatch 217 267 218 268 /* TT = 0x47, TL = 0, interrupt_level_7 handler */ … … 220 270 .global interrupt_level_7_handler_tl0 221 271 interrupt_level_7_handler_tl0: 222 INTERRUPT_LEVEL_N_HANDLER 7 272 mov TT_INTERRUPT_LEVEL_7, %g2 273 clr %g5 274 PREEMPTIBLE_HANDLER exc_dispatch 223 275 224 276 /* TT = 0x48, TL = 0, interrupt_level_8 handler */ … … 226 278 .global interrupt_level_8_handler_tl0 227 279 interrupt_level_8_handler_tl0: 228 INTERRUPT_LEVEL_N_HANDLER 8 280 mov TT_INTERRUPT_LEVEL_8, %g2 281 clr %g5 282 PREEMPTIBLE_HANDLER exc_dispatch 229 283 230 284 /* TT = 0x49, TL = 0, interrupt_level_9 handler */ … … 232 286 .global interrupt_level_9_handler_tl0 233 287 interrupt_level_9_handler_tl0: 234 INTERRUPT_LEVEL_N_HANDLER 9 288 mov TT_INTERRUPT_LEVEL_9, %g2 289 clr %g5 290 PREEMPTIBLE_HANDLER exc_dispatch 235 291 236 292 /* TT = 0x4a, TL = 0, interrupt_level_10 handler */ … … 238 294 .global interrupt_level_10_handler_tl0 239 295 interrupt_level_10_handler_tl0: 240 INTERRUPT_LEVEL_N_HANDLER 10 296 mov TT_INTERRUPT_LEVEL_10, %g2 297 clr %g5 298 PREEMPTIBLE_HANDLER exc_dispatch 241 299 242 300 /* TT = 0x4b, TL = 0, interrupt_level_11 handler */ … … 244 302 .global interrupt_level_11_handler_tl0 245 303 interrupt_level_11_handler_tl0: 246 INTERRUPT_LEVEL_N_HANDLER 11 304 mov TT_INTERRUPT_LEVEL_11, %g2 305 clr %g5 306 PREEMPTIBLE_HANDLER exc_dispatch 247 307 248 308 /* TT = 0x4c, TL = 0, interrupt_level_12 handler */ … … 250 310 .global interrupt_level_12_handler_tl0 251 311 interrupt_level_12_handler_tl0: 252 INTERRUPT_LEVEL_N_HANDLER 12 312 mov TT_INTERRUPT_LEVEL_12, %g2 313 clr %g5 314 PREEMPTIBLE_HANDLER exc_dispatch 253 315 254 316 /* TT = 0x4d, TL = 0, interrupt_level_13 handler */ … … 256 318 .global interrupt_level_13_handler_tl0 257 319 interrupt_level_13_handler_tl0: 258 INTERRUPT_LEVEL_N_HANDLER 13 320 mov TT_INTERRUPT_LEVEL_13, %g2 321 clr %g5 322 PREEMPTIBLE_HANDLER exc_dispatch 259 323 260 324 /* TT = 0x4e, TL = 0, interrupt_level_14 handler */ … … 262 326 .global interrupt_level_14_handler_tl0 263 327 interrupt_level_14_handler_tl0: 264 INTERRUPT_LEVEL_N_HANDLER 14 328 mov TT_INTERRUPT_LEVEL_14, %g2 329 clr %g5 330 PREEMPTIBLE_HANDLER exc_dispatch 265 331 266 332 /* TT = 0x4f, TL = 0, interrupt_level_15 handler */ … … 268 334 .global interrupt_level_15_handler_tl0 269 335 interrupt_level_15_handler_tl0: 270 INTERRUPT_LEVEL_N_HANDLER 15 336 mov TT_INTERRUPT_LEVEL_15, %g2 337 clr %g5 338 PREEMPTIBLE_HANDLER exc_dispatch 271 339 272 340 /* TT = 0x60, TL = 0, interrupt_vector_trap handler */ … … 274 342 .global interrupt_vector_trap_handler_tl0 275 343 interrupt_vector_trap_handler_tl0: 276 INTERRUPT_VECTOR_TRAP_HANDLER 344 mov TT_INTERRUPT_VECTOR_TRAP, %g2 345 clr %g5 346 PREEMPTIBLE_HANDLER exc_dispatch 277 347 278 348 /* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */ … … 342 412 .global trap_instruction_\cur\()_tl0 343 413 trap_instruction_\cur\()_tl0: 414 mov \cur, %g2 344 415 ba %xcc, trap_instruction_handler 345 mov \cur, %g2416 clr %g5 346 417 .endr 347 418 … … 356 427 wrpr %g0, 1, %tl 357 428 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 358 PREEMPTIBLE_HANDLER instruction_access_exception 429 mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2 430 clr %g5 431 PREEMPTIBLE_HANDLER exc_dispatch 359 432 360 433 /* TT = 0x0a, TL > 0, instruction_access_error */ … … 363 436 instruction_access_error_tl1: 364 437 wrpr %g0, 1, %tl 365 PREEMPTIBLE_HANDLER instruction_access_error 438 mov TT_INSTRUCTION_ACCESS_ERROR, %g2 439 clr %g5 440 PREEMPTIBLE_HANDLER exc_dispatch 366 441 367 442 /* TT = 0x10, TL > 0, illegal_instruction */ … … 370 445 illegal_instruction_tl1: 371 446 wrpr %g0, 1, %tl 372 PREEMPTIBLE_HANDLER illegal_instruction 447 mov TT_ILLEGAL_INSTRUCTION, %g2 448 clr %g5 449 PREEMPTIBLE_HANDLER exc_dispatch 373 450 374 451 /* TT = 0x24, TL > 0, clean_window handler */ … … 383 460 division_by_zero_tl1: 384 461 wrpr %g0, 1, %tl 385 PREEMPTIBLE_HANDLER division_by_zero 462 mov TT_DIVISION_BY_ZERO, %g2 463 clr %g5 464 PREEMPTIBLE_HANDLER exc_dispatch 386 465 387 466 /* TT = 0x30, TL > 0, data_access_exception */ … … 391 470 wrpr %g0, 1, %tl 392 471 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 393 PREEMPTIBLE_HANDLER data_access_exception 472 mov TT_DATA_ACCESS_EXCEPTION, %g2 473 clr %g5 474 PREEMPTIBLE_HANDLER exc_dispatch 394 475 395 476 /* TT = 0x32, TL > 0, data_access_error */ … … 398 479 data_access_error_tl1: 399 480 wrpr %g0, 1, %tl 400 PREEMPTIBLE_HANDLER data_access_error 481 mov TT_DATA_ACCESS_ERROR, %g2 482 clr %g5 483 PREEMPTIBLE_HANDLER exc_dispatch 401 484 402 485 /* TT = 0x34, TL > 0, mem_address_not_aligned */ … … 405 488 mem_address_not_aligned_tl1: 406 489 wrpr %g0, 1, %tl 407 PREEMPTIBLE_HANDLER mem_address_not_aligned 490 mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2 491 clr %g5 492 PREEMPTIBLE_HANDLER exc_dispatch 408 493 409 494 /* TT = 0x68, TL > 0, fast_data_access_MMU_miss */ … … 470 555 * %g1 Address of function to call if this is not a syscall. 471 556 * %g2 First argument for the function. 557 * %g5 I/DTLB_TAG_ACCESS register if applicable. 472 558 * %g6 Pre-set as kernel stack base if trap from userspace. 473 559 * %g7 Pre-set as address of the userspace window buffer. 474 560 */ 475 561 .macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall 476 /*477 * ASSERT(%tl == 1)478 */479 rdpr %tl, %g3480 cmp %g3, 1481 be %xcc, 1f482 nop483 ! this is for debugging, if we ever get here it will be easy to find484 0: ba,a %xcc, 0b485 486 1:487 562 .if NOT(\is_syscall) 488 563 rdpr %tstate, %g3 … … 502 577 bnz %xcc, 0f ! ...skip setting of kernel stack and primary context 503 578 nop 504 505 579 .endif 580 506 581 /* 507 582 * Normal window spills will go to the userspace window buffer. … … 516 591 * and the new window's %fp. 517 592 */ 518 save %g6, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp593 save %g6, -ISTATE_SIZE, %sp 519 594 520 595 .if \is_syscall … … 548 623 ba,a %xcc, 1f 549 624 0: 550 save %sp, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp625 save %sp, -ISTATE_SIZE, %sp 551 626 552 627 /* … … 570 645 .else 571 646 ! store the syscall number on the stack as 7th argument 572 stx %g2, [%sp + STACK_ WINDOW_SAVE_AREA_SIZE + STACK_BIAS + STACK_ARG6]647 stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_ARG6] 573 648 .endif 574 649 575 650 /* 576 * Save TSTATE, TPC and TNPCaside.651 * Save TSTATE, TPC, TNPC and I/DTLB_TAG_ACCESS aside. 577 652 */ 578 653 rdpr %tstate, %g1 … … 581 656 rd %y, %g4 582 657 583 stx %g1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE] 584 stx %g2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC] 585 stx %g3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC] 658 stx %g1, [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE] 659 stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_TPC] 660 stx %g3, [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC] 661 stx %g5, [%sp + STACK_BIAS + ISTATE_OFFSET_TLB_TAG_ACCESS] 586 662 587 663 /* 588 664 * Save the Y register. 589 * This register is deprecated according to SPARC V9 specification 590 * and is only present for backward compatibility with previous 591 * versions of the SPARC architecture. 592 * Surprisingly, gcc makes use of this register without a notice. 593 */ 594 stx %g4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_Y] 665 */ 666 stx %g4, [%sp + STACK_BIAS + ISTATE_OFFSET_Y] 595 667 596 668 wrpr %g0, 0, %tl … … 603 675 */ 604 676 call %l0 605 add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1677 add %sp, STACK_BIAS, %o1 606 678 .else 607 679 /* … … 621 693 * Read TSTATE, TPC and TNPC from saved copy. 622 694 */ 623 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE], %g1624 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC], %g2625 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC], %g3695 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE], %g1 696 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TPC], %g2 697 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC], %g3 626 698 627 699 /* … … 644 716 * Restore Y. 645 717 */ 646 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_Y], %g4718 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_Y], %g4 647 719 wr %g4, %y 648 720 … … 684 756 */ 685 757 mov %sp, %g2 686 stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0]687 stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1]688 stx %i2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2]689 stx %i3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3]690 stx %i4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4]691 stx %i5, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5]692 stx %i6, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6]693 stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7]758 stx %i0, [%sp + STACK_BIAS + ISTATE_OFFSET_O0] 759 stx %i1, [%sp + STACK_BIAS + ISTATE_OFFSET_O1] 760 stx %i2, [%sp + STACK_BIAS + ISTATE_OFFSET_O2] 761 stx %i3, [%sp + STACK_BIAS + ISTATE_OFFSET_O3] 762 stx %i4, [%sp + STACK_BIAS + ISTATE_OFFSET_O4] 763 stx %i5, [%sp + STACK_BIAS + ISTATE_OFFSET_O5] 764 stx %i6, [%sp + STACK_BIAS + ISTATE_OFFSET_O6] 765 stx %i7, [%sp + STACK_BIAS + ISTATE_OFFSET_O7] 694 766 wrpr %l0, 0, %cwp 695 767 mov %g2, %sp 696 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0697 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1698 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2], %i2699 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3], %i3700 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4], %i4701 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5], %i5702 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6], %i6703 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7], %i7768 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O0], %i0 769 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O1], %i1 770 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O2], %i2 771 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O3], %i3 772 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O4], %i4 773 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O5], %i5 774 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O6], %i6 775 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O7], %i7 704 776 705 777 /* … … 807 879 * If the: 808 880 * 809 * save %g6, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp881 * save %g6, -ISTATE_SIZE, %sp 810 882 * 811 883 * instruction trapped and spilled a register window into the userspace -
kernel/arch/sparc64/src/trap/sun4v/interrupt.c
reae91e0 r235d31d 95 95 * register and processes the message (invokes a function call). 96 96 */ 97 void cpu_mondo( void)97 void cpu_mondo(unsigned int tt, istate_t *istate) 98 98 { 99 99 #ifdef CONFIG_SMP -
kernel/arch/sparc64/src/trap/sun4v/trap_table.S
reae91e0 r235d31d 66 66 .global instruction_access_exception_tl0 67 67 instruction_access_exception_tl0: 68 PREEMPTIBLE_HANDLER instruction_access_exception 68 mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2 69 clr %g5 70 PREEMPTIBLE_HANDLER exc_dispatch 69 71 70 72 /* TT = 0x09, TL = 0, instruction_access_mmu_miss */ … … 77 79 .global instruction_access_error_tl0 78 80 instruction_access_error_tl0: 79 PREEMPTIBLE_HANDLER instruction_access_error 81 mov TT_INSTRUCTION_ACCESS_ERROR, %g2 82 clr %g5 83 PREEMPTIBLE_HANDLER exc_dispatch 80 84 81 85 /* TT = 0x0b, TL = 0, IAE_unauth_access */ … … 83 87 .global iae_unauth_access_tl0 84 88 iae_unauth_access_tl0: 85 PREEMPTIBLE_HANDLER instruction_access_exception 89 mov TT_IAE_UNAUTH_ACCESS, %g2 90 clr %g5 91 PREEMPTIBLE_HANDLER exc_dispatch 86 92 87 93 /* TT = 0x0c, TL = 0, IAE_nfo_page */ … … 89 95 .global iae_nfo_page_tl0 90 96 iae_nfo_page_tl0: 91 PREEMPTIBLE_HANDLER instruction_access_exception 97 mov TT_IAE_NFO_PAGE, %g2 98 clr %g5 99 PREEMPTIBLE_HANDLER exc_dispatch 92 100 93 101 /* TT = 0x10, TL = 0, illegal_instruction */ … … 95 103 .global illegal_instruction_tl0 96 104 illegal_instruction_tl0: 97 PREEMPTIBLE_HANDLER illegal_instruction 105 mov TT_ILLEGAL_INSTRUCTION, %g2 106 clr %g5 107 PREEMPTIBLE_HANDLER exc_dispatch 98 108 99 109 /* TT = 0x11, TL = 0, privileged_opcode */ … … 101 111 .global privileged_opcode_tl0 102 112 privileged_opcode_tl0: 103 PREEMPTIBLE_HANDLER privileged_opcode 113 mov TT_PRIVILEGED_OPCODE, %g2 114 clr %g5 115 PREEMPTIBLE_HANDLER exc_dispatch 104 116 105 117 /* TT = 0x12, TL = 0, unimplemented_LDD */ … … 107 119 .global unimplemented_LDD_tl0 108 120 unimplemented_LDD_tl0: 109 PREEMPTIBLE_HANDLER unimplemented_LDD 121 mov TT_UNIMPLEMENTED_LDD, %g2 122 clr %g5 123 PREEMPTIBLE_HANDLER exc_dispatch 110 124 111 125 /* TT = 0x13, TL = 0, unimplemented_STD */ … … 113 127 .global unimplemented_STD_tl0 114 128 unimplemented_STD_tl0: 115 PREEMPTIBLE_HANDLER unimplemented_STD 129 mov TT_UNIMPLEMENTED_STD, %g2 130 clr %g5 131 PREEMPTIBLE_HANDLER exc_dispatch 116 132 117 133 /* TT = 0x14, TL = 0, DAE_invalid_asi */ … … 119 135 .global dae_invalid_asi_tl0 120 136 dae_invalid_asi_tl0: 121 PREEMPTIBLE_HANDLER data_access_exception 137 mov TT_DAE_INVALID_ASI, %g2 138 clr %g5 139 PREEMPTIBLE_HANDLER exc_dispatch 122 140 123 141 /* TT = 0x15, TL = 0, DAE_privilege_violation */ … … 125 143 .global dae_privilege_violation_tl0 126 144 dae_privilege_violation_tl0: 127 PREEMPTIBLE_HANDLER data_access_exception 145 mov TT_DAE_PRIVILEGE_VIOLATION, %g2 146 clr %g5 147 PREEMPTIBLE_HANDLER exc_dispatch 128 148 129 149 /* TT = 0x16, TL = 0, DAE_nc_page */ … … 131 151 .global dae_nc_page_tl0 132 152 dae_nc_page_tl0: 133 PREEMPTIBLE_HANDLER data_access_exception 153 mov TT_DAE_NC_PAGE, %g2 154 clr %g5 155 PREEMPTIBLE_HANDLER exc_dispatch 134 156 135 157 /* TT = 0x17, TL = 0, DAE_nfo_page */ … … 137 159 .global dae_nfo_page_tl0 138 160 dae_nfo_page_tl0: 139 PREEMPTIBLE_HANDLER data_access_exception 161 mov TT_DAE_NFO_PAGE, %g2 162 clr %g5 163 PREEMPTIBLE_HANDLER exc_dispatch 140 164 141 165 /* TT = 0x20, TL = 0, fb_disabled handler */ … … 143 167 .global fb_disabled_tl0 144 168 fp_disabled_tl0: 145 PREEMPTIBLE_HANDLER fp_disabled 169 mov TT_FP_DISABLED, %g2 170 clr %g5 171 PREEMPTIBLE_HANDLER exc_dispatch 146 172 147 173 /* TT = 0x21, TL = 0, fb_exception_ieee_754 handler */ … … 149 175 .global fb_exception_ieee_754_tl0 150 176 fp_exception_ieee_754_tl0: 151 PREEMPTIBLE_HANDLER fp_exception_ieee_754 177 mov TT_FP_EXCEPTION_IEEE_754, %g2 178 clr %g5 179 PREEMPTIBLE_HANDLER exc_dispatch 152 180 153 181 /* TT = 0x22, TL = 0, fb_exception_other handler */ … … 155 183 .global fb_exception_other_tl0 156 184 fp_exception_other_tl0: 157 PREEMPTIBLE_HANDLER fp_exception_other 185 mov TT_FP_EXCEPTION_OTHER, %g2 186 clr %g5 187 PREEMPTIBLE_HANDLER exc_dispatch 158 188 159 189 /* TT = 0x23, TL = 0, tag_overflow */ … … 161 191 .global tag_overflow_tl0 162 192 tag_overflow_tl0: 163 PREEMPTIBLE_HANDLER tag_overflow 193 mov TT_TAG_OVERFLOW, %g2 194 clr %g5 195 PREEMPTIBLE_HANDLER exc_dispatch 164 196 165 197 /* TT = 0x24, TL = 0, clean_window handler */ … … 173 205 .global division_by_zero_tl0 174 206 division_by_zero_tl0: 175 PREEMPTIBLE_HANDLER division_by_zero 207 mov TT_DIVISION_BY_ZERO, %g2 208 clr %g5 209 PREEMPTIBLE_HANDLER exc_dispatch 176 210 177 211 /* TT = 0x30, TL = 0, data_access_exception */ … … 180 214 .global data_access_exception_tl0 181 215 data_access_exception_tl0: 182 PREEMPTIBLE_HANDLER data_access_exception 216 mov TT_DATA_ACCESS_EXCEPTION, %g2 217 clr %g5 218 PREEMPTIBLE_HANDLER exc_dispatch 183 219 184 220 /* TT = 0x31, TL = 0, data_access_mmu_miss */ … … 192 228 .global data_access_error_tl0 193 229 data_access_error_tl0: 194 PREEMPTIBLE_HANDLER data_access_error 230 mov TT_DATA_ACCESS_ERROR, %g2 231 clr %g5 232 PREEMPTIBLE_HANDLER exc_dispatch 195 233 196 234 /* TT = 0x34, TL = 0, mem_address_not_aligned */ … … 198 236 .global mem_address_not_aligned_tl0 199 237 mem_address_not_aligned_tl0: 200 PREEMPTIBLE_HANDLER mem_address_not_aligned 238 mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2 239 clr %g5 240 PREEMPTIBLE_HANDLER exc_dispatch 201 241 202 242 /* TT = 0x35, TL = 0, LDDF_mem_address_not_aligned */ … … 204 244 .global LDDF_mem_address_not_aligned_tl0 205 245 LDDF_mem_address_not_aligned_tl0: 206 PREEMPTIBLE_HANDLER LDDF_mem_address_not_aligned 246 mov TT_LDDF_MEM_ADDRESS_NOT_ALIGNED, %g2 247 clr %g5 248 PREEMPTIBLE_HANDLER exc_dispatch 207 249 208 250 /* TT = 0x36, TL = 0, STDF_mem_address_not_aligned */ … … 210 252 .global STDF_mem_address_not_aligned_tl0 211 253 STDF_mem_address_not_aligned_tl0: 212 PREEMPTIBLE_HANDLER STDF_mem_address_not_aligned 254 mov TT_STDF_MEM_ADDRESS_NOT_ALIGNED, %g2 255 clr %g5 256 PREEMPTIBLE_HANDLER exc_dispatch 213 257 214 258 /* TT = 0x37, TL = 0, privileged_action */ … … 216 260 .global privileged_action_tl0 217 261 privileged_action_tl0: 218 PREEMPTIBLE_HANDLER privileged_action 262 mov TT_PRIVILEGED_ACTION, %g2 263 clr %g5 264 PREEMPTIBLE_HANDLER exc_dispatch 219 265 220 266 /* TT = 0x38, TL = 0, LDQF_mem_address_not_aligned */ … … 222 268 .global LDQF_mem_address_not_aligned_tl0 223 269 LDQF_mem_address_not_aligned_tl0: 224 PREEMPTIBLE_HANDLER LDQF_mem_address_not_aligned 270 mov TT_LDQF_MEM_ADDRESS_NOT_ALIGNED, %g2 271 clr %g5 272 PREEMPTIBLE_HANDLER exc_dispatch 225 273 226 274 /* TT = 0x39, TL = 0, STQF_mem_address_not_aligned */ … … 228 276 .global STQF_mem_address_not_aligned_tl0 229 277 STQF_mem_address_not_aligned_tl0: 230 PREEMPTIBLE_HANDLER STQF_mem_address_not_aligned 278 mov TT_STQF_MEM_ADDRESS_NOT_ALIGNED, %g2 279 clr %g5 280 PREEMPTIBLE_HANDLER exc_dispatch 231 281 232 282 /* TT = 0x41, TL = 0, interrupt_level_1 handler */ … … 234 284 .global interrupt_level_1_handler_tl0 235 285 interrupt_level_1_handler_tl0: 236 INTERRUPT_LEVEL_N_HANDLER 1 286 mov TT_INTERRUPT_LEVEL_1, %g2 287 clr %g5 288 PREEMPTIBLE_HANDLER exc_dispatch 237 289 238 290 /* TT = 0x42, TL = 0, interrupt_level_2 handler */ … … 240 292 .global interrupt_level_2_handler_tl0 241 293 interrupt_level_2_handler_tl0: 242 INTERRUPT_LEVEL_N_HANDLER 2 294 mov TT_INTERRUPT_LEVEL_2, %g2 295 clr %g5 296 PREEMPTIBLE_HANDLER exc_dispatch 243 297 244 298 /* TT = 0x43, TL = 0, interrupt_level_3 handler */ … … 246 300 .global interrupt_level_3_handler_tl0 247 301 interrupt_level_3_handler_tl0: 248 INTERRUPT_LEVEL_N_HANDLER 3 302 mov TT_INTERRUPT_LEVEL_3, %g2 303 clr %g5 304 PREEMPTIBLE_HANDLER exc_dispatch 249 305 250 306 /* TT = 0x44, TL = 0, interrupt_level_4 handler */ … … 252 308 .global interrupt_level_4_handler_tl0 253 309 interrupt_level_4_handler_tl0: 254 INTERRUPT_LEVEL_N_HANDLER 4 310 mov TT_INTERRUPT_LEVEL_4, %g2 311 clr %g5 312 PREEMPTIBLE_HANDLER exc_dispatch 255 313 256 314 /* TT = 0x45, TL = 0, interrupt_level_5 handler */ … … 258 316 .global interrupt_level_5_handler_tl0 259 317 interrupt_level_5_handler_tl0: 260 INTERRUPT_LEVEL_N_HANDLER 5 318 mov TT_INTERRUPT_LEVEL_5, %g2 319 clr %g5 320 PREEMPTIBLE_HANDLER exc_dispatch 261 321 262 322 /* TT = 0x46, TL = 0, interrupt_level_6 handler */ … … 264 324 .global interrupt_level_6_handler_tl0 265 325 interrupt_level_6_handler_tl0: 266 INTERRUPT_LEVEL_N_HANDLER 6 326 mov TT_INTERRUPT_LEVEL_6, %g2 327 clr %g5 328 PREEMPTIBLE_HANDLER exc_dispatch 267 329 268 330 /* TT = 0x47, TL = 0, interrupt_level_7 handler */ … … 270 332 .global interrupt_level_7_handler_tl0 271 333 interrupt_level_7_handler_tl0: 272 INTERRUPT_LEVEL_N_HANDLER 7 334 mov TT_INTERRUPT_LEVEL_7, %g2 335 clr %g5 336 PREEMPTIBLE_HANDLER exc_dispatch 273 337 274 338 /* TT = 0x48, TL = 0, interrupt_level_8 handler */ … … 276 340 .global interrupt_level_8_handler_tl0 277 341 interrupt_level_8_handler_tl0: 278 INTERRUPT_LEVEL_N_HANDLER 8 342 mov TT_INTERRUPT_LEVEL_8, %g2 343 clr %g5 344 PREEMPTIBLE_HANDLER exc_dispatch 279 345 280 346 /* TT = 0x49, TL = 0, interrupt_level_9 handler */ … … 282 348 .global interrupt_level_9_handler_tl0 283 349 interrupt_level_9_handler_tl0: 284 INTERRUPT_LEVEL_N_HANDLER 9 350 mov TT_INTERRUPT_LEVEL_9, %g2 351 clr %g5 352 PREEMPTIBLE_HANDLER exc_dispatch 285 353 286 354 /* TT = 0x4a, TL = 0, interrupt_level_10 handler */ … … 288 356 .global interrupt_level_10_handler_tl0 289 357 interrupt_level_10_handler_tl0: 290 INTERRUPT_LEVEL_N_HANDLER 10 358 mov TT_INTERRUPT_LEVEL_10, %g2 359 clr %g5 360 PREEMPTIBLE_HANDLER exc_dispatch 291 361 292 362 /* TT = 0x4b, TL = 0, interrupt_level_11 handler */ … … 294 364 .global interrupt_level_11_handler_tl0 295 365 interrupt_level_11_handler_tl0: 296 INTERRUPT_LEVEL_N_HANDLER 11 366 mov TT_INTERRUPT_LEVEL_11, %g2 367 clr %g5 368 PREEMPTIBLE_HANDLER exc_dispatch 297 369 298 370 /* TT = 0x4c, TL = 0, interrupt_level_12 handler */ … … 300 372 .global interrupt_level_12_handler_tl0 301 373 interrupt_level_12_handler_tl0: 302 INTERRUPT_LEVEL_N_HANDLER 12 374 mov TT_INTERRUPT_LEVEL_12, %g2 375 clr %g5 376 PREEMPTIBLE_HANDLER exc_dispatch 303 377 304 378 /* TT = 0x4d, TL = 0, interrupt_level_13 handler */ … … 306 380 .global interrupt_level_13_handler_tl0 307 381 interrupt_level_13_handler_tl0: 308 INTERRUPT_LEVEL_N_HANDLER 13 382 mov TT_INTERRUPT_LEVEL_13, %g2 383 clr %g5 384 PREEMPTIBLE_HANDLER exc_dispatch 309 385 310 386 /* TT = 0x4e, TL = 0, interrupt_level_14 handler */ … … 312 388 .global interrupt_level_14_handler_tl0 313 389 interrupt_level_14_handler_tl0: 314 INTERRUPT_LEVEL_N_HANDLER 14 390 mov TT_INTERRUPT_LEVEL_14, %g2 391 clr %g5 392 PREEMPTIBLE_HANDLER exc_dispatch 315 393 316 394 /* TT = 0x4f, TL = 0, interrupt_level_15 handler */ … … 318 396 .global interrupt_level_15_handler_tl0 319 397 interrupt_level_15_handler_tl0: 320 INTERRUPT_LEVEL_N_HANDLER 15 398 mov TT_INTERRUPT_LEVEL_15, %g2 399 clr %g5 400 PREEMPTIBLE_HANDLER exc_dispatch 321 401 322 402 /* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */ … … 342 422 .global cpu_mondo_handler_tl0 343 423 cpu_mondo_handler_tl0: 344 PREEMPTIBLE_HANDLER cpu_mondo 424 mov TT_CPU_MONDO, %g2 425 clr %g5 426 PREEMPTIBLE_HANDLER exc_dispatch 345 427 346 428 /* TT = 0x80, TL = 0, spill_0_normal handler */ … … 392 474 .global trap_instruction_\cur\()_tl0 393 475 trap_instruction_\cur\()_tl0: 476 mov \cur, %g2 394 477 ba %xcc, trap_instruction_handler 395 mov \cur, %g2478 clr %g5 396 479 .endr 397 480 … … 406 489 instruction_access_exception_tl1: 407 490 wrpr %g0, 1, %tl 408 PREEMPTIBLE_HANDLER instruction_access_exception 491 mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2 492 clr %g5 493 PREEMPTIBLE_HANDLER exc_dispatch 409 494 410 495 /* TT = 0x09, TL > 0, instruction_access_mmu_miss */ … … 419 504 instruction_access_error_tl1: 420 505 wrpr %g0, 1, %tl 421 PREEMPTIBLE_HANDLER instruction_access_error 506 mov TT_INSTRUCTION_ACCESS_ERROR, %g2 507 clr %g5 508 PREEMPTIBLE_HANDLER exc_dispatch 422 509 423 510 /* TT = 0x0b, TL > 0, IAE_unauth_access */ … … 426 513 iae_unauth_access_tl1: 427 514 wrpr %g0, 1, %tl 428 PREEMPTIBLE_HANDLER instruction_access_exception 515 mov TT_IAE_UNAUTH_ACCESS, %g2 516 clr %g5 517 PREEMPTIBLE_HANDLER exc_dispatch 429 518 430 519 /* TT = 0x0c, TL > 0, IAE_nfo_page */ … … 433 522 iae_nfo_page_tl1: 434 523 wrpr %g0, 1, %tl 435 PREEMPTIBLE_HANDLER instruction_access_exception 524 mov TT_IAE_NFO_PAGE, %g2 525 clr %g5 526 PREEMPTIBLE_HANDLER exc_dispatch 436 527 437 528 /* TT = 0x10, TL > 0, illegal_instruction */ … … 440 531 illegal_instruction_tl1: 441 532 wrpr %g0, 1, %tl 442 PREEMPTIBLE_HANDLER illegal_instruction 533 mov TT_ILLEGAL_INSTRUCTION, %g2 534 clr %g5 535 PREEMPTIBLE_HANDLER exc_dispatch 443 536 444 537 /* TT = 0x14, TL > 0, DAE_invalid_asi */ … … 447 540 dae_invalid_asi_tl1: 448 541 wrpr %g0, 1, %tl 449 PREEMPTIBLE_HANDLER data_access_exception 542 mov TT_DAE_INVALID_ASI, %g2 543 clr %g5 544 PREEMPTIBLE_HANDLER exc_dispatch 450 545 451 546 /* TT = 0x15, TL > 0, DAE_privilege_violation */ … … 454 549 dae_privilege_violation_tl1: 455 550 wrpr %g0, 1, %tl 456 PREEMPTIBLE_HANDLER data_access_exception 551 mov TT_DAE_PRIVILEGE_VIOLATION, %g2 552 clr %g5 553 PREEMPTIBLE_HANDLER exc_dispatch 457 554 458 555 /* TT = 0x16, TL > 0, DAE_nc_page */ … … 461 558 dae_nc_page_tl1: 462 559 wrpr %g0, 1, %tl 463 PREEMPTIBLE_HANDLER data_access_exception 560 mov TT_DAE_NC_PAGE, %g2 561 clr %g5 562 PREEMPTIBLE_HANDLER exc_dispatch 464 563 465 564 /* TT = 0x17, TL > 0, DAE_nfo_page */ … … 468 567 dae_nfo_page_tl1: 469 568 wrpr %g0, 1, %tl 470 PREEMPTIBLE_HANDLER data_access_exception 569 mov TT_DAE_NFO_PAGE, %g2 570 clr %g5 571 PREEMPTIBLE_HANDLER exc_dispatch 471 572 472 573 /* TT = 0x24, TL > 0, clean_window handler */ … … 481 582 division_by_zero_tl1: 482 583 wrpr %g0, 1, %tl 483 PREEMPTIBLE_HANDLER division_by_zero 584 mov TT_DIVISION_BY_ZERO, %g2 585 clr %g5 586 PREEMPTIBLE_HANDLER exc_dispatch 484 587 485 588 /* TT = 0x30, TL > 0, data_access_exception */ … … 487 590 .global data_access_exception_tl1 488 591 data_access_exception_tl1: 489 /*wrpr %g0, 1, %tl 490 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 491 PREEMPTIBLE_HANDLER data_access_exception*/ 592 wrpr %g0, 1, %tl 593 mov TT_DATA_ACCESS_EXCEPTION, %g2 594 clr %g5 595 PREEMPTIBLE_HANDLER exc_dispatch 492 596 493 597 /* TT = 0x31, TL > 0, data_access_mmu_miss */ … … 502 606 data_access_error_tl1: 503 607 wrpr %g0, 1, %tl 504 PREEMPTIBLE_HANDLER data_access_error 608 mov TT_DATA_ACCESS_ERROR, %g2 609 clr %g5 610 PREEMPTIBLE_HANDLER exc_dispatch 505 611 506 612 /* TT = 0x34, TL > 0, mem_address_not_aligned */ … … 509 615 mem_address_not_aligned_tl1: 510 616 wrpr %g0, 1, %tl 511 PREEMPTIBLE_HANDLER mem_address_not_aligned 617 mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2 618 clr %g5 619 PREEMPTIBLE_HANDLER exc_dispatch 512 620 513 621 /* TT = 0x68, TL > 0, fast_data_access_MMU_miss */ … … 528 636 cpu_mondo_handler_tl1: 529 637 wrpr %g0, %tl 530 PREEMPTIBLE_HANDLER cpu_mondo 638 mov TT_CPU_MONDO, %g2 639 clr %g5 640 PREEMPTIBLE_HANDLER exc_dispatch 531 641 532 642 /* TT = 0x80, TL > 0, spill_0_normal handler */ … … 654 764 .else 655 765 ! store the syscall number on the stack as 7th argument 656 stx %g2, [%sp + STACK_ WINDOW_SAVE_AREA_SIZE + STACK_BIAS + STACK_ARG6]766 stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_ARG6] 657 767 .endif 658 768 … … 664 774 rdpr %tnpc, %g3 665 775 666 stx %g1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE]667 stx %g2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC]668 stx %g3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC]776 stx %g1, [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE] 777 stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_TPC] 778 stx %g3, [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC] 669 779 670 780 /* 671 781 * Save the Y register. 672 * This register is deprecated according to SPARC V9 specification673 * and is only present for backward compatibility with previous674 * versions of the SPARC architecture.675 * Surprisingly, gcc makes use of this register without a notice.676 782 */ 677 783 rd %y, %g4 678 stx %g4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_Y] 784 stx %g4, [%sp + STACK_BIAS + ISTATE_OFFSET_Y] 785 786 /* 787 * Save the faulting page and context. 788 */ 789 stx %g5, [%sp + STACK_BIAS + ISTATE_OFFSET_TLB_TAG_ACCESS] 679 790 680 791 /* switch to TL = 0, explicitly enable FPU */ … … 689 800 /* call higher-level service routine, pass istate as its 2nd parameter */ 690 801 call %l0 691 add %sp, PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC, %o1802 add %sp, STACK_BIAS, %o1 692 803 .else 693 804 /* Call the higher-level syscall handler. */ … … 711 822 712 823 /* Read TSTATE, TPC and TNPC from saved copy. */ 713 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TSTATE], %g1714 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TPC], %g2715 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_TNPC], %g3824 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE], %g1 825 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TPC], %g2 826 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC], %g3 716 827 717 828 /* Copy PSTATE.PEF to the in-register copy of TSTATE. */ … … 728 839 729 840 /* Restore Y. */ 730 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_Y], %g4841 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_Y], %g4 731 842 wr %g4, %y 732 843 … … 750 861 */ 751 862 mov %sp, %g2 752 stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0]753 stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1]754 stx %i2, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2]755 stx %i3, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3]756 stx %i4, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4]757 stx %i5, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5]758 stx %i6, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6]759 stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7]863 stx %i0, [%sp + STACK_BIAS + ISTATE_OFFSET_O0] 864 stx %i1, [%sp + STACK_BIAS + ISTATE_OFFSET_O1] 865 stx %i2, [%sp + STACK_BIAS + ISTATE_OFFSET_O2] 866 stx %i3, [%sp + STACK_BIAS + ISTATE_OFFSET_O3] 867 stx %i4, [%sp + STACK_BIAS + ISTATE_OFFSET_O4] 868 stx %i5, [%sp + STACK_BIAS + ISTATE_OFFSET_O5] 869 stx %i6, [%sp + STACK_BIAS + ISTATE_OFFSET_O6] 870 stx %i7, [%sp + STACK_BIAS + ISTATE_OFFSET_O7] 760 871 wrpr %l0, 0, %cwp 761 872 mov %g2, %sp 762 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0763 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1764 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I2], %i2765 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I3], %i3766 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I4], %i4767 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I5], %i5768 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I6], %i6769 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7], %i7873 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O0], %i0 874 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O1], %i1 875 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O2], %i2 876 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O3], %i3 877 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O4], %i4 878 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O5], %i5 879 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O6], %i6 880 ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O7], %i7 770 881 .endm 771 882 … … 774 885 */ 775 886 .macro PREEMPTIBLE_HANDLER_KERNEL 776 777 /*778 * ASSERT(%tl == 1)779 */780 rdpr %tl, %g3781 cmp %g3, 1782 be %xcc, 1f783 nop784 785 ! this is for debugging, if we ever get here it will be easy to find786 0: ba,a %xcc, 0b787 788 1:789 887 /* prevent unnecessary CLEANWIN exceptions */ 790 888 wrpr %g0, NWINDOWS - 1, %cleanwin … … 799 897 brnz %g3, 2f 800 898 nop 899 rdpr %otherwin, %g4 900 brnz %g4, 1f 901 nop 902 903 /* OTHERWIN is zero, we are spilling a kernel window. */ 801 904 INLINE_SPILL %g3, %g4 905 ba,a %xcc, 2f 906 907 1: 908 /* OTHERWIN is non-zero, we are spilling a uspace window. */ 909 INLINE_SPILL_TO_WBUF %g3, %g4, %g7 802 910 803 911 2: 804 912 /* ask for new register window */ 805 save %sp, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp913 save %sp, -ISTATE_SIZE, %sp 806 914 807 915 MIDDLE_PART 0 … … 882 990 set SCRATCHPAD_KSTACK, %g4 883 991 ldxa [%g4] ASI_SCRATCHPAD, %g6 884 save %g6, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp992 save %g6, -ISTATE_SIZE, %sp 885 993 886 994 .if \is_syscall … … 1015 1123 * If the: 1016 1124 * 1017 * save %g6, - PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp1125 * save %g6, -ISTATE_SIZE, %sp 1018 1126 * 1019 1127 * instruction trapped and spilled a register window into the userspace
Note:
See TracChangeset
for help on using the changeset viewer.
