blob: cc43a55e1fcf4e21b102659193df16e786194e03 [file] [log] [blame]
Yoshinori Satob2296322006-11-05 16:18:08 +09001! entry.S macro define
2
3 .macro cli
4 stc sr, r0
5 or #0xf0, r0
6 ldc r0, sr
7 .endm
8
9 .macro sti
Stuart Menefyfea966f2009-08-24 17:09:53 +090010 mov #0xfffffff0, r11
Yoshinori Satob2296322006-11-05 16:18:08 +090011 extu.b r11, r11
12 not r11, r11
13 stc sr, r10
14 and r11, r10
Hideo Saito8b1d1652008-02-26 14:28:48 +090015#ifdef CONFIG_CPU_HAS_SR_RB
Yoshinori Satob2296322006-11-05 16:18:08 +090016 stc k_g_imask, r11
17 or r11, r10
18#endif
19 ldc r10, sr
20 .endm
21
22 .macro get_current_thread_info, ti, tmp
Hideo Saito8b1d1652008-02-26 14:28:48 +090023#ifdef CONFIG_CPU_HAS_SR_RB
Yoshinori Satob2296322006-11-05 16:18:08 +090024 stc r7_bank, \ti
25#else
Paul Mundt510c72ad2006-11-27 12:06:26 +090026 mov #((THREAD_SIZE - 1) >> 10) ^ 0xff, \tmp
Yoshinori Satob2296322006-11-05 16:18:08 +090027 shll8 \tmp
Paul Mundt510c72ad2006-11-27 12:06:26 +090028 shll2 \tmp
Yoshinori Satob2296322006-11-05 16:18:08 +090029 mov r15, \ti
30 and \tmp, \ti
31#endif
32 .endm
33
Stuart Menefyfd78a762009-07-29 23:01:24 +090034#ifdef CONFIG_TRACE_IRQFLAGS
35
36 .macro TRACE_IRQS_ON
37 mov.l r0, @-r15
38 mov.l r1, @-r15
39 mov.l r2, @-r15
40 mov.l r3, @-r15
41 mov.l r4, @-r15
42 mov.l r5, @-r15
43 mov.l r6, @-r15
44 mov.l r7, @-r15
45
46 mov.l 7834f, r0
47 jsr @r0
48 nop
49
50 mov.l @r15+, r7
51 mov.l @r15+, r6
52 mov.l @r15+, r5
53 mov.l @r15+, r4
54 mov.l @r15+, r3
55 mov.l @r15+, r2
56 mov.l @r15+, r1
57 mov.l @r15+, r0
58 mov.l 7834f, r0
59
60 bra 7835f
61 nop
62 .balign 4
637834: .long trace_hardirqs_on
647835:
65 .endm
66 .macro TRACE_IRQS_OFF
67
68 mov.l r0, @-r15
69 mov.l r1, @-r15
70 mov.l r2, @-r15
71 mov.l r3, @-r15
72 mov.l r4, @-r15
73 mov.l r5, @-r15
74 mov.l r6, @-r15
75 mov.l r7, @-r15
76
77 mov.l 7834f, r0
78 jsr @r0
79 nop
80
81 mov.l @r15+, r7
82 mov.l @r15+, r6
83 mov.l @r15+, r5
84 mov.l @r15+, r4
85 mov.l @r15+, r3
86 mov.l @r15+, r2
87 mov.l @r15+, r1
88 mov.l @r15+, r0
89 mov.l 7834f, r0
90
91 bra 7835f
92 nop
93 .balign 4
947834: .long trace_hardirqs_off
957835:
96 .endm
97
98#else
99 .macro TRACE_IRQS_ON
100 .endm
101
102 .macro TRACE_IRQS_OFF
103 .endm
104#endif
105
Magnus Damm0197f212009-02-27 16:41:17 +0900106#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH4)
107# define PREF(x) pref @x
108#else
109# define PREF(x) nop
110#endif
Matt Fleming0b930482009-08-02 22:33:26 +0100111
112 /*
113 * Macro for use within assembly. Because the DWARF unwinder
114 * needs to use the frame register to unwind the stack, we
115 * need to setup r14 with the value of the stack pointer as
116 * the return address is usually on the stack somewhere.
117 */
118 .macro setup_frame_reg
119#ifdef CONFIG_DWARF_UNWINDER
120 mov r15, r14
121#endif
122 .endm