1/* Copyright (c) 2001, 2009 Xilinx, Inc.  All rights reserved.
2
3   Redistribution and use in source and binary forms, with or without
4   modification, are permitted provided that the following conditions are
5   met:
6
7   1.  Redistributions source code must retain the above copyright notice,
8   this list of conditions and the following disclaimer.
9
10   2.  Redistributions in binary form must reproduce the above copyright
11   notice, this list of conditions and the following disclaimer in the
12   documentation and/or other materials provided with the distribution.
13
14   3.  Neither the name of Xilinx nor the names of its contributors may be
15   used to endorse or promote products derived from this software without
16   specific prior written permission.
17
18   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
19   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 *
31 * setjmp  - save stack context for non-local goto
32 * args    - r5 - jmp_buf
33 *
34 * jmpbuf frame structure
35 * ---------------------
36 *
37 *      +-------------+         + 0
38 *      |     r1      |
39 *      +-------------+         + 4
40 *      |     r13     |
41 *      |      .      |
42 *      |      .      |
43 *      |      .      |
44 *      |     r31     |
45 *      +-------------+         + 80
46 *      |      .      |
47 *      |      .      |
48 */
49
50
51.globl setjmp
52.section .text
53.align 2
54.ent setjmp
55setjmp:
56    swi     r1, r5, 0
57    swi     r13, r5, 4
58    swi     r14, r5, 8
59    swi     r15, r5, 12
60    swi     r16, r5, 16
61    swi     r17, r5, 20
62    swi     r18, r5, 24
63    swi     r19, r5, 28
64    swi     r20, r5, 32
65    swi     r21, r5, 36
66    swi     r22, r5, 40
67    swi     r23, r5, 44
68    swi     r24, r5, 48
69    swi     r25, r5, 52
70    swi     r26, r5, 56
71    swi     r27, r5, 60
72    swi     r28, r5, 64
73    swi     r29, r5, 68
74    swi     r30, r5, 72
75    swi     r31, r5, 76
76
77    rtsd    r15, 8
78    or      r3, r0, r0
79.end setjmp
80