xref: /qemu/target/mips/helper.h (revision c8c2227e913e5a41cc44746e22ad73e9880c06fb)
17dd9e556Sths #ifndef DEF_HELPER
27dd9e556Sths #define DEF_HELPER(ret, name, params) ret name params;
37dd9e556Sths #endif
430898801Sths 
57dd9e556Sths DEF_HELPER(void, do_raise_exception_err, (int excp, int err))
67dd9e556Sths DEF_HELPER(void, do_raise_exception, (int excp))
77dd9e556Sths DEF_HELPER(void, do_interrupt_restart, (void))
87dd9e556Sths 
9c8c2227eSths #ifdef TARGET_MIPS64
10c8c2227eSths DEF_HELPER(void, do_ldl, (int mem_idx))
11c8c2227eSths DEF_HELPER(void, do_ldr, (int mem_idx))
12c8c2227eSths DEF_HELPER(void, do_sdl, (int mem_idx))
13c8c2227eSths DEF_HELPER(void, do_sdr, (int mem_idx))
14c8c2227eSths #endif
15c8c2227eSths DEF_HELPER(void, do_lwl, (int mem_idx))
16c8c2227eSths DEF_HELPER(void, do_lwr, (int mem_idx))
17c8c2227eSths DEF_HELPER(void, do_swl, (int mem_idx))
18c8c2227eSths DEF_HELPER(void, do_swr, (int mem_idx))
19c8c2227eSths 
207dd9e556Sths DEF_HELPER(void, do_clo, (void))
217dd9e556Sths DEF_HELPER(void, do_clz, (void))
227dd9e556Sths #ifdef TARGET_MIPS64
237dd9e556Sths DEF_HELPER(void, do_dclo, (void))
247dd9e556Sths DEF_HELPER(void, do_dclz, (void))
25214c465fSths DEF_HELPER(void, do_dmult, (void))
26214c465fSths DEF_HELPER(void, do_dmultu, (void))
277dd9e556Sths #endif
28f1aa6320Sths 
2992af06d2Sths DEF_HELPER(void, do_muls, (void))
3092af06d2Sths DEF_HELPER(void, do_mulsu, (void))
3192af06d2Sths DEF_HELPER(void, do_macc, (void))
3292af06d2Sths DEF_HELPER(void, do_maccu, (void))
3392af06d2Sths DEF_HELPER(void, do_msac, (void))
3492af06d2Sths DEF_HELPER(void, do_msacu, (void))
3592af06d2Sths DEF_HELPER(void, do_mulhi, (void))
3692af06d2Sths DEF_HELPER(void, do_mulhiu, (void))
3792af06d2Sths DEF_HELPER(void, do_mulshi, (void))
3892af06d2Sths DEF_HELPER(void, do_mulshiu, (void))
3992af06d2Sths DEF_HELPER(void, do_macchi, (void))
4092af06d2Sths DEF_HELPER(void, do_macchiu, (void))
4192af06d2Sths DEF_HELPER(void, do_msachi, (void))
4292af06d2Sths DEF_HELPER(void, do_msachiu, (void))
4392af06d2Sths 
44f1aa6320Sths /* CP0 helpers */
45f1aa6320Sths #ifndef CONFIG_USER_ONLY
46f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpcontrol, (void))
47f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpconf0, (void))
48f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpconf1, (void))
49f1aa6320Sths DEF_HELPER(void, do_mfc0_random, (void))
50f1aa6320Sths DEF_HELPER(void, do_mfc0_tcstatus, (void))
51f1aa6320Sths DEF_HELPER(void, do_mftc0_tcstatus, (void))
52f1aa6320Sths DEF_HELPER(void, do_mfc0_tcbind, (void))
53f1aa6320Sths DEF_HELPER(void, do_mftc0_tcbind, (void))
54f1aa6320Sths DEF_HELPER(void, do_mfc0_tcrestart, (void))
55f1aa6320Sths DEF_HELPER(void, do_mftc0_tcrestart, (void))
56f1aa6320Sths DEF_HELPER(void, do_mfc0_tchalt, (void))
57f1aa6320Sths DEF_HELPER(void, do_mftc0_tchalt, (void))
58f1aa6320Sths DEF_HELPER(void, do_mfc0_tccontext, (void))
59f1aa6320Sths DEF_HELPER(void, do_mftc0_tccontext, (void))
60f1aa6320Sths DEF_HELPER(void, do_mfc0_tcschedule, (void))
61f1aa6320Sths DEF_HELPER(void, do_mftc0_tcschedule, (void))
62f1aa6320Sths DEF_HELPER(void, do_mfc0_tcschefback, (void))
63f1aa6320Sths DEF_HELPER(void, do_mftc0_tcschefback, (void))
64f1aa6320Sths DEF_HELPER(void, do_mfc0_count, (void))
65f1aa6320Sths DEF_HELPER(void, do_mftc0_entryhi, (void))
66f1aa6320Sths DEF_HELPER(void, do_mftc0_status, (void))
67f1aa6320Sths DEF_HELPER(void, do_mfc0_lladdr, (void))
68f1aa6320Sths DEF_HELPER(void, do_mfc0_watchlo, (uint32_t sel))
69f1aa6320Sths DEF_HELPER(void, do_mfc0_watchhi, (uint32_t sel))
70f1aa6320Sths DEF_HELPER(void, do_mfc0_debug, (void))
71f1aa6320Sths DEF_HELPER(void, do_mftc0_debug, (void))
72f1aa6320Sths #ifdef TARGET_MIPS64
73f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcrestart, (void))
74f1aa6320Sths DEF_HELPER(void, do_dmfc0_tchalt, (void))
75f1aa6320Sths DEF_HELPER(void, do_dmfc0_tccontext, (void))
76f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcschedule, (void))
77f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcschefback, (void))
78f1aa6320Sths DEF_HELPER(void, do_dmfc0_lladdr, (void))
79f1aa6320Sths DEF_HELPER(void, do_dmfc0_watchlo, (uint32_t sel))
80f1aa6320Sths #endif /* TARGET_MIPS64 */
81f1aa6320Sths 
82f1aa6320Sths DEF_HELPER(void, do_mtc0_index, (void))
83f1aa6320Sths DEF_HELPER(void, do_mtc0_mvpcontrol, (void))
84f1aa6320Sths DEF_HELPER(void, do_mtc0_vpecontrol, (void))
85f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeconf0, (void))
86f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeconf1, (void))
87f1aa6320Sths DEF_HELPER(void, do_mtc0_yqmask, (void))
88f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeopt, (void))
89f1aa6320Sths DEF_HELPER(void, do_mtc0_entrylo0, (void))
90f1aa6320Sths DEF_HELPER(void, do_mtc0_tcstatus, (void))
91f1aa6320Sths DEF_HELPER(void, do_mttc0_tcstatus, (void))
92f1aa6320Sths DEF_HELPER(void, do_mtc0_tcbind, (void))
93f1aa6320Sths DEF_HELPER(void, do_mttc0_tcbind, (void))
94f1aa6320Sths DEF_HELPER(void, do_mtc0_tcrestart, (void))
95f1aa6320Sths DEF_HELPER(void, do_mttc0_tcrestart, (void))
96f1aa6320Sths DEF_HELPER(void, do_mtc0_tchalt, (void))
97f1aa6320Sths DEF_HELPER(void, do_mttc0_tchalt, (void))
98f1aa6320Sths DEF_HELPER(void, do_mtc0_tccontext, (void))
99f1aa6320Sths DEF_HELPER(void, do_mttc0_tccontext, (void))
100f1aa6320Sths DEF_HELPER(void, do_mtc0_tcschedule, (void))
101f1aa6320Sths DEF_HELPER(void, do_mttc0_tcschedule, (void))
102f1aa6320Sths DEF_HELPER(void, do_mtc0_tcschefback, (void))
103f1aa6320Sths DEF_HELPER(void, do_mttc0_tcschefback, (void))
104f1aa6320Sths DEF_HELPER(void, do_mtc0_entrylo1, (void))
105f1aa6320Sths DEF_HELPER(void, do_mtc0_context, (void))
106f1aa6320Sths DEF_HELPER(void, do_mtc0_pagemask, (void))
107f1aa6320Sths DEF_HELPER(void, do_mtc0_pagegrain, (void))
108f1aa6320Sths DEF_HELPER(void, do_mtc0_wired, (void))
109f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf0, (void))
110f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf1, (void))
111f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf2, (void))
112f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf3, (void))
113f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf4, (void))
114f1aa6320Sths DEF_HELPER(void, do_mtc0_hwrena, (void))
115f1aa6320Sths DEF_HELPER(void, do_mtc0_count, (void))
116f1aa6320Sths DEF_HELPER(void, do_mtc0_entryhi, (void))
117f1aa6320Sths DEF_HELPER(void, do_mttc0_entryhi, (void))
118f1aa6320Sths DEF_HELPER(void, do_mtc0_compare, (void))
119f1aa6320Sths DEF_HELPER(void, do_mtc0_status, (void))
120f1aa6320Sths DEF_HELPER(void, do_mttc0_status, (void))
121f1aa6320Sths DEF_HELPER(void, do_mtc0_intctl, (void))
122f1aa6320Sths DEF_HELPER(void, do_mtc0_srsctl, (void))
123f1aa6320Sths DEF_HELPER(void, do_mtc0_cause, (void))
124f1aa6320Sths DEF_HELPER(void, do_mtc0_ebase, (void))
125f1aa6320Sths DEF_HELPER(void, do_mtc0_config0, (void))
126f1aa6320Sths DEF_HELPER(void, do_mtc0_config2, (void))
127f1aa6320Sths DEF_HELPER(void, do_mtc0_watchlo, (uint32_t sel))
128f1aa6320Sths DEF_HELPER(void, do_mtc0_watchhi, (uint32_t sel))
129f1aa6320Sths DEF_HELPER(void, do_mtc0_xcontext, (void))
130f1aa6320Sths DEF_HELPER(void, do_mtc0_framemask, (void))
131f1aa6320Sths DEF_HELPER(void, do_mtc0_debug, (void))
132f1aa6320Sths DEF_HELPER(void, do_mttc0_debug, (void))
133f1aa6320Sths DEF_HELPER(void, do_mtc0_performance0, (void))
134f1aa6320Sths DEF_HELPER(void, do_mtc0_taglo, (void))
135f1aa6320Sths DEF_HELPER(void, do_mtc0_datalo, (void))
136f1aa6320Sths DEF_HELPER(void, do_mtc0_taghi, (void))
137f1aa6320Sths DEF_HELPER(void, do_mtc0_datahi, (void))
138f1aa6320Sths #endif /* !CONFIG_USER_ONLY */
139f1aa6320Sths 
140f1aa6320Sths /* MIPS MT functions */
141f1aa6320Sths DEF_HELPER(void, do_mftgpr, (uint32_t sel))
142f1aa6320Sths DEF_HELPER(void, do_mftlo, (uint32_t sel))
143f1aa6320Sths DEF_HELPER(void, do_mfthi, (uint32_t sel))
144f1aa6320Sths DEF_HELPER(void, do_mftacx, (uint32_t sel))
145f1aa6320Sths DEF_HELPER(void, do_mftdsp, (void))
146f1aa6320Sths DEF_HELPER(void, do_mttgpr, (uint32_t sel))
147f1aa6320Sths DEF_HELPER(void, do_mttlo, (uint32_t sel))
148f1aa6320Sths DEF_HELPER(void, do_mtthi, (uint32_t sel))
149f1aa6320Sths DEF_HELPER(void, do_mttacx, (uint32_t sel))
150f1aa6320Sths DEF_HELPER(void, do_mttdsp, (void))
151f1aa6320Sths DEF_HELPER(void, do_dmt, (void))
152f1aa6320Sths DEF_HELPER(void, do_emt, (void))
153f1aa6320Sths DEF_HELPER(void, do_dvpe, (void))
154f1aa6320Sths DEF_HELPER(void, do_evpe, (void))
155f1aa6320Sths DEF_HELPER(void, do_fork, (void))
156f1aa6320Sths DEF_HELPER(void, do_yield, (void))
157f1aa6320Sths 
158f1aa6320Sths /* CP1 functions */
159f1aa6320Sths DEF_HELPER(void, do_cfc1, (uint32_t reg))
160f1aa6320Sths DEF_HELPER(void, do_ctc1, (uint32_t reg))
1615d0fc900Sths 
1625d0fc900Sths DEF_HELPER(void, do_float_cvtd_s, (void))
1635d0fc900Sths DEF_HELPER(void, do_float_cvtd_w, (void))
1645d0fc900Sths DEF_HELPER(void, do_float_cvtd_l, (void))
1655d0fc900Sths DEF_HELPER(void, do_float_cvtl_d, (void))
1665d0fc900Sths DEF_HELPER(void, do_float_cvtl_s, (void))
1675d0fc900Sths DEF_HELPER(void, do_float_cvtps_pw, (void))
1685d0fc900Sths DEF_HELPER(void, do_float_cvtpw_ps, (void))
1695d0fc900Sths DEF_HELPER(void, do_float_cvts_d, (void))
1705d0fc900Sths DEF_HELPER(void, do_float_cvts_w, (void))
1715d0fc900Sths DEF_HELPER(void, do_float_cvts_l, (void))
1725d0fc900Sths DEF_HELPER(void, do_float_cvts_pl, (void))
1735d0fc900Sths DEF_HELPER(void, do_float_cvts_pu, (void))
1745d0fc900Sths DEF_HELPER(void, do_float_cvtw_s, (void))
1755d0fc900Sths DEF_HELPER(void, do_float_cvtw_d, (void))
1765d0fc900Sths 
1775d0fc900Sths DEF_HELPER(void, do_float_addr_ps, (void))
1785d0fc900Sths DEF_HELPER(void, do_float_mulr_ps, (void))
1795d0fc900Sths 
1805d0fc900Sths #define FOP_PROTO(op)                            \
1815d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
1825d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _d, (void))
183a16336e4Sths FOP_PROTO(sqrt)
1845d0fc900Sths FOP_PROTO(roundl)
1855d0fc900Sths FOP_PROTO(roundw)
1865d0fc900Sths FOP_PROTO(truncl)
1875d0fc900Sths FOP_PROTO(truncw)
1885d0fc900Sths FOP_PROTO(ceill)
1895d0fc900Sths FOP_PROTO(ceilw)
1905d0fc900Sths FOP_PROTO(floorl)
1915d0fc900Sths FOP_PROTO(floorw)
1925d0fc900Sths FOP_PROTO(rsqrt)
1935d0fc900Sths FOP_PROTO(recip)
1945d0fc900Sths #undef FOP_PROTO
1955d0fc900Sths 
1965d0fc900Sths #define FOP_PROTO(op)                            \
1975d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
1985d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _d, (void))  \
1995d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _ps, (void))
2005d0fc900Sths FOP_PROTO(add)
2015d0fc900Sths FOP_PROTO(sub)
2025d0fc900Sths FOP_PROTO(mul)
2035d0fc900Sths FOP_PROTO(div)
204a16336e4Sths FOP_PROTO(abs)
205a16336e4Sths FOP_PROTO(chs)
206a16336e4Sths FOP_PROTO(muladd)
207a16336e4Sths FOP_PROTO(mulsub)
208a16336e4Sths FOP_PROTO(nmuladd)
209a16336e4Sths FOP_PROTO(nmulsub)
2105d0fc900Sths FOP_PROTO(recip1)
2115d0fc900Sths FOP_PROTO(recip2)
2125d0fc900Sths FOP_PROTO(rsqrt1)
2135d0fc900Sths FOP_PROTO(rsqrt2)
2145d0fc900Sths #undef FOP_PROTO
2155d0fc900Sths 
2165d0fc900Sths #define FOP_PROTO(op)                            \
2175d0fc900Sths DEF_HELPER(void, do_cmp_d_ ## op, (long cc))     \
2185d0fc900Sths DEF_HELPER(void, do_cmpabs_d_ ## op, (long cc))  \
2195d0fc900Sths DEF_HELPER(void, do_cmp_s_ ## op, (long cc))     \
2205d0fc900Sths DEF_HELPER(void, do_cmpabs_s_ ## op, (long cc))  \
2215d0fc900Sths DEF_HELPER(void, do_cmp_ps_ ## op, (long cc))    \
2225d0fc900Sths DEF_HELPER(void, do_cmpabs_ps_ ## op, (long cc))
2235d0fc900Sths FOP_PROTO(f)
2245d0fc900Sths FOP_PROTO(un)
2255d0fc900Sths FOP_PROTO(eq)
2265d0fc900Sths FOP_PROTO(ueq)
2275d0fc900Sths FOP_PROTO(olt)
2285d0fc900Sths FOP_PROTO(ult)
2295d0fc900Sths FOP_PROTO(ole)
2305d0fc900Sths FOP_PROTO(ule)
2315d0fc900Sths FOP_PROTO(sf)
2325d0fc900Sths FOP_PROTO(ngle)
2335d0fc900Sths FOP_PROTO(seq)
2345d0fc900Sths FOP_PROTO(ngl)
2355d0fc900Sths FOP_PROTO(lt)
2365d0fc900Sths FOP_PROTO(nge)
2375d0fc900Sths FOP_PROTO(le)
2385d0fc900Sths FOP_PROTO(ngt)
2395d0fc900Sths #undef FOP_PROTO
24008ba7963Sths 
24108ba7963Sths /* Special functions */
2422b0233abSths DEF_HELPER(void, do_di, (void))
2432b0233abSths DEF_HELPER(void, do_ei, (void))
2442b0233abSths DEF_HELPER(void, do_eret, (void))
2452b0233abSths DEF_HELPER(void, do_deret, (void))
2462b0233abSths DEF_HELPER(void, do_rdhwr_cpunum, (void))
2472b0233abSths DEF_HELPER(void, do_rdhwr_synci_step, (void))
2482b0233abSths DEF_HELPER(void, do_rdhwr_cc, (void))
2492b0233abSths DEF_HELPER(void, do_rdhwr_ccres, (void))
25008ba7963Sths DEF_HELPER(void, do_pmon, (int function))
25108ba7963Sths DEF_HELPER(void, do_wait, (void))
2522b0233abSths 
2532b0233abSths /* Bitfield operations. */
2542b0233abSths DEF_HELPER(void, do_ext, (uint32_t pos, uint32_t size))
2552b0233abSths DEF_HELPER(void, do_ins, (uint32_t pos, uint32_t size))
2562b0233abSths DEF_HELPER(void, do_wsbh, (void))
2572b0233abSths #ifdef TARGET_MIPS64
2582b0233abSths DEF_HELPER(void, do_dext, (uint32_t pos, uint32_t size))
2592b0233abSths DEF_HELPER(void, do_dins, (uint32_t pos, uint32_t size))
2602b0233abSths DEF_HELPER(void, do_dsbh, (void))
2612b0233abSths DEF_HELPER(void, do_dshd, (void))
2622b0233abSths #endif
263