OSDN Git Service

2001-05-14 Ben Elliston <bje@redhat.com>
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / testsuite / sidcomp.cgen-cpu.arm7t / armfiq.cs
1 # sim(): armeit.conf
2 # output(): pass\n
3 # mach(): all
4
5 # Set up, trigger, and verify an FIQ 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,#FBIT
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 fiq_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,#FIQ_ADDR
31         str r4,[r5]
32
33 # Write to memory location 0x80000000.  A tcl device at that address will wake
34 # up and then trigger an FIQ interrupt.
35
36         mov r7,#1 @ set to zero by fiq handler
37
38         mov r4,#0x80000000
39         mov r5,#0
40         strb r5,[r4]
41
42 # Wait for an FIQ, but don't wait forever.
43 # The FIQ handler will set r7 to zero.
44
45         mov r4,#256
46 wait_fiq:
47         cmp r7,#0
48         beq fiq_happened
49         subs r4,r4,#1
50         bne wait_fiq
51         fail
52
53 fiq_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 # FIQ interrupt handler
65
66 fiq_interrupt_handler:
67
68 # Make sure we're in FIQ mode.
69
70         mrs r4,cpsr
71         and r4,r4,#MODE_BITS
72         test_h_gr r4, FIQ_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