1 /* 2 * Copyright (c) 2019-2020 Cobham Gaisler AB 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/kernel.h> 8 #include <kernel_internal.h> 9 #include <kswap.h> 10 #include <zephyr/logging/log.h> 11 LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); 12 z_irq_spurious(const void * unused)13FUNC_NORETURN void z_irq_spurious(const void *unused) 14 { 15 uint32_t tbr; 16 17 ARG_UNUSED(unused); 18 19 __asm__ volatile ( 20 "rd %%tbr, %0" : 21 "=r" (tbr) 22 ); 23 LOG_ERR("Spurious interrupt detected! IRQ: %d", (tbr >> 4) & 0xf); 24 z_sparc_fatal_error(K_ERR_SPURIOUS_IRQ, NULL); 25 } 26 z_sparc_enter_irq(uint32_t irl)27void z_sparc_enter_irq(uint32_t irl) 28 { 29 struct _isr_table_entry *ite; 30 31 _current_cpu->nested++; 32 33 #ifdef CONFIG_IRQ_OFFLOAD 34 if (irl != 141U) { 35 irl = z_sparc_int_get_source(irl); 36 ite = &_sw_isr_table[irl]; 37 ite->isr(ite->arg); 38 } else { 39 z_irq_do_offload(); 40 } 41 #else 42 /* Get the actual interrupt source from the interrupt controller */ 43 irl = z_sparc_int_get_source(irl); 44 ite = &_sw_isr_table[irl]; 45 ite->isr(ite->arg); 46 #endif 47 48 _current_cpu->nested--; 49 #ifdef CONFIG_STACK_SENTINEL 50 z_check_stack_sentinel(); 51 #endif 52 } 53