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