Statistics
| Branch: | Revision:

root / target-ppc / op_template.h @ 9a64fbe4

History | View | Annotate | Download (3.6 kB)

1
/*
2
 *  PPC emulation micro-operations for qemu.
3
 * 
4
 *  Copyright (c) 2003 Jocelyn Mayer
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
20

    
21
/* General purpose registers moves */
22
void OPPROTO glue(op_load_gpr_T0_gpr, REG)(void)
23
{
24
    T0 = regs->gpr[REG];
25
    RETURN();
26
}
27

    
28
void OPPROTO glue(op_load_gpr_T1_gpr, REG)(void)
29
{
30
    T1 = regs->gpr[REG];
31
    RETURN();
32
}
33

    
34
void OPPROTO glue(op_load_gpr_T2_gpr, REG)(void)
35
{
36
    T2 = regs->gpr[REG];
37
    RETURN();
38
}
39

    
40
void OPPROTO glue(op_store_T0_gpr_gpr, REG)(void)
41
{
42
    regs->gpr[REG] = T0;
43
    RETURN();
44
}
45

    
46
void OPPROTO glue(op_store_T1_gpr_gpr, REG)(void)
47
{
48
    regs->gpr[REG] = T1;
49
    RETURN();
50
}
51

    
52
void OPPROTO glue(op_store_T2_gpr_gpr, REG)(void)
53
{
54
    regs->gpr[REG] = T2;
55
    RETURN();
56
}
57

    
58
#if REG <= 7
59
/* Condition register moves */
60
void OPPROTO glue(op_load_crf_T0_crf, REG)(void)
61
{
62
    T0 = regs->crf[REG];
63
    RETURN();
64
}
65

    
66
void OPPROTO glue(op_load_crf_T1_crf, REG)(void)
67
{
68
    T1 = regs->crf[REG];
69
    RETURN();
70
}
71

    
72
void OPPROTO glue(op_store_T0_crf_crf, REG)(void)
73
{
74
    regs->crf[REG] = T0;
75
    RETURN();
76
}
77

    
78
void OPPROTO glue(op_store_T1_crf_crf, REG)(void)
79
{
80
    regs->crf[REG] = T1;
81
    RETURN();
82
}
83

    
84
/* Floating point condition and status register moves */
85
void OPPROTO glue(op_load_fpscr_T0_fpscr, REG)(void)
86
{
87
    T0 = regs->fpscr[REG];
88
    RETURN();
89
}
90

    
91
#if REG == 0
92
void OPPROTO glue(op_store_T0_fpscr_fpscr, REG)(void)
93
{
94
    regs->fpscr[REG] = (regs->fpscr[REG] & 0x9) | (T0 & ~0x9);
95
    RETURN();
96
}
97

    
98
void OPPROTO glue(op_store_T0_fpscri_fpscr, REG)(void)
99
{
100
    regs->fpscr[REG] = (regs->fpscr[REG] & ~0x9) | (PARAM(1) & 0x9);
101
    RETURN();
102
}
103

    
104
void OPPROTO glue(op_clear_fpscr_fpscr, REG)(void)
105
{
106
    regs->fpscr[REG] = (regs->fpscr[REG] & 0x9);
107
    RETURN();
108
}
109
#else
110
void OPPROTO glue(op_store_T0_fpscr_fpscr, REG)(void)
111
{
112
    regs->fpscr[REG] = T0;
113
    RETURN();
114
}
115

    
116
void OPPROTO glue(op_store_T0_fpscri_fpscr, REG)(void)
117
{
118
    regs->fpscr[REG] = PARAM(1);
119
    RETURN();
120
}
121

    
122
void OPPROTO glue(op_clear_fpscr_fpscr, REG)(void)
123
{
124
    regs->fpscr[REG] = 0x0;
125
    RETURN();
126
}
127
#endif
128

    
129
#endif /* REG <= 7 */
130

    
131
/* floating point registers moves */
132
void OPPROTO glue(op_load_fpr_FT0_fpr, REG)(void)
133
{
134
    FT0 = env->fpr[REG];
135
    RETURN();
136
}
137

    
138
void OPPROTO glue(op_store_FT0_fpr_fpr, REG)(void)
139
{
140
    env->fpr[REG] = FT0;
141
    RETURN();
142
}
143

    
144
void OPPROTO glue(op_load_fpr_FT1_fpr, REG)(void)
145
{
146
    FT1 = env->fpr[REG];
147
    RETURN();
148
}
149

    
150
void OPPROTO glue(op_store_FT1_fpr_fpr, REG)(void)
151
{
152
    env->fpr[REG] = FT1;
153
    RETURN();
154
}
155

    
156
void OPPROTO glue(op_load_fpr_FT2_fpr, REG)(void)
157
{
158
    FT2 = env->fpr[REG];
159
    RETURN();
160
}
161

    
162
void OPPROTO glue(op_store_FT2_fpr_fpr, REG)(void)
163
{
164
    env->fpr[REG] = FT2;
165
    RETURN();
166
}
167

    
168
#if REG <= 15
169
/* Segment register moves */
170
void OPPROTO glue(op_load_sr, REG)(void)
171
{
172
    T0 = env->sr[REG];
173
    RETURN();
174
}
175

    
176
void OPPROTO glue(op_store_sr, REG)(void)
177
{
178
#if defined (DEBUG_OP)
179
    dump_store_sr(REG);
180
#endif
181
    env->sr[REG] = T0;
182
    RETURN();
183
}
184
#endif
185

    
186
#undef REG