xref: /qemu/target/mips/helper.h (revision 92af06d216857de77bcadaf86cf9675cce9f1d3c)
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 
97dd9e556Sths DEF_HELPER(void, do_clo, (void))
107dd9e556Sths DEF_HELPER(void, do_clz, (void))
117dd9e556Sths #ifdef TARGET_MIPS64
127dd9e556Sths DEF_HELPER(void, do_dclo, (void))
137dd9e556Sths DEF_HELPER(void, do_dclz, (void))
14214c465fSths DEF_HELPER(void, do_dmult, (void))
15214c465fSths DEF_HELPER(void, do_dmultu, (void))
167dd9e556Sths #endif
17f1aa6320Sths 
1892af06d2Sths DEF_HELPER(void, do_muls, (void))
1992af06d2Sths DEF_HELPER(void, do_mulsu, (void))
2092af06d2Sths DEF_HELPER(void, do_macc, (void))
2192af06d2Sths DEF_HELPER(void, do_maccu, (void))
2292af06d2Sths DEF_HELPER(void, do_msac, (void))
2392af06d2Sths DEF_HELPER(void, do_msacu, (void))
2492af06d2Sths DEF_HELPER(void, do_mulhi, (void))
2592af06d2Sths DEF_HELPER(void, do_mulhiu, (void))
2692af06d2Sths DEF_HELPER(void, do_mulshi, (void))
2792af06d2Sths DEF_HELPER(void, do_mulshiu, (void))
2892af06d2Sths DEF_HELPER(void, do_macchi, (void))
2992af06d2Sths DEF_HELPER(void, do_macchiu, (void))
3092af06d2Sths DEF_HELPER(void, do_msachi, (void))
3192af06d2Sths DEF_HELPER(void, do_msachiu, (void))
3292af06d2Sths 
33f1aa6320Sths /* CP0 helpers */
34f1aa6320Sths #ifndef CONFIG_USER_ONLY
35f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpcontrol, (void))
36f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpconf0, (void))
37f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpconf1, (void))
38f1aa6320Sths DEF_HELPER(void, do_mfc0_random, (void))
39f1aa6320Sths DEF_HELPER(void, do_mfc0_tcstatus, (void))
40f1aa6320Sths DEF_HELPER(void, do_mftc0_tcstatus, (void))
41f1aa6320Sths DEF_HELPER(void, do_mfc0_tcbind, (void))
42f1aa6320Sths DEF_HELPER(void, do_mftc0_tcbind, (void))
43f1aa6320Sths DEF_HELPER(void, do_mfc0_tcrestart, (void))
44f1aa6320Sths DEF_HELPER(void, do_mftc0_tcrestart, (void))
45f1aa6320Sths DEF_HELPER(void, do_mfc0_tchalt, (void))
46f1aa6320Sths DEF_HELPER(void, do_mftc0_tchalt, (void))
47f1aa6320Sths DEF_HELPER(void, do_mfc0_tccontext, (void))
48f1aa6320Sths DEF_HELPER(void, do_mftc0_tccontext, (void))
49f1aa6320Sths DEF_HELPER(void, do_mfc0_tcschedule, (void))
50f1aa6320Sths DEF_HELPER(void, do_mftc0_tcschedule, (void))
51f1aa6320Sths DEF_HELPER(void, do_mfc0_tcschefback, (void))
52f1aa6320Sths DEF_HELPER(void, do_mftc0_tcschefback, (void))
53f1aa6320Sths DEF_HELPER(void, do_mfc0_count, (void))
54f1aa6320Sths DEF_HELPER(void, do_mftc0_entryhi, (void))
55f1aa6320Sths DEF_HELPER(void, do_mftc0_status, (void))
56f1aa6320Sths DEF_HELPER(void, do_mfc0_lladdr, (void))
57f1aa6320Sths DEF_HELPER(void, do_mfc0_watchlo, (uint32_t sel))
58f1aa6320Sths DEF_HELPER(void, do_mfc0_watchhi, (uint32_t sel))
59f1aa6320Sths DEF_HELPER(void, do_mfc0_debug, (void))
60f1aa6320Sths DEF_HELPER(void, do_mftc0_debug, (void))
61f1aa6320Sths #ifdef TARGET_MIPS64
62f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcrestart, (void))
63f1aa6320Sths DEF_HELPER(void, do_dmfc0_tchalt, (void))
64f1aa6320Sths DEF_HELPER(void, do_dmfc0_tccontext, (void))
65f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcschedule, (void))
66f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcschefback, (void))
67f1aa6320Sths DEF_HELPER(void, do_dmfc0_lladdr, (void))
68f1aa6320Sths DEF_HELPER(void, do_dmfc0_watchlo, (uint32_t sel))
69f1aa6320Sths #endif /* TARGET_MIPS64 */
70f1aa6320Sths 
71f1aa6320Sths DEF_HELPER(void, do_mtc0_index, (void))
72f1aa6320Sths DEF_HELPER(void, do_mtc0_mvpcontrol, (void))
73f1aa6320Sths DEF_HELPER(void, do_mtc0_vpecontrol, (void))
74f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeconf0, (void))
75f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeconf1, (void))
76f1aa6320Sths DEF_HELPER(void, do_mtc0_yqmask, (void))
77f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeopt, (void))
78f1aa6320Sths DEF_HELPER(void, do_mtc0_entrylo0, (void))
79f1aa6320Sths DEF_HELPER(void, do_mtc0_tcstatus, (void))
80f1aa6320Sths DEF_HELPER(void, do_mttc0_tcstatus, (void))
81f1aa6320Sths DEF_HELPER(void, do_mtc0_tcbind, (void))
82f1aa6320Sths DEF_HELPER(void, do_mttc0_tcbind, (void))
83f1aa6320Sths DEF_HELPER(void, do_mtc0_tcrestart, (void))
84f1aa6320Sths DEF_HELPER(void, do_mttc0_tcrestart, (void))
85f1aa6320Sths DEF_HELPER(void, do_mtc0_tchalt, (void))
86f1aa6320Sths DEF_HELPER(void, do_mttc0_tchalt, (void))
87f1aa6320Sths DEF_HELPER(void, do_mtc0_tccontext, (void))
88f1aa6320Sths DEF_HELPER(void, do_mttc0_tccontext, (void))
89f1aa6320Sths DEF_HELPER(void, do_mtc0_tcschedule, (void))
90f1aa6320Sths DEF_HELPER(void, do_mttc0_tcschedule, (void))
91f1aa6320Sths DEF_HELPER(void, do_mtc0_tcschefback, (void))
92f1aa6320Sths DEF_HELPER(void, do_mttc0_tcschefback, (void))
93f1aa6320Sths DEF_HELPER(void, do_mtc0_entrylo1, (void))
94f1aa6320Sths DEF_HELPER(void, do_mtc0_context, (void))
95f1aa6320Sths DEF_HELPER(void, do_mtc0_pagemask, (void))
96f1aa6320Sths DEF_HELPER(void, do_mtc0_pagegrain, (void))
97f1aa6320Sths DEF_HELPER(void, do_mtc0_wired, (void))
98f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf0, (void))
99f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf1, (void))
100f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf2, (void))
101f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf3, (void))
102f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf4, (void))
103f1aa6320Sths DEF_HELPER(void, do_mtc0_hwrena, (void))
104f1aa6320Sths DEF_HELPER(void, do_mtc0_count, (void))
105f1aa6320Sths DEF_HELPER(void, do_mtc0_entryhi, (void))
106f1aa6320Sths DEF_HELPER(void, do_mttc0_entryhi, (void))
107f1aa6320Sths DEF_HELPER(void, do_mtc0_compare, (void))
108f1aa6320Sths DEF_HELPER(void, do_mtc0_status, (void))
109f1aa6320Sths DEF_HELPER(void, do_mttc0_status, (void))
110f1aa6320Sths DEF_HELPER(void, do_mtc0_intctl, (void))
111f1aa6320Sths DEF_HELPER(void, do_mtc0_srsctl, (void))
112f1aa6320Sths DEF_HELPER(void, do_mtc0_cause, (void))
113f1aa6320Sths DEF_HELPER(void, do_mtc0_ebase, (void))
114f1aa6320Sths DEF_HELPER(void, do_mtc0_config0, (void))
115f1aa6320Sths DEF_HELPER(void, do_mtc0_config2, (void))
116f1aa6320Sths DEF_HELPER(void, do_mtc0_watchlo, (uint32_t sel))
117f1aa6320Sths DEF_HELPER(void, do_mtc0_watchhi, (uint32_t sel))
118f1aa6320Sths DEF_HELPER(void, do_mtc0_xcontext, (void))
119f1aa6320Sths DEF_HELPER(void, do_mtc0_framemask, (void))
120f1aa6320Sths DEF_HELPER(void, do_mtc0_debug, (void))
121f1aa6320Sths DEF_HELPER(void, do_mttc0_debug, (void))
122f1aa6320Sths DEF_HELPER(void, do_mtc0_performance0, (void))
123f1aa6320Sths DEF_HELPER(void, do_mtc0_taglo, (void))
124f1aa6320Sths DEF_HELPER(void, do_mtc0_datalo, (void))
125f1aa6320Sths DEF_HELPER(void, do_mtc0_taghi, (void))
126f1aa6320Sths DEF_HELPER(void, do_mtc0_datahi, (void))
127f1aa6320Sths #endif /* !CONFIG_USER_ONLY */
128f1aa6320Sths 
129f1aa6320Sths /* MIPS MT functions */
130f1aa6320Sths DEF_HELPER(void, do_mftgpr, (uint32_t sel))
131f1aa6320Sths DEF_HELPER(void, do_mftlo, (uint32_t sel))
132f1aa6320Sths DEF_HELPER(void, do_mfthi, (uint32_t sel))
133f1aa6320Sths DEF_HELPER(void, do_mftacx, (uint32_t sel))
134f1aa6320Sths DEF_HELPER(void, do_mftdsp, (void))
135f1aa6320Sths DEF_HELPER(void, do_mttgpr, (uint32_t sel))
136f1aa6320Sths DEF_HELPER(void, do_mttlo, (uint32_t sel))
137f1aa6320Sths DEF_HELPER(void, do_mtthi, (uint32_t sel))
138f1aa6320Sths DEF_HELPER(void, do_mttacx, (uint32_t sel))
139f1aa6320Sths DEF_HELPER(void, do_mttdsp, (void))
140f1aa6320Sths DEF_HELPER(void, do_dmt, (void))
141f1aa6320Sths DEF_HELPER(void, do_emt, (void))
142f1aa6320Sths DEF_HELPER(void, do_dvpe, (void))
143f1aa6320Sths DEF_HELPER(void, do_evpe, (void))
144f1aa6320Sths DEF_HELPER(void, do_fork, (void))
145f1aa6320Sths DEF_HELPER(void, do_yield, (void))
146f1aa6320Sths 
147f1aa6320Sths /* CP1 functions */
148f1aa6320Sths DEF_HELPER(void, do_cfc1, (uint32_t reg))
149f1aa6320Sths DEF_HELPER(void, do_ctc1, (uint32_t reg))
1505d0fc900Sths 
1515d0fc900Sths DEF_HELPER(void, do_float_cvtd_s, (void))
1525d0fc900Sths DEF_HELPER(void, do_float_cvtd_w, (void))
1535d0fc900Sths DEF_HELPER(void, do_float_cvtd_l, (void))
1545d0fc900Sths DEF_HELPER(void, do_float_cvtl_d, (void))
1555d0fc900Sths DEF_HELPER(void, do_float_cvtl_s, (void))
1565d0fc900Sths DEF_HELPER(void, do_float_cvtps_pw, (void))
1575d0fc900Sths DEF_HELPER(void, do_float_cvtpw_ps, (void))
1585d0fc900Sths DEF_HELPER(void, do_float_cvts_d, (void))
1595d0fc900Sths DEF_HELPER(void, do_float_cvts_w, (void))
1605d0fc900Sths DEF_HELPER(void, do_float_cvts_l, (void))
1615d0fc900Sths DEF_HELPER(void, do_float_cvts_pl, (void))
1625d0fc900Sths DEF_HELPER(void, do_float_cvts_pu, (void))
1635d0fc900Sths DEF_HELPER(void, do_float_cvtw_s, (void))
1645d0fc900Sths DEF_HELPER(void, do_float_cvtw_d, (void))
1655d0fc900Sths 
1665d0fc900Sths DEF_HELPER(void, do_float_addr_ps, (void))
1675d0fc900Sths DEF_HELPER(void, do_float_mulr_ps, (void))
1685d0fc900Sths 
1695d0fc900Sths #define FOP_PROTO(op)                            \
1705d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
1715d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _d, (void))
172a16336e4Sths FOP_PROTO(sqrt)
1735d0fc900Sths FOP_PROTO(roundl)
1745d0fc900Sths FOP_PROTO(roundw)
1755d0fc900Sths FOP_PROTO(truncl)
1765d0fc900Sths FOP_PROTO(truncw)
1775d0fc900Sths FOP_PROTO(ceill)
1785d0fc900Sths FOP_PROTO(ceilw)
1795d0fc900Sths FOP_PROTO(floorl)
1805d0fc900Sths FOP_PROTO(floorw)
1815d0fc900Sths FOP_PROTO(rsqrt)
1825d0fc900Sths FOP_PROTO(recip)
1835d0fc900Sths #undef FOP_PROTO
1845d0fc900Sths 
1855d0fc900Sths #define FOP_PROTO(op)                            \
1865d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
1875d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _d, (void))  \
1885d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _ps, (void))
1895d0fc900Sths FOP_PROTO(add)
1905d0fc900Sths FOP_PROTO(sub)
1915d0fc900Sths FOP_PROTO(mul)
1925d0fc900Sths FOP_PROTO(div)
193a16336e4Sths FOP_PROTO(abs)
194a16336e4Sths FOP_PROTO(chs)
195a16336e4Sths FOP_PROTO(muladd)
196a16336e4Sths FOP_PROTO(mulsub)
197a16336e4Sths FOP_PROTO(nmuladd)
198a16336e4Sths FOP_PROTO(nmulsub)
1995d0fc900Sths FOP_PROTO(recip1)
2005d0fc900Sths FOP_PROTO(recip2)
2015d0fc900Sths FOP_PROTO(rsqrt1)
2025d0fc900Sths FOP_PROTO(rsqrt2)
2035d0fc900Sths #undef FOP_PROTO
2045d0fc900Sths 
2055d0fc900Sths #define FOP_PROTO(op)                            \
2065d0fc900Sths DEF_HELPER(void, do_cmp_d_ ## op, (long cc))     \
2075d0fc900Sths DEF_HELPER(void, do_cmpabs_d_ ## op, (long cc))  \
2085d0fc900Sths DEF_HELPER(void, do_cmp_s_ ## op, (long cc))     \
2095d0fc900Sths DEF_HELPER(void, do_cmpabs_s_ ## op, (long cc))  \
2105d0fc900Sths DEF_HELPER(void, do_cmp_ps_ ## op, (long cc))    \
2115d0fc900Sths DEF_HELPER(void, do_cmpabs_ps_ ## op, (long cc))
2125d0fc900Sths FOP_PROTO(f)
2135d0fc900Sths FOP_PROTO(un)
2145d0fc900Sths FOP_PROTO(eq)
2155d0fc900Sths FOP_PROTO(ueq)
2165d0fc900Sths FOP_PROTO(olt)
2175d0fc900Sths FOP_PROTO(ult)
2185d0fc900Sths FOP_PROTO(ole)
2195d0fc900Sths FOP_PROTO(ule)
2205d0fc900Sths FOP_PROTO(sf)
2215d0fc900Sths FOP_PROTO(ngle)
2225d0fc900Sths FOP_PROTO(seq)
2235d0fc900Sths FOP_PROTO(ngl)
2245d0fc900Sths FOP_PROTO(lt)
2255d0fc900Sths FOP_PROTO(nge)
2265d0fc900Sths FOP_PROTO(le)
2275d0fc900Sths FOP_PROTO(ngt)
2285d0fc900Sths #undef FOP_PROTO
22908ba7963Sths 
23008ba7963Sths /* Special functions */
2312b0233abSths DEF_HELPER(void, do_di, (void))
2322b0233abSths DEF_HELPER(void, do_ei, (void))
2332b0233abSths DEF_HELPER(void, do_eret, (void))
2342b0233abSths DEF_HELPER(void, do_deret, (void))
2352b0233abSths DEF_HELPER(void, do_rdhwr_cpunum, (void))
2362b0233abSths DEF_HELPER(void, do_rdhwr_synci_step, (void))
2372b0233abSths DEF_HELPER(void, do_rdhwr_cc, (void))
2382b0233abSths DEF_HELPER(void, do_rdhwr_ccres, (void))
23908ba7963Sths DEF_HELPER(void, do_pmon, (int function))
24008ba7963Sths DEF_HELPER(void, do_wait, (void))
2412b0233abSths 
2422b0233abSths /* Bitfield operations. */
2432b0233abSths DEF_HELPER(void, do_ext, (uint32_t pos, uint32_t size))
2442b0233abSths DEF_HELPER(void, do_ins, (uint32_t pos, uint32_t size))
2452b0233abSths DEF_HELPER(void, do_wsbh, (void))
2462b0233abSths #ifdef TARGET_MIPS64
2472b0233abSths DEF_HELPER(void, do_dext, (uint32_t pos, uint32_t size))
2482b0233abSths DEF_HELPER(void, do_dins, (uint32_t pos, uint32_t size))
2492b0233abSths DEF_HELPER(void, do_dsbh, (void))
2502b0233abSths DEF_HELPER(void, do_dshd, (void))
2512b0233abSths #endif
252