OSDN Git Service

* public snapshot of sid simulator
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / testsuite / sidcomp.cgen-cpu / armirq.cs
1 # sim(): armeit.conf
2 # output(): pass\n
3 # mach(): all
4
5 # Set up, trigger, and verify an IRQ interrupt.
6
7         .include "armutils.inc"
8
9 # Entry point.
10
11         start
12
13 # Prepare to handle interrupts.
14
15         mrs r4,cpsr
16         bic r4,r4,#IBIT
17         bic r4,r4,#MODE_BITS
18         orr r4,r4,#SYSTEM_MODE
19         msr cpsr,r4
20
21 # Build an instruction to branch to the interrupt handler.
22
23         bl . + 8
24         .word irq_interrupt_handler
25         ldr r4,[r14]
26         sub r4,r4,#0x1c
27         sub r4,r4,#8
28         mov r4,r4,asr #2
29         add r4,r4,#0xea000000
30         mov r5,#IRQ_ADDR
31         str r4,[r5]
32
33 # Write to memory location 0x80000001.  A tcl device at that address will wake
34 # up and then trigger an IRQ interrupt.
35
36         mov r7,#1 @ set to zero by irq handler
37
38         mov r4,#0x80000001
39         mov r5,#0
40         strb r5,[r4]
41
42 # Wait for an IRQ, but don't wait forever.
43 # The IRQ handler will set r7 to zero.
44
45         mov r4,#256
46 wait_irq:
47         cmp r7,#0
48         beq irq_happened
49         subs r4,r4,#1
50         bne wait_irq
51         fail
52
53 irq_happened:
54
55 # Returned from interrupt.  Verify register contents.
56
57 # FIXME: unfinished
58
59 # All done, print "pass".
60
61 done:
62         pass
63
64 # IRQ interrupt handler
65
66 irq_interrupt_handler:
67
68 # Make sure we're in IRQ mode.
69
70         mrs r4,cpsr
71         and r4,r4,#MODE_BITS
72         test_h_gr r4, IRQ_MODE
73
74 # Return from interrupt.
75
76         mov r7,#0
77         subs pc,r14,#4
78
79 # We should have returned from the interrupt, fail if not.
80
81         fail