]> git.proxmox.com Git - mirror_qemu.git/blame - target-ppc/op_template.h
preliminary patch to support more PowerPC CPUs (Jocelyn Mayer)
[mirror_qemu.git] / target-ppc / op_template.h
CommitLineData
28b6751f 1/*
3fc6c082 2 * PowerPC emulation micro-operations for qemu.
28b6751f 3 *
3fc6c082 4 * Copyright (c) 2003-2005 Jocelyn Mayer
28b6751f
FB
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
9a64fbe4 21/* General purpose registers moves */
28b6751f
FB
22void OPPROTO glue(op_load_gpr_T0_gpr, REG)(void)
23{
24 T0 = regs->gpr[REG];
9a64fbe4 25 RETURN();
28b6751f
FB
26}
27
28void OPPROTO glue(op_load_gpr_T1_gpr, REG)(void)
29{
30 T1 = regs->gpr[REG];
9a64fbe4 31 RETURN();
28b6751f
FB
32}
33
34void OPPROTO glue(op_load_gpr_T2_gpr, REG)(void)
35{
36 T2 = regs->gpr[REG];
9a64fbe4 37 RETURN();
28b6751f
FB
38}
39
40void OPPROTO glue(op_store_T0_gpr_gpr, REG)(void)
41{
42 regs->gpr[REG] = T0;
9a64fbe4 43 RETURN();
28b6751f
FB
44}
45
46void OPPROTO glue(op_store_T1_gpr_gpr, REG)(void)
47{
48 regs->gpr[REG] = T1;
9a64fbe4 49 RETURN();
28b6751f
FB
50}
51
52void OPPROTO glue(op_store_T2_gpr_gpr, REG)(void)
53{
54 regs->gpr[REG] = T2;
9a64fbe4 55 RETURN();
28b6751f
FB
56}
57
58#if REG <= 7
9a64fbe4 59/* Condition register moves */
28b6751f
FB
60void OPPROTO glue(op_load_crf_T0_crf, REG)(void)
61{
62 T0 = regs->crf[REG];
9a64fbe4 63 RETURN();
28b6751f
FB
64}
65
66void OPPROTO glue(op_load_crf_T1_crf, REG)(void)
67{
68 T1 = regs->crf[REG];
9a64fbe4 69 RETURN();
28b6751f
FB
70}
71
72void OPPROTO glue(op_store_T0_crf_crf, REG)(void)
73{
74 regs->crf[REG] = T0;
9a64fbe4 75 RETURN();
28b6751f
FB
76}
77
78void OPPROTO glue(op_store_T1_crf_crf, REG)(void)
79{
80 regs->crf[REG] = T1;
9a64fbe4 81 RETURN();
28b6751f
FB
82}
83
fb0eaffc
FB
84/* Floating point condition and status register moves */
85void OPPROTO glue(op_load_fpscr_T0_fpscr, REG)(void)
86{
87 T0 = regs->fpscr[REG];
88 RETURN();
89}
90
91#if REG == 0
92void OPPROTO glue(op_store_T0_fpscr_fpscr, REG)(void)
93{
94 regs->fpscr[REG] = (regs->fpscr[REG] & 0x9) | (T0 & ~0x9);
95 RETURN();
96}
97
98void 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
104void OPPROTO glue(op_clear_fpscr_fpscr, REG)(void)
105{
106 regs->fpscr[REG] = (regs->fpscr[REG] & 0x9);
107 RETURN();
108}
109#else
110void OPPROTO glue(op_store_T0_fpscr_fpscr, REG)(void)
111{
112 regs->fpscr[REG] = T0;
113 RETURN();
114}
115
116void OPPROTO glue(op_store_T0_fpscri_fpscr, REG)(void)
117{
118 regs->fpscr[REG] = PARAM(1);
119 RETURN();
120}
121
122void OPPROTO glue(op_clear_fpscr_fpscr, REG)(void)
123{
124 regs->fpscr[REG] = 0x0;
125 RETURN();
126}
127#endif
128
28b6751f
FB
129#endif /* REG <= 7 */
130
fb0eaffc
FB
131/* floating point registers moves */
132void OPPROTO glue(op_load_fpr_FT0_fpr, REG)(void)
28b6751f
FB
133{
134 FT0 = env->fpr[REG];
fb0eaffc 135 RETURN();
28b6751f
FB
136}
137
fb0eaffc 138void OPPROTO glue(op_store_FT0_fpr_fpr, REG)(void)
28b6751f
FB
139{
140 env->fpr[REG] = FT0;
fb0eaffc
FB
141 RETURN();
142}
143
144void OPPROTO glue(op_load_fpr_FT1_fpr, REG)(void)
145{
146 FT1 = env->fpr[REG];
147 RETURN();
148}
149
150void OPPROTO glue(op_store_FT1_fpr_fpr, REG)(void)
151{
152 env->fpr[REG] = FT1;
153 RETURN();
154}
155
156void OPPROTO glue(op_load_fpr_FT2_fpr, REG)(void)
157{
158 FT2 = env->fpr[REG];
159 RETURN();
160}
161
162void OPPROTO glue(op_store_FT2_fpr_fpr, REG)(void)
163{
164 env->fpr[REG] = FT2;
165 RETURN();
28b6751f
FB
166}
167
9a64fbe4
FB
168#if REG <= 15
169/* Segment register moves */
170void OPPROTO glue(op_load_sr, REG)(void)
171{
172 T0 = env->sr[REG];
173 RETURN();
174}
175
176void OPPROTO glue(op_store_sr, REG)(void)
177{
3fc6c082 178 do_store_sr(env, REG, T0);
9a64fbe4
FB
179 RETURN();
180}
181#endif
182
28b6751f 183#undef REG