1/// @file
2///  Contains an implementation of longjmp for the Itanium-based architecture.
3///
4/// Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5/// This program and the accompanying materials
6/// are licensed and made available under the terms and conditions of the BSD License
7/// which accompanies this distribution.  The full text of the license may be found at
8/// http://opensource.org/licenses/bsd-license.php.
9///
10/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12///
13/// Module Name: longjmp.s
14///
15///
16
17.auto
18.text
19
20.proc   InternalLongJump
21.type   InternalLongJump, @function
22.regstk 2, 0, 0, 0
23InternalLongJump::
24        add                 r10 = 0x10*20 + 8*14, in0
25        movl                r2  = ~((((1 << 14) - 1) << 16) | 3)
26
27        ld8.nt1             r14 = [r10], -8*2       // BSP, skip PFS
28        mov                 r15 = ar.bspstore       // BSPSTORE
29
30        ld8.nt1             r17 = [r10], -8         // UNAT after spill
31        mov                 r16 = ar.rsc            // RSC
32        cmp.leu             p6  = r14, r15
33
34        ld8.nt1             r18 = [r10], -8         // UNAT
35        ld8.nt1             r25 = [r10], -8         // b5
36        and                 r2  = r16, r2
37
38        ldf.fill.nt1        f2  = [in0], 0x10
39        ld8.nt1             r24 = [r10], -8         // b4
40        mov                 b5  = r25
41
42        mov                 ar.rsc = r2
43        ld8.nt1             r23 = [r10], -8         // b3
44        mov                 b4  = r24
45
46        ldf.fill.nt1        f3  = [in0], 0x10
47        mov                 ar.unat = r17
48(p6)    br.spnt.many        _skip_flushrs
49
50        flushrs
51        mov                 r15 = ar.bsp            // New BSPSTORE
52
53_skip_flushrs:
54        mov                 r31 = ar.rnat           // RNAT
55        loadrs
56
57        ldf.fill.nt1        f4  = [in0], 0x10
58        ld8.nt1             r22 = [r10], -8
59        dep                 r2  = -1, r14, 3, 6
60
61        ldf.fill.nt1        f5  = [in0], 0x10
62        ld8.nt1             r21 = [r10], -8
63        cmp.ltu             p6  = r2, r15
64
65        ld8.nt1             r20 = [r10], -0x10      // skip sp
66(p6)    ld8.nta             r31 = [r2]
67        mov                 b3  = r23
68
69        ldf.fill.nt1        f16 = [in0], 0x10
70        ld8.fill.nt1        r7  = [r10], -8
71        mov                 b2  = r22
72
73        ldf.fill.nt1        f17 = [in0], 0x10
74        ld8.fill.nt1        r6  = [r10], -8
75        mov                 b1  = r21
76
77        ldf.fill.nt1        f18 = [in0], 0x10
78        ld8.fill.nt1        r5  = [r10], -8
79        mov                 b0  = r20
80
81        ldf.fill.nt1        f19 = [in0], 0x10
82        ld8.fill.nt1        r4  = [r10], 8*13
83
84        ldf.fill.nt1        f20 = [in0], 0x10
85        ld8.nt1             r19 = [r10], 0x10       // PFS
86
87        ldf.fill.nt1        f21 = [in0], 0x10
88        ld8.nt1             r26 = [r10], 8          // Predicate
89        mov                 ar.pfs = r19
90
91        ldf.fill.nt1        f22 = [in0], 0x10
92        ld8.nt1             r27 = [r10], 8          // LC
93        mov                 pr  = r26, -1
94
95        ldf.fill.nt1        f23 = [in0], 0x10
96        ld8.nt1             r28 = [r10], -17*8 - 0x10
97        mov                 ar.lc = r27
98
99        ldf.fill.nt1        f24 = [in0], 0x10
100        ldf.fill.nt1        f25 = [in0], 0x10
101        mov                 r8  = in1
102
103        ldf.fill.nt1        f26 = [in0], 0x10
104        ldf.fill.nt1        f31 = [r10], -0x10
105
106        ldf.fill.nt1        f27 = [in0], 0x10
107        ldf.fill.nt1        f30 = [r10], -0x10
108
109        ldf.fill.nt1        f28 = [in0]
110        ldf.fill.nt1        f29 = [r10], 0x10*3 + 8*4
111
112        ld8.fill.nt1        sp  = [r10]
113        mov                 ar.unat = r18
114
115        mov                 ar.bspstore = r14
116        mov                 ar.rnat = r31
117
118        invala
119        mov                 ar.rsc = r16
120        br.ret.sptk         b0
121.endp
122