helper.h 11.6 KB
Newer Older
T
ths 已提交
1 2 3
#ifndef DEF_HELPER
#define DEF_HELPER(ret, name, params) ret name params;
#endif
4

T
ths 已提交
5 6 7 8
DEF_HELPER(void, do_raise_exception_err, (int excp, int err))
DEF_HELPER(void, do_raise_exception, (int excp))
DEF_HELPER(void, do_interrupt_restart, (void))

T
ths 已提交
9
#ifdef TARGET_MIPS64
10 11 12 13
DEF_HELPER(target_ulong, do_ldl, (target_ulong t0, target_ulong t1, int mem_idx))
DEF_HELPER(target_ulong, do_ldr, (target_ulong t0, target_ulong t1, int mem_idx))
DEF_HELPER(void, do_sdl, (target_ulong t0, target_ulong t1, int mem_idx))
DEF_HELPER(void, do_sdr, (target_ulong t0, target_ulong t1, int mem_idx))
T
ths 已提交
14
#endif
15 16 17 18
DEF_HELPER(target_ulong, do_lwl, (target_ulong t0, target_ulong t1, int mem_idx))
DEF_HELPER(target_ulong, do_lwr, (target_ulong t0, target_ulong t1, int mem_idx))
DEF_HELPER(void, do_swl, (target_ulong t0, target_ulong t1, int mem_idx))
DEF_HELPER(void, do_swr, (target_ulong t0, target_ulong t1, int mem_idx))
T
ths 已提交
19

20 21
DEF_HELPER(target_ulong, do_clo, (target_ulong t0))
DEF_HELPER(target_ulong, do_clz, (target_ulong t0))
T
ths 已提交
22
#ifdef TARGET_MIPS64
23 24 25 26
DEF_HELPER(target_ulong, do_dclo, (target_ulong t0))
DEF_HELPER(target_ulong, do_dclz, (target_ulong t0))
DEF_HELPER(void, do_dmult, (target_ulong t0, target_ulong t1))
DEF_HELPER(void, do_dmultu, (target_ulong t0, target_ulong t1))
T
ths 已提交
27
#endif
28

29 30 31 32 33 34 35 36 37 38 39 40 41 42
DEF_HELPER(target_ulong, do_muls, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_mulsu, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_macc, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_maccu, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_msac, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_msacu, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_mulhi, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_mulhiu, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_mulshi, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_mulshiu, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_macchi, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_macchiu, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_msachi, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_msachiu, (target_ulong t0, target_ulong t1))
43

44 45
/* CP0 helpers */
#ifndef CONFIG_USER_ONLY
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
DEF_HELPER(target_ulong, do_mfc0_mvpcontrol, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_mvpconf0, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_mvpconf1, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_random, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_tcstatus, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_tcstatus, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_tcbind, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_tcbind, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_tcrestart, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_tcrestart, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_tchalt, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_tchalt, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_tccontext, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_tccontext, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_tcschedule, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_tcschedule, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_tcschefback, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_tcschefback, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_count, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_entryhi, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_status, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_lladdr, (target_ulong t0))
DEF_HELPER(target_ulong, do_mfc0_watchlo, (target_ulong t0, uint32_t sel))
DEF_HELPER(target_ulong, do_mfc0_watchhi, (target_ulong t0, uint32_t sel))
DEF_HELPER(target_ulong, do_mfc0_debug, (target_ulong t0))
DEF_HELPER(target_ulong, do_mftc0_debug, (target_ulong t0))
72
#ifdef TARGET_MIPS64
73 74 75 76 77 78 79
DEF_HELPER(target_ulong, do_dmfc0_tcrestart, (target_ulong t0))
DEF_HELPER(target_ulong, do_dmfc0_tchalt, (target_ulong t0))
DEF_HELPER(target_ulong, do_dmfc0_tccontext, (target_ulong t0))
DEF_HELPER(target_ulong, do_dmfc0_tcschedule, (target_ulong t0))
DEF_HELPER(target_ulong, do_dmfc0_tcschefback, (target_ulong t0))
DEF_HELPER(target_ulong, do_dmfc0_lladdr, (target_ulong t0))
DEF_HELPER(target_ulong, do_dmfc0_watchlo, (target_ulong t0, uint32_t sel))
80 81
#endif /* TARGET_MIPS64 */

