1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include "qemu/osdep.h"
20#include "cpu.h"
21#include "exec/helper-proto.h"
22#include "exec/exec-all.h"
23#include "qemu/log.h"
24#include "qemu/main-loop.h"
25
26
27
28
29target_ulong helper_load_tbl(CPUPPCState *env)
30{
31 return (target_ulong)cpu_ppc_load_tbl(env);
32}
33
34target_ulong helper_load_tbu(CPUPPCState *env)
35{
36 return cpu_ppc_load_tbu(env);
37}
38
39target_ulong helper_load_atbl(CPUPPCState *env)
40{
41 return (target_ulong)cpu_ppc_load_atbl(env);
42}
43
44target_ulong helper_load_atbu(CPUPPCState *env)
45{
46 return cpu_ppc_load_atbu(env);
47}
48
49target_ulong helper_load_vtb(CPUPPCState *env)
50{
51 return cpu_ppc_load_vtb(env);
52}
53
54#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
55target_ulong helper_load_purr(CPUPPCState *env)
56{
57 return (target_ulong)cpu_ppc_load_purr(env);
58}
59
60void helper_store_purr(CPUPPCState *env, target_ulong val)
61{
62 cpu_ppc_store_purr(env, val);
63}
64#endif
65
66target_ulong helper_load_601_rtcl(CPUPPCState *env)
67{
68 return cpu_ppc601_load_rtcl(env);
69}
70
71target_ulong helper_load_601_rtcu(CPUPPCState *env)
72{
73 return cpu_ppc601_load_rtcu(env);
74}
75
76#if !defined(CONFIG_USER_ONLY)
77void helper_store_tbl(CPUPPCState *env, target_ulong val)
78{
79 cpu_ppc_store_tbl(env, val);
80}
81
82void helper_store_tbu(CPUPPCState *env, target_ulong val)
83{
84 cpu_ppc_store_tbu(env, val);
85}
86
87void helper_store_atbl(CPUPPCState *env, target_ulong val)
88{
89 cpu_ppc_store_atbl(env, val);
90}
91
92void helper_store_atbu(CPUPPCState *env, target_ulong val)
93{
94 cpu_ppc_store_atbu(env, val);
95}
96
97void helper_store_601_rtcl(CPUPPCState *env, target_ulong val)
98{
99 cpu_ppc601_store_rtcl(env, val);
100}
101
102void helper_store_601_rtcu(CPUPPCState *env, target_ulong val)
103{
104 cpu_ppc601_store_rtcu(env, val);
105}
106
107target_ulong helper_load_decr(CPUPPCState *env)
108{
109 return cpu_ppc_load_decr(env);
110}
111
112void helper_store_decr(CPUPPCState *env, target_ulong val)
113{
114 cpu_ppc_store_decr(env, val);
115}
116
117target_ulong helper_load_hdecr(CPUPPCState *env)
118{
119 return cpu_ppc_load_hdecr(env);
120}
121
122void helper_store_hdecr(CPUPPCState *env, target_ulong val)
123{
124 cpu_ppc_store_hdecr(env, val);
125}
126
127void helper_store_vtb(CPUPPCState *env, target_ulong val)
128{
129 cpu_ppc_store_vtb(env, val);
130}
131
132void helper_store_tbu40(CPUPPCState *env, target_ulong val)
133{
134 cpu_ppc_store_tbu40(env, val);
135}
136
137target_ulong helper_load_40x_pit(CPUPPCState *env)
138{
139 return load_40x_pit(env);
140}
141
142void helper_store_40x_pit(CPUPPCState *env, target_ulong val)
143{
144 store_40x_pit(env, val);
145}
146
147void helper_store_booke_tcr(CPUPPCState *env, target_ulong val)
148{
149 store_booke_tcr(env, val);
150}
151
152void helper_store_booke_tsr(CPUPPCState *env, target_ulong val)
153{
154 store_booke_tsr(env, val);
155}
156#endif
157
158
159
160
161
162target_ulong helper_load_dcr(CPUPPCState *env, target_ulong dcrn)
163{
164 uint32_t val = 0;
165
166 if (unlikely(env->dcr_env == NULL)) {
167 qemu_log_mask(LOG_GUEST_ERROR, "No DCR environment\n");
168 raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
169 POWERPC_EXCP_INVAL |
170 POWERPC_EXCP_INVAL_INVAL, GETPC());
171 } else {
172 int ret;
173
174 qemu_mutex_lock_iothread();
175 ret = ppc_dcr_read(env->dcr_env, (uint32_t)dcrn, &val);
176 qemu_mutex_unlock_iothread();
177 if (unlikely(ret != 0)) {
178 qemu_log_mask(LOG_GUEST_ERROR, "DCR read error %d %03x\n",
179 (uint32_t)dcrn, (uint32_t)dcrn);
180 raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
181 POWERPC_EXCP_INVAL |
182 POWERPC_EXCP_PRIV_REG, GETPC());
183 }
184 }
185 return val;
186}
187
188void helper_store_dcr(CPUPPCState *env, target_ulong dcrn, target_ulong val)
189{
190 if (unlikely(env->dcr_env == NULL)) {
191 qemu_log_mask(LOG_GUEST_ERROR, "No DCR environment\n");
192 raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
193 POWERPC_EXCP_INVAL |
194 POWERPC_EXCP_INVAL_INVAL, GETPC());
195 } else {
196 int ret;
197 qemu_mutex_lock_iothread();
198 ret = ppc_dcr_write(env->dcr_env, (uint32_t)dcrn, (uint32_t)val);
199 qemu_mutex_unlock_iothread();
200 if (unlikely(ret != 0)) {
201 qemu_log_mask(LOG_GUEST_ERROR, "DCR write error %d %03x\n",
202 (uint32_t)dcrn, (uint32_t)dcrn);
203 raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
204 POWERPC_EXCP_INVAL |
205 POWERPC_EXCP_PRIV_REG, GETPC());
206 }
207 }
208}
209