Rev 666 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
630 | jermar | 1 | /* |
2 | * Copyright (C) 2005 Jakub Jermar |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions |
||
7 | * are met: |
||
8 | * |
||
9 | * - Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * - Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
13 | * documentation and/or other materials provided with the distribution. |
||
14 | * - The name of the author may not be used to endorse or promote products |
||
15 | * derived from this software without specific prior written permission. |
||
16 | * |
||
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
||
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | */ |
||
28 | |||
1702 | cejka | 29 | /** @addtogroup sparc64 |
30 | * @{ |
||
31 | */ |
||
32 | /** @file |
||
33 | */ |
||
34 | |||
630 | jermar | 35 | /** |
36 | * This file contains register window trap handlers. |
||
37 | */ |
||
38 | |||
39 | #ifndef __sparc64_REGWIN_H__ |
||
40 | #define __sparc64_REGWIN_H__ |
||
41 | |||
42 | #include <arch/stack.h> |
||
43 | |||
44 | #define TT_CLEAN_WINDOW 0x24 |
||
45 | #define TT_SPILL_0_NORMAL 0x80 |
||
46 | #define TT_FILL_0_NORMAL 0xc0 |
||
47 | |||
48 | #define REGWIN_HANDLER_SIZE 128 |
||
49 | |||
50 | #define CLEAN_WINDOW_HANDLER_SIZE REGWIN_HANDLER_SIZE |
||
51 | #define SPILL_HANDLER_SIZE REGWIN_HANDLER_SIZE |
||
52 | #define FILL_HANDLER_SIZE REGWIN_HANDLER_SIZE |
||
53 | |||
54 | /** Window Save Area offsets. */ |
||
55 | #define L0_OFFSET 0 |
||
56 | #define L1_OFFSET 8 |
||
57 | #define L2_OFFSET 16 |
||
58 | #define L3_OFFSET 24 |
||
59 | #define L4_OFFSET 32 |
||
60 | #define L5_OFFSET 40 |
||
61 | #define L6_OFFSET 48 |
||
62 | #define L7_OFFSET 56 |
||
63 | #define I0_OFFSET 64 |
||
64 | #define I1_OFFSET 72 |
||
65 | #define I2_OFFSET 80 |
||
66 | #define I3_OFFSET 88 |
||
67 | #define I4_OFFSET 96 |
||
68 | #define I5_OFFSET 104 |
||
69 | #define I6_OFFSET 112 |
||
70 | #define I7_OFFSET 120 |
||
71 | |||
632 | jermar | 72 | #ifdef __ASM__ |
630 | jermar | 73 | .macro SPILL_NORMAL_HANDLER |
74 | stx %l0, [%sp + STACK_BIAS + L0_OFFSET] |
||
75 | stx %l1, [%sp + STACK_BIAS + L1_OFFSET] |
||
76 | stx %l2, [%sp + STACK_BIAS + L2_OFFSET] |
||
77 | stx %l3, [%sp + STACK_BIAS + L3_OFFSET] |
||
78 | stx %l4, [%sp + STACK_BIAS + L4_OFFSET] |
||
79 | stx %l5, [%sp + STACK_BIAS + L5_OFFSET] |
||
80 | stx %l6, [%sp + STACK_BIAS + L6_OFFSET] |
||
81 | stx %l7, [%sp + STACK_BIAS + L7_OFFSET] |
||
82 | stx %i0, [%sp + STACK_BIAS + I0_OFFSET] |
||
83 | stx %i1, [%sp + STACK_BIAS + I1_OFFSET] |
||
84 | stx %i2, [%sp + STACK_BIAS + I2_OFFSET] |
||
85 | stx %i3, [%sp + STACK_BIAS + I3_OFFSET] |
||
86 | stx %i4, [%sp + STACK_BIAS + I4_OFFSET] |
||
87 | stx %i5, [%sp + STACK_BIAS + I5_OFFSET] |
||
88 | stx %i6, [%sp + STACK_BIAS + I6_OFFSET] |
||
89 | stx %i7, [%sp + STACK_BIAS + I7_OFFSET] |
||
90 | saved |
||
91 | retry |
||
92 | .endm |
||
93 | |||
94 | .macro FILL_NORMAL_HANDLER |
||
95 | ldx [%sp + STACK_BIAS + L0_OFFSET], %l0 |
||
96 | ldx [%sp + STACK_BIAS + L1_OFFSET], %l1 |
||
97 | ldx [%sp + STACK_BIAS + L2_OFFSET], %l2 |
||
98 | ldx [%sp + STACK_BIAS + L3_OFFSET], %l3 |
||
99 | ldx [%sp + STACK_BIAS + L4_OFFSET], %l4 |
||
100 | ldx [%sp + STACK_BIAS + L5_OFFSET], %l5 |
||
101 | ldx [%sp + STACK_BIAS + L6_OFFSET], %l6 |
||
102 | ldx [%sp + STACK_BIAS + L7_OFFSET], %l7 |
||
103 | ldx [%sp + STACK_BIAS + I0_OFFSET], %i0 |
||
104 | ldx [%sp + STACK_BIAS + I1_OFFSET], %i1 |
||
105 | ldx [%sp + STACK_BIAS + I2_OFFSET], %i2 |
||
106 | ldx [%sp + STACK_BIAS + I3_OFFSET], %i3 |
||
107 | ldx [%sp + STACK_BIAS + I4_OFFSET], %i4 |
||
108 | ldx [%sp + STACK_BIAS + I5_OFFSET], %i5 |
||
109 | ldx [%sp + STACK_BIAS + I6_OFFSET], %i6 |
||
110 | ldx [%sp + STACK_BIAS + I7_OFFSET], %i7 |
||
111 | restored |
||
112 | retry |
||
113 | .endm |
||
114 | |||
115 | .macro CLEAN_WINDOW_HANDLER |
||
116 | rdpr %cleanwin, %l0 |
||
117 | add %l0, 1, %l0 |
||
118 | wrpr %l0, 0, %cleanwin |
||
119 | mov %r0, %l0 |
||
120 | mov %r0, %l1 |
||
121 | mov %r0, %l2 |
||
122 | mov %r0, %l3 |
||
123 | mov %r0, %l4 |
||
124 | mov %r0, %l5 |
||
125 | mov %r0, %l6 |
||
126 | mov %r0, %l7 |
||
666 | jermar | 127 | mov %r0, %o0 |
128 | mov %r0, %o1 |
||
129 | mov %r0, %o2 |
||
130 | mov %r0, %o3 |
||
131 | mov %r0, %o4 |
||
132 | mov %r0, %o5 |
||
133 | mov %r0, %o6 |
||
134 | mov %r0, %o7 |
||
630 | jermar | 135 | retry |
136 | .endm |
||
632 | jermar | 137 | #endif /* __ASM__ */ |
630 | jermar | 138 | |
139 | #endif |
||
1702 | cejka | 140 | |
141 | /** @} |
||
142 | */ |
||
143 |