paul@68 | 1 | /* |
paul@68 | 2 | * Handler routines. |
paul@68 | 3 | * |
paul@86 | 4 | * Copyright (C) 2015 nfd |
paul@68 | 5 | * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk> |
paul@68 | 6 | * |
paul@68 | 7 | * This program is free software: you can redistribute it and/or modify |
paul@68 | 8 | * it under the terms of the GNU General Public License as published by |
paul@68 | 9 | * the Free Software Foundation, either version 3 of the License, or |
paul@68 | 10 | * (at your option) any later version. |
paul@68 | 11 | * |
paul@68 | 12 | * This program is distributed in the hope that it will be useful, |
paul@68 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@68 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@68 | 15 | * GNU General Public License for more details. |
paul@68 | 16 | * |
paul@68 | 17 | * You should have received a copy of the GNU General Public License |
paul@68 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@68 | 19 | */ |
paul@68 | 20 | |
paul@68 | 21 | .text |
paul@68 | 22 | .extern irq_handle |
paul@86 | 23 | .globl interrupt_handler |
paul@68 | 24 | .set noreorder |
paul@68 | 25 | .set noat |
paul@68 | 26 | |
paul@86 | 27 | interrupt_handler: |
paul@86 | 28 | sw $at, -4($sp) |
paul@86 | 29 | sw $v0, -8($sp) |
paul@86 | 30 | sw $v1, -12($sp) |
paul@86 | 31 | sw $a0, -16($sp) |
paul@86 | 32 | sw $a1, -20($sp) |
paul@86 | 33 | sw $a2, -24($sp) |
paul@86 | 34 | sw $a3, -28($sp) |
paul@86 | 35 | sw $t0, -32($sp) |
paul@86 | 36 | sw $t1, -36($sp) |
paul@86 | 37 | sw $t2, -40($sp) |
paul@86 | 38 | sw $t3, -44($sp) |
paul@86 | 39 | sw $t4, -48($sp) |
paul@86 | 40 | sw $t5, -52($sp) |
paul@86 | 41 | sw $t6, -56($sp) |
paul@86 | 42 | sw $t7, -60($sp) |
paul@86 | 43 | sw $s0, -64($sp) |
paul@86 | 44 | sw $s1, -68($sp) |
paul@86 | 45 | sw $s2, -72($sp) |
paul@86 | 46 | sw $s3, -76($sp) |
paul@86 | 47 | sw $s4, -80($sp) |
paul@86 | 48 | sw $s5, -84($sp) |
paul@86 | 49 | sw $s6, -88($sp) |
paul@86 | 50 | sw $s7, -92($sp) |
paul@86 | 51 | sw $t8, -96($sp) |
paul@86 | 52 | sw $t9, -100($sp) |
paul@86 | 53 | sw $gp, -104($sp) |
paul@86 | 54 | sw $fp, -108($sp) |
paul@86 | 55 | sw $ra, -112($sp) |
paul@68 | 56 | |
paul@86 | 57 | addi $sp, $sp, -112 |
paul@79 | 58 | |
paul@86 | 59 | /* Invoke the handler. */ |
paul@71 | 60 | |
paul@86 | 61 | jal irq_handle |
paul@86 | 62 | nop |
paul@68 | 63 | |
paul@86 | 64 | addi $sp, $sp, 112 |
paul@68 | 65 | |
paul@86 | 66 | lw $at, -4($sp) |
paul@86 | 67 | lw $v0, -8($sp) |
paul@86 | 68 | lw $v1, -12($sp) |
paul@86 | 69 | lw $a0, -16($sp) |
paul@86 | 70 | lw $a1, -20($sp) |
paul@86 | 71 | lw $a2, -24($sp) |
paul@86 | 72 | lw $a3, -28($sp) |
paul@86 | 73 | lw $t0, -32($sp) |
paul@86 | 74 | lw $t1, -36($sp) |
paul@86 | 75 | lw $t2, -40($sp) |
paul@86 | 76 | lw $t3, -44($sp) |
paul@86 | 77 | lw $t4, -48($sp) |
paul@86 | 78 | lw $t5, -52($sp) |
paul@86 | 79 | lw $t6, -56($sp) |
paul@86 | 80 | lw $t7, -60($sp) |
paul@86 | 81 | lw $s0, -64($sp) |
paul@86 | 82 | lw $s1, -68($sp) |
paul@86 | 83 | lw $s2, -72($sp) |
paul@86 | 84 | lw $s3, -76($sp) |
paul@86 | 85 | lw $s4, -80($sp) |
paul@86 | 86 | lw $s5, -84($sp) |
paul@86 | 87 | lw $s6, -88($sp) |
paul@86 | 88 | lw $s7, -92($sp) |
paul@86 | 89 | lw $t8, -96($sp) |
paul@86 | 90 | lw $t9, -100($sp) |
paul@86 | 91 | lw $gp, -104($sp) |
paul@86 | 92 | lw $fp, -108($sp) |
paul@86 | 93 | lw $ra, -112($sp) |
paul@86 | 94 | |
paul@86 | 95 | eret |
paul@86 | 96 | nop |
paul@68 | 97 | |
paul@68 | 98 | .set reorder |
paul@68 | 99 | .set at |