2 Copyright (C) 1993-2005 Axis Communications.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
9 1. Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
12 2. Neither the name of Axis Communications nor the names of its
13 contributors may be used to endorse or promote products derived
14 from this software without specific prior written permission.
16 THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
17 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
20 COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE. */
29 /* For benefit of CRIS v0..v3, we save and restore CCR to be able to
30 correctly handle DI/EI; otherwise there would be no reason to save it.
31 Note also that the "move x,ccr" does NOT affect
32 the DMA enable bits (E and D) of v0..v3.
34 We do not save mof; it is call-clobbered. It also does not exist in
35 v0..v8; it should be safe to read or write to it there, but better not.
63 #if defined (__arch_common_v10_v32) || defined (__arch_v32)
64 /* No offsets in the compatibility mode. Also, movem saves in
65 different order on v10 than on v32, so we use single move
66 instructions instead, this not being a speed-prioritized operation.
67 And we don't save CCR or CCS; since long unuseful. */
72 move.d $sp,[$r13+] \n\
74 move.d $r12,[$r13+] \n\
75 move.d $r11,[$r13+] \n\
76 move.d $r10,[$r13+] \n\
78 move.d $r9,[$r13+] \n\
79 move.d $r8,[$r13+] \n\
80 move.d $r7,[$r13+] \n\
81 move.d $r6,[$r13+] \n\
82 move.d $r5,[$r13+] \n\
83 move.d $r4,[$r13+] \n\
84 move.d $r3,[$r13+] \n\
85 move.d $r2,[$r13+] \n\
86 move.d $r1,[$r13+] \n\
87 move.d $r0,[$r13+] \n\
101 : "r9", "r13", "memory");
102 #else /* not __arch_common_v10_v32 or __arch_v32 */
106 movem $sp,[%1+1*4] \n\
110 move $srp,[%1+16*4] \n\
111 move $ccr,[%1+17*4] \n\
127 movem $sp,[%1+1*4] \n\
130 move $srp,[%1+16*4] \n\
131 move $ccr,[%1+17*4] \n\
145 #endif /* not __arch_common_v10_v32 or __arch_v32 */
150 longjmp(jmp_buf buf
, int val
)
152 #if defined (__arch_common_v10_v32) || defined (__arch_v32)
156 move.d %0,$r13 ; In delay-slot. \n\
161 #ifdef __arch_common_v10_v32
162 /* Cater to branch offset difference between v32 and v10. We
163 assume the branch above is 8-bit. */
166 " move [$r13+],$mof \n\
167 move.d [$r13+],$sp \n\
169 move.d [$r13+],$r12 \n\
170 move.d [$r13+],$r11 \n\
171 move.d [$r13+],$r10 \n\
172 move.d [$r13+],$r9 \n\
173 move.d [$r13+],$r8 \n\
174 move.d [$r13+],$r7 \n\
175 move.d [$r13+],$r6 \n\
176 move.d [$r13+],$r5 \n\
177 move.d [$r13+],$r4 \n\
178 move.d [$r13+],$r3 \n\
179 move.d [$r13+],$r2 \n\
180 move.d [$r13+],$r1 \n\
181 move.d [$r13+],$r0 \n\
182 move [$r13+],$srp \n\
191 : "r" (buf
), "r" (val
)
194 #else /* not __arch_common_v10_v32 or __arch_v32 */
196 ("move [%0+17*4],$ccr \n\
197 move [%0+16*4],$srp \n\
201 move.d %1,[%0+6*4] ; Offset for r9. \n\
209 : "r" (buf
), "r" (val
)
211 #endif /* not __arch_common_v10_v32 or __arch_v32 */