]> git.proxmox.com Git - qemu.git/blame - target-ppc/op_template.h
PowerPC fixes (Jocelyn Mayer)
[qemu.git] / target-ppc / op_template.h
CommitLineData
28b6751f
FB
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
21void OPPROTO glue(op_load_gpr_T0_gpr, REG)(void)
22{
23 T0 = regs->gpr[REG];
24}
25
26void OPPROTO glue(op_load_gpr_T1_gpr, REG)(void)
27{
28 T1 = regs->gpr[REG];
29}
30
31void OPPROTO glue(op_load_gpr_T2_gpr, REG)(void)
32{
33 T2 = regs->gpr[REG];
34}
35
36void OPPROTO glue(op_store_T0_gpr_gpr, REG)(void)
37{
38 regs->gpr[REG] = T0;
39}
40
41void OPPROTO glue(op_store_T1_gpr_gpr, REG)(void)
42{
43 regs->gpr[REG] = T1;
44}
45
46void OPPROTO glue(op_store_T2_gpr_gpr, REG)(void)
47{
48 regs->gpr[REG] = T2;
49}
50
51#if REG <= 7
52
53void OPPROTO glue(op_load_crf_T0_crf, REG)(void)
54{
55 T0 = regs->crf[REG];
56}
57
58void OPPROTO glue(op_load_crf_T1_crf, REG)(void)
59{
60 T1 = regs->crf[REG];
61}
62
63void OPPROTO glue(op_store_T0_crf_crf, REG)(void)
64{
65 regs->crf[REG] = T0;
66}
67
68void OPPROTO glue(op_store_T1_crf_crf, REG)(void)
69{
70 regs->crf[REG] = T1;
71}
72
fb0eaffc
FB
73/* Floating point condition and status register moves */
74void OPPROTO glue(op_load_fpscr_T0_fpscr, REG)(void)
75{
76 T0 = regs->fpscr[REG];
77 RETURN();
78}
79
80#if REG == 0
81void OPPROTO glue(op_store_T0_fpscr_fpscr, REG)(void)
82{
83 regs->fpscr[REG] = (regs->fpscr[REG] & 0x9) | (T0 & ~0x9);
84 RETURN();
85}
86
87void OPPROTO glue(op_store_T0_fpscri_fpscr, REG)(void)
88{
89 regs->fpscr[REG] = (regs->fpscr[REG] & ~0x9) | (PARAM(1) & 0x9);
90 RETURN();
91}
92
93void OPPROTO glue(op_clear_fpscr_fpscr, REG)(void)
94{
95 regs->fpscr[REG] = (regs->fpscr[REG] & 0x9);
96 RETURN();
97}
98#else
99void OPPROTO glue(op_store_T0_fpscr_fpscr, REG)(void)
100{
101 regs->fpscr[REG] = T0;
102 RETURN();
103}
104
105void OPPROTO glue(op_store_T0_fpscri_fpscr, REG)(void)
106{
107 regs->fpscr[REG] = PARAM(1);
108 RETURN();
109}
110
111void OPPROTO glue(op_clear_fpscr_fpscr, REG)(void)
112{
113 regs->fpscr[REG] = 0x0;
114 RETURN();
115}
116#endif
117
28b6751f
FB
118#endif /* REG <= 7 */
119
120/* float moves */
121
fb0eaffc
FB
122/* floating point registers moves */
123void OPPROTO glue(op_load_fpr_FT0_fpr, REG)(void)
28b6751f
FB
124{
125 FT0 = env->fpr[REG];
fb0eaffc 126 RETURN();
28b6751f
FB
127}
128
fb0eaffc 129void OPPROTO glue(op_store_FT0_fpr_fpr, REG)(void)
28b6751f
FB
130{
131 env->fpr[REG] = FT0;
fb0eaffc
FB
132 RETURN();
133}
134
135void OPPROTO glue(op_load_fpr_FT1_fpr, REG)(void)
136{
137 FT1 = env->fpr[REG];
138 RETURN();
139}
140
141void OPPROTO glue(op_store_FT1_fpr_fpr, REG)(void)
142{
143 env->fpr[REG] = FT1;
144 RETURN();
145}
146
147void OPPROTO glue(op_load_fpr_FT2_fpr, REG)(void)
148{
149 FT2 = env->fpr[REG];
150 RETURN();
151}
152
153void OPPROTO glue(op_store_FT2_fpr_fpr, REG)(void)
154{
155 env->fpr[REG] = FT2;
156 RETURN();
28b6751f
FB
157}
158
159#undef REG