Rev 632 | Go to most recent revision | Details | 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 | |||
29 | /** |
||
30 | * This file contains register window trap handlers. |
||
31 | */ |
||
32 | |||
33 | #ifndef __sparc64_REGWIN_H__ |
||
34 | #define __sparc64_REGWIN_H__ |
||
35 | |||
36 | #include <arch/stack.h> |
||
37 | |||
38 | #define TT_CLEAN_WINDOW 0x24 |
||
39 | #define TT_SPILL_0_NORMAL 0x80 |
||
40 | #define TT_FILL_0_NORMAL 0xc0 |
||
41 | |||
42 | #define REGWIN_HANDLER_SIZE 128 |
||
43 | |||
44 | #define CLEAN_WINDOW_HANDLER_SIZE REGWIN_HANDLER_SIZE |
||
45 | #define SPILL_HANDLER_SIZE REGWIN_HANDLER_SIZE |
||
46 | #define FILL_HANDLER_SIZE REGWIN_HANDLER_SIZE |
||
47 | |||
48 | /** Window Save Area offsets. */ |
||
49 | #define L0_OFFSET 0 |
||
50 | #define L1_OFFSET 8 |
||
51 | #define L2_OFFSET 16 |
||
52 | #define L3_OFFSET 24 |
||
53 | #define L4_OFFSET 32 |
||
54 | #define L5_OFFSET 40 |
||
55 | #define L6_OFFSET 48 |
||
56 | #define L7_OFFSET 56 |
||
57 | #define I0_OFFSET 64 |
||
58 | #define I1_OFFSET 72 |
||
59 | #define I2_OFFSET 80 |
||
60 | #define I3_OFFSET 88 |
||
61 | #define I4_OFFSET 96 |
||
62 | #define I5_OFFSET 104 |
||
63 | #define I6_OFFSET 112 |
||
64 | #define I7_OFFSET 120 |
||
65 | |||
66 | .macro SPILL_NORMAL_HANDLER |
||
67 | stx %l0, [%sp + STACK_BIAS + L0_OFFSET] |
||
68 | stx %l1, [%sp + STACK_BIAS + L1_OFFSET] |
||
69 | stx %l2, [%sp + STACK_BIAS + L2_OFFSET] |
||
70 | stx %l3, [%sp + STACK_BIAS + L3_OFFSET] |
||
71 | stx %l4, [%sp + STACK_BIAS + L4_OFFSET] |
||
72 | stx %l5, [%sp + STACK_BIAS + L5_OFFSET] |
||
73 | stx %l6, [%sp + STACK_BIAS + L6_OFFSET] |
||
74 | stx %l7, [%sp + STACK_BIAS + L7_OFFSET] |
||
75 | stx %i0, [%sp + STACK_BIAS + I0_OFFSET] |
||
76 | stx %i1, [%sp + STACK_BIAS + I1_OFFSET] |
||
77 | stx %i2, [%sp + STACK_BIAS + I2_OFFSET] |
||
78 | stx %i3, [%sp + STACK_BIAS + I3_OFFSET] |
||
79 | stx %i4, [%sp + STACK_BIAS + I4_OFFSET] |
||
80 | stx %i5, [%sp + STACK_BIAS + I5_OFFSET] |
||
81 | stx %i6, [%sp + STACK_BIAS + I6_OFFSET] |
||
82 | stx %i7, [%sp + STACK_BIAS + I7_OFFSET] |
||
83 | saved |
||
84 | retry |
||
85 | .endm |
||
86 | |||
87 | .macro FILL_NORMAL_HANDLER |
||
88 | ldx [%sp + STACK_BIAS + L0_OFFSET], %l0 |
||
89 | ldx [%sp + STACK_BIAS + L1_OFFSET], %l1 |
||
90 | ldx [%sp + STACK_BIAS + L2_OFFSET], %l2 |
||
91 | ldx [%sp + STACK_BIAS + L3_OFFSET], %l3 |
||
92 | ldx [%sp + STACK_BIAS + L4_OFFSET], %l4 |
||
93 | ldx [%sp + STACK_BIAS + L5_OFFSET], %l5 |
||
94 | ldx [%sp + STACK_BIAS + L6_OFFSET], %l6 |
||
95 | ldx [%sp + STACK_BIAS + L7_OFFSET], %l7 |
||
96 | ldx [%sp + STACK_BIAS + I0_OFFSET], %i0 |
||
97 | ldx [%sp + STACK_BIAS + I1_OFFSET], %i1 |
||
98 | ldx [%sp + STACK_BIAS + I2_OFFSET], %i2 |
||
99 | ldx [%sp + STACK_BIAS + I3_OFFSET], %i3 |
||
100 | ldx [%sp + STACK_BIAS + I4_OFFSET], %i4 |
||
101 | ldx [%sp + STACK_BIAS + I5_OFFSET], %i5 |
||
102 | ldx [%sp + STACK_BIAS + I6_OFFSET], %i6 |
||
103 | ldx [%sp + STACK_BIAS + I7_OFFSET], %i7 |
||
104 | restored |
||
105 | retry |
||
106 | .endm |
||
107 | |||
108 | .macro CLEAN_WINDOW_HANDLER |
||
109 | rdpr %cleanwin, %l0 |
||
110 | add %l0, 1, %l0 |
||
111 | wrpr %l0, 0, %cleanwin |
||
112 | mov %r0, %l0 |
||
113 | mov %r0, %l1 |
||
114 | mov %r0, %l2 |
||
115 | mov %r0, %l3 |
||
116 | mov %r0, %l4 |
||
117 | mov %r0, %l5 |
||
118 | mov %r0, %l6 |
||
119 | mov %r0, %l7 |
||
120 | mov %r0, %i0 |
||
121 | mov %r0, %i1 |
||
122 | mov %r0, %i2 |
||
123 | mov %r0, %i3 |
||
124 | mov %r0, %i4 |
||
125 | mov %r0, %i5 |
||
126 | retry |
||
127 | .endm |
||
128 | |||
129 | #endif |