2009-04-13 22:13:45 +02:00
|
|
|
/*
|
|
|
|
mini - a Free Software replacement for the Nintendo/BroadOn IOS.
|
|
|
|
|
2009-04-13 23:00:22 +02:00
|
|
|
IRQ support
|
2009-04-13 22:13:45 +02:00
|
|
|
|
|
|
|
Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, version 2.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
*/
|
2009-01-08 23:27:22 +01:00
|
|
|
#include "hollywood.h"
|
|
|
|
#include "irq.h"
|
|
|
|
|
|
|
|
.globl v_irq
|
|
|
|
.globl irq_setup_stack
|
|
|
|
.globl irq_kill
|
|
|
|
.globl irq_restore
|
|
|
|
.extern __irqstack_addr
|
|
|
|
.extern irq_handler
|
|
|
|
|
|
|
|
irq_setup_stack:
|
|
|
|
@ Switch to IRQ mode
|
|
|
|
mrs r0, cpsr
|
2009-01-16 08:47:49 +01:00
|
|
|
msr cpsr_c, #0xd2
|
2009-01-08 23:27:22 +01:00
|
|
|
|
|
|
|
@ Setup interrupt stack
|
2009-01-16 08:47:49 +01:00
|
|
|
ldr sp, =__irqstack_addr
|
2009-01-08 23:27:22 +01:00
|
|
|
|
|
|
|
@ Restore mode
|
2009-01-16 08:47:49 +01:00
|
|
|
msr cpsr_c, r0
|
2009-01-08 23:27:22 +01:00
|
|
|
bx lr
|
|
|
|
|
|
|
|
v_irq:
|
|
|
|
push {r0-r3, r9, r12, lr}
|
|
|
|
|
|
|
|
blx irq_handler
|
|
|
|
|
|
|
|
pop {r0-r3, r9, r12, lr}
|
|
|
|
subs pc, lr, #4
|
|
|
|
|
|
|
|
irq_kill:
|
|
|
|
mrs r1, cpsr
|
|
|
|
and r0, r1, #(CPSR_IRQDIS|CPSR_FIQDIS)
|
|
|
|
orr r1, r1, #(CPSR_IRQDIS|CPSR_FIQDIS)
|
2009-01-16 08:47:49 +01:00
|
|
|
msr cpsr_c, r1
|
2009-01-08 23:27:22 +01:00
|
|
|
bx lr
|
|
|
|
|
|
|
|
irq_restore:
|
|
|
|
mrs r1, cpsr
|
|
|
|
bic r1, r1, #(CPSR_IRQDIS|CPSR_FIQDIS)
|
|
|
|
orr r1, r1, r0
|
2009-01-16 08:47:49 +01:00
|
|
|
msr cpsr_c, r1
|
2009-01-08 23:27:22 +01:00
|
|
|
bx lr
|
2009-04-13 22:13:45 +02:00
|
|
|
|