82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
DEF_HELPER(void, do_mtc0_index, (target_ulong t0))
DEF_HELPER(void, do_mtc0_mvpcontrol, (target_ulong t0))
DEF_HELPER(void, do_mtc0_vpecontrol, (target_ulong t0))
DEF_HELPER(void, do_mtc0_vpeconf0, (target_ulong t0))
DEF_HELPER(void, do_mtc0_vpeconf1, (target_ulong t0))
DEF_HELPER(void, do_mtc0_yqmask, (target_ulong t0))
DEF_HELPER(void, do_mtc0_vpeopt, (target_ulong t0))
DEF_HELPER(void, do_mtc0_entrylo0, (target_ulong t0))
DEF_HELPER(void, do_mtc0_tcstatus, (target_ulong t0))
DEF_HELPER(void, do_mttc0_tcstatus, (target_ulong t0))
DEF_HELPER(void, do_mtc0_tcbind, (target_ulong t0))
DEF_HELPER(void, do_mttc0_tcbind, (target_ulong t0))
DEF_HELPER(void, do_mtc0_tcrestart, (target_ulong t0))
DEF_HELPER(void, do_mttc0_tcrestart, (target_ulong t0))
DEF_HELPER(void, do_mtc0_tchalt, (target_ulong t0))
DEF_HELPER(void, do_mttc0_tchalt, (target_ulong t0))
DEF_HELPER(void, do_mtc0_tccontext, (target_ulong t0))
DEF_HELPER(void, do_mttc0_tccontext, (target_ulong t0))
DEF_HELPER(void, do_mtc0_tcschedule, (target_ulong t0))
DEF_HELPER(void, do_mttc0_tcschedule, (target_ulong t0))
DEF_HELPER(void, do_mtc0_tcschefback, (target_ulong t0))
DEF_HELPER(void, do_mttc0_tcschefback, (target_ulong t0))
DEF_HELPER(void, do_mtc0_entrylo1, (target_ulong t0))
DEF_HELPER(void, do_mtc0_context, (target_ulong t0))
DEF_HELPER(void, do_mtc0_pagemask, (target_ulong t0))
DEF_HELPER(void, do_mtc0_pagegrain, (target_ulong t0))
DEF_HELPER(void, do_mtc0_wired, (target_ulong t0))
DEF_HELPER(void, do_mtc0_srsconf0, (target_ulong t0))
DEF_HELPER(void, do_mtc0_srsconf1, (target_ulong t0))
DEF_HELPER(void, do_mtc0_srsconf2, (target_ulong t0))
DEF_HELPER(void, do_mtc0_srsconf3, (target_ulong t0))
DEF_HELPER(void, do_mtc0_srsconf4, (target_ulong t0))
DEF_HELPER(void, do_mtc0_hwrena, (target_ulong t0))
DEF_HELPER(void, do_mtc0_count, (target_ulong t0))
DEF_HELPER(void, do_mtc0_entryhi, (target_ulong t0))
DEF_HELPER(void, do_mttc0_entryhi, (target_ulong t0))
DEF_HELPER(void, do_mtc0_compare, (target_ulong t0))
DEF_HELPER(void, do_mtc0_status, (target_ulong t0))
DEF_HELPER(void, do_mttc0_status, (target_ulong t0))
DEF_HELPER(void, do_mtc0_intctl, (target_ulong t0))
DEF_HELPER(void, do_mtc0_srsctl, (target_ulong t0))
DEF_HELPER(void, do_mtc0_cause, (target_ulong t0))
DEF_HELPER(void, do_mtc0_ebase, (target_ulong t0))
DEF_HELPER(void, do_mtc0_config0, (target_ulong t0))
DEF_HELPER(void, do_mtc0_config2, (target_ulong t0))
DEF_HELPER(void, do_mtc0_watchlo, (target_ulong t0, uint32_t sel))
DEF_HELPER(void, do_mtc0_watchhi, (target_ulong t0, uint32_t sel))
DEF_HELPER(void, do_mtc0_xcontext, (target_ulong t0))
DEF_HELPER(void, do_mtc0_framemask, (target_ulong t0))
DEF_HELPER(void, do_mtc0_debug, (target_ulong t0))
DEF_HELPER(void, do_mttc0_debug, (target_ulong t0))
DEF_HELPER(void, do_mtc0_performance0, (target_ulong t0))
DEF_HELPER(void, do_mtc0_taglo, (target_ulong t0))
DEF_HELPER(void, do_mtc0_datalo, (target_ulong t0))
DEF_HELPER(void, do_mtc0_taghi, (target_ulong t0))
DEF_HELPER(void, do_mtc0_datahi, (target_ulong t0))
138 139 140
#endif /* !CONFIG_USER_ONLY */

