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 * longjmp - non-local jump to a saved stack context
32 * args    - r5 - jmp_buf
33 *           r6 - val
34 *
35 * jmpbuf frame structure
36 * ---------------------
37 *
38 *      +-------------+         + 0
39 *      |     r1      |
40 *      +-------------+         + 4
41 *      |     r13     |
42 *      |      .      |
43 *      |      .      |
44 *      |      .      |
45 *      |     r31     |
46 *      +-------------+         + 80
47 *      |      .      |
48 *      |      .      |
49 */
50
51
52.globl longjmp
53.section .text
54.align 2
55.ent longjmp
56longjmp:
57    lwi     r1, r5, 0
58    lwi     r13, r5, 4
59    lwi     r14, r5, 8
60    lwi     r15, r5, 12
61    lwi     r16, r5, 16
62    lwi     r17, r5, 20
63    lwi     r18, r5, 24
64    lwi     r19, r5, 28
65    lwi     r20, r5, 32
66    lwi     r21, r5, 36
67    lwi     r22, r5, 40
68    lwi     r23, r5, 44
69    lwi     r24, r5, 48
70    lwi     r25, r5, 52
71    lwi     r26, r5, 56
72    lwi     r27, r5, 60
73    lwi     r28, r5, 64
74    lwi     r29, r5, 68
75    lwi     r30, r5, 72
76    lwi     r31, r5, 76
77
78    rtsd    r15, 8
79    or      r3, r0, r6
80.end longjmp
81