[1] | 1 | /* |
---|
| 2 | * hal_do_interrupt.c - implementation of interrupts handler for TSAR-MIPS32 |
---|
| 3 | * |
---|
| 4 | * Author Ghassan Almaless (2008,2009,2010,2011,2012) |
---|
| 5 | * |
---|
| 6 | * Copyright (c) UPMC Sorbonne Universites |
---|
| 7 | * |
---|
| 8 | * This file is part of ALMOS-MKH. |
---|
| 9 | * |
---|
| 10 | * ALMOS-MKH.is free software; you can redistribute it and/or modify it |
---|
| 11 | * under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 13 | * |
---|
| 14 | * ALMOS-MKH.is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | * General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with ALMOS-MKH.; if not, write to the Free Software Foundation, |
---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | #include <cpu.h> |
---|
| 25 | #include <thread.h> |
---|
| 26 | #include <task.h> |
---|
| 27 | #include <interrupt.h> |
---|
| 28 | #include <kdmsg.h> |
---|
| 29 | |
---|
| 30 | #include <cpu-regs.h> |
---|
| 31 | |
---|
| 32 | /////////////////////////////////////// |
---|
| 33 | void hal_do_interrupt( thread_t * this, |
---|
| 34 | reg_t cpu_id, |
---|
| 35 | reg_t * regs_tbl, |
---|
| 36 | reg_t irq_state ) |
---|
| 37 | { |
---|
| 38 | register uint_t irq_num = 0; |
---|
| 39 | |
---|
| 40 | #if CONFIG_SHOW_EPC_CPU0 |
---|
| 41 | if(cpu_id == 0) |
---|
| 42 | isr_dmsg(INFO,"cpu %d, pid %d, tid %d, state %s, EPC %x, ra %x\n", |
---|
| 43 | cpu_id, this->task->pid, this->info.order, |
---|
| 44 | thread_state_name[this->state], regs_tbl[EPC], regs_tbl[RA]); |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | if(this->info.isTraced) |
---|
| 48 | except_dmsg("cpu %d, tid %x, EPC %x, ra %x\n", cpu_id, this, regs_tbl[EPC], regs_tbl[RA]); |
---|
| 49 | |
---|
| 50 | while( irq_state && (irq_num < CPU_IRQ_NR) ) |
---|
| 51 | { |
---|
| 52 | if(irq_state & 0x1) |
---|
| 53 | do_interrupt(this, irq_num); |
---|
| 54 | irq_state >>=1; |
---|
| 55 | irq_num ++; |
---|
| 56 | } |
---|
| 57 | } |
---|