/* MIPS MT functions */
141 142 143 144 145 146 147 148 149 150 151 152 153 154
DEF_HELPER(target_ulong, do_mftgpr, (target_ulong t0, uint32_t sel))
DEF_HELPER(target_ulong, do_mftlo, (target_ulong t0, uint32_t sel))
DEF_HELPER(target_ulong, do_mfthi, (target_ulong t0, uint32_t sel))
DEF_HELPER(target_ulong, do_mftacx, (target_ulong t0, uint32_t sel))
DEF_HELPER(target_ulong, do_mftdsp, (target_ulong t0))
DEF_HELPER(void, do_mttgpr, (target_ulong t0, uint32_t sel))
DEF_HELPER(void, do_mttlo, (target_ulong t0, uint32_t sel))
DEF_HELPER(void, do_mtthi, (target_ulong t0, uint32_t sel))
DEF_HELPER(void, do_mttacx, (target_ulong t0, uint32_t sel))
DEF_HELPER(void, do_mttdsp, (target_ulong t0))
DEF_HELPER(target_ulong, do_dmt, (target_ulong t0))
DEF_HELPER(target_ulong, do_emt, (target_ulong t0))
DEF_HELPER(target_ulong, do_dvpe, (target_ulong t0))
DEF_HELPER(target_ulong, do_evpe, (target_ulong t0))
155
DEF_HELPER(void, do_fork, (target_ulong t0, target_ulong t1))
156
DEF_HELPER(target_ulong, do_yield, (target_ulong t0))
157 158

/* CP1 functions */
159
DEF_HELPER(target_ulong, do_cfc1, (uint32_t reg))
160
DEF_HELPER(void, do_ctc1, (target_ulong t0, uint32_t reg))
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182

DEF_HELPER(void, do_float_cvtd_s, (void))
DEF_HELPER(void, do_float_cvtd_w, (void))
DEF_HELPER(void, do_float_cvtd_l, (void))
DEF_HELPER(void, do_float_cvtl_d, (void))
DEF_HELPER(void, do_float_cvtl_s, (void))
DEF_HELPER(void, do_float_cvtps_pw, (void))
DEF_HELPER(void, do_float_cvtpw_ps, (void))
DEF_HELPER(void, do_float_cvts_d, (void))
DEF_HELPER(void, do_float_cvts_w, (void))
DEF_HELPER(void, do_float_cvts_l, (void))
DEF_HELPER(void, do_float_cvts_pl, (void))
DEF_HELPER(void, do_float_cvts_pu, (void))
DEF_HELPER(void, do_float_cvtw_s, (void))
DEF_HELPER(void, do_float_cvtw_d, (void))

DEF_HELPER(void, do_float_addr_ps, (void))
DEF_HELPER(void, do_float_mulr_ps, (void))

#define FOP_PROTO(op)                            \
DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
DEF_HELPER(void, do_float_ ## op ## _d, (void))
183
FOP_PROTO(sqrt)
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
FOP_PROTO(roundl)
FOP_PROTO(roundw)
FOP_PROTO(truncl)
FOP_PROTO(truncw)
FOP_PROTO(ceill)
FOP_PROTO(ceilw)
FOP_PROTO(floorl)
FOP_PROTO(floorw)
FOP_PROTO(rsqrt)
FOP_PROTO(recip)
#undef FOP_PROTO

#define FOP_PROTO(op)                            \
DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
DEF_HELPER(void, do_float_ ## op ## _d, (void))  \
DEF_HELPER(void, do_float_ ## op ## _ps, (void))
FOP_PROTO(add)
FOP_PROTO(sub)
FOP_PROTO(mul)
FOP_PROTO(div)
204 205 206 207 208 209
FOP_PROTO(abs)
FOP_PROTO(chs)
FOP_PROTO(muladd)
FOP_PROTO(mulsub)
FOP_PROTO(nmuladd)
FOP_PROTO(nmulsub)
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
FOP_PROTO(recip1)
FOP_PROTO(recip2)
FOP_PROTO(rsqrt1)
FOP_PROTO(rsqrt2)
#undef FOP_PROTO

#define FOP_PROTO(op)                            \
DEF_HELPER(void, do_cmp_d_ ## op, (long cc))     \
DEF_HELPER(void, do_cmpabs_d_ ## op, (long cc))  \
DEF_HELPER(void, do_cmp_s_ ## op, (long cc))     \
DEF_HELPER(void, do_cmpabs_s_ ## op, (long cc))  \
DEF_HELPER(void, do_cmp_ps_ ## op, (long cc))    \
DEF_HELPER(void, do_cmpabs_ps_ ## op, (long cc))
FOP_PROTO(f)
FOP_PROTO(un)
FOP_PROTO(eq)
FOP_PROTO(ueq)
FOP_PROTO(olt)
FOP_PROTO(ult)
FOP_PROTO(ole)
FOP_PROTO(ule)
FOP_PROTO(sf)
FOP_PROTO(ngle)
FOP_PROTO(seq)
FOP_PROTO(ngl)
FOP_PROTO(lt)
FOP_PROTO(nge)
FOP_PROTO(le)
FOP_PROTO(ngt)
#undef FOP_PROTO
T
ths 已提交
240 241

/* Special functions */
242 243
DEF_HELPER(target_ulong, do_di, (target_ulong t0))
DEF_HELPER(target_ulong, do_ei, (target_ulong t0))
244 245
DEF_HELPER(void, do_eret, (void))
DEF_HELPER(void, do_deret, (void))
246 247 248 249
DEF_HELPER(target_ulong, do_rdhwr_cpunum, (target_ulong t0))
DEF_HELPER(target_ulong, do_rdhwr_synci_step, (target_ulong t0))
DEF_HELPER(target_ulong, do_rdhwr_cc, (target_ulong t0))
DEF_HELPER(target_ulong, do_rdhwr_ccres, (target_ulong t0))
T
ths 已提交
250 251
DEF_HELPER(void, do_pmon, (int function))
DEF_HELPER(void, do_wait, (void))
252 253

/* Bitfield operations. */
254 255 256
DEF_HELPER(target_ulong, do_ext, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
DEF_HELPER(target_ulong, do_ins, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
DEF_HELPER(target_ulong, do_wsbh, (target_ulong t0, target_ulong t1))
257
#ifdef TARGET_MIPS64
258 259 260 261
DEF_HELPER(target_ulong, do_dext, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
DEF_HELPER(target_ulong, do_dins, (target_ulong t0, target_ulong t1, uint32_t pos, uint32_t size))
DEF_HELPER(target_ulong, do_dsbh, (target_ulong t0, target_ulong t1))
DEF_HELPER(target_ulong, do_dshd, (target_ulong t0, target_ulong t1))
262
#endif