xref: /qemu/target/mips/helper.h (revision 2b0233abfb42d42c2ac1fb3d73953218f5e30b39)
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))
147dd9e556Sths #endif
15f1aa6320Sths 
16f1aa6320Sths /* CP0 helpers */
17f1aa6320Sths #ifndef CONFIG_USER_ONLY
18f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpcontrol, (void))
19f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpconf0, (void))
20f1aa6320Sths DEF_HELPER(void, do_mfc0_mvpconf1, (void))
21f1aa6320Sths DEF_HELPER(void, do_mfc0_random, (void))
22f1aa6320Sths DEF_HELPER(void, do_mfc0_tcstatus, (void))
23f1aa6320Sths DEF_HELPER(void, do_mftc0_tcstatus, (void))
24f1aa6320Sths DEF_HELPER(void, do_mfc0_tcbind, (void))
25f1aa6320Sths DEF_HELPER(void, do_mftc0_tcbind, (void))
26f1aa6320Sths DEF_HELPER(void, do_mfc0_tcrestart, (void))
27f1aa6320Sths DEF_HELPER(void, do_mftc0_tcrestart, (void))
28f1aa6320Sths DEF_HELPER(void, do_mfc0_tchalt, (void))
29f1aa6320Sths DEF_HELPER(void, do_mftc0_tchalt, (void))
30f1aa6320Sths DEF_HELPER(void, do_mfc0_tccontext, (void))
31f1aa6320Sths DEF_HELPER(void, do_mftc0_tccontext, (void))
32f1aa6320Sths DEF_HELPER(void, do_mfc0_tcschedule, (void))
33f1aa6320Sths DEF_HELPER(void, do_mftc0_tcschedule, (void))
34f1aa6320Sths DEF_HELPER(void, do_mfc0_tcschefback, (void))
35f1aa6320Sths DEF_HELPER(void, do_mftc0_tcschefback, (void))
36f1aa6320Sths DEF_HELPER(void, do_mfc0_count, (void))
37f1aa6320Sths DEF_HELPER(void, do_mftc0_entryhi, (void))
38f1aa6320Sths DEF_HELPER(void, do_mftc0_status, (void))
39f1aa6320Sths DEF_HELPER(void, do_mfc0_lladdr, (void))
40f1aa6320Sths DEF_HELPER(void, do_mfc0_watchlo, (uint32_t sel))
41f1aa6320Sths DEF_HELPER(void, do_mfc0_watchhi, (uint32_t sel))
42f1aa6320Sths DEF_HELPER(void, do_mfc0_debug, (void))
43f1aa6320Sths DEF_HELPER(void, do_mftc0_debug, (void))
44f1aa6320Sths #ifdef TARGET_MIPS64
45f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcrestart, (void))
46f1aa6320Sths DEF_HELPER(void, do_dmfc0_tchalt, (void))
47f1aa6320Sths DEF_HELPER(void, do_dmfc0_tccontext, (void))
48f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcschedule, (void))
49f1aa6320Sths DEF_HELPER(void, do_dmfc0_tcschefback, (void))
50f1aa6320Sths DEF_HELPER(void, do_dmfc0_lladdr, (void))
51f1aa6320Sths DEF_HELPER(void, do_dmfc0_watchlo, (uint32_t sel))
52f1aa6320Sths #endif /* TARGET_MIPS64 */
53f1aa6320Sths 
54f1aa6320Sths DEF_HELPER(void, do_mtc0_index, (void))
55f1aa6320Sths DEF_HELPER(void, do_mtc0_mvpcontrol, (void))
56f1aa6320Sths DEF_HELPER(void, do_mtc0_vpecontrol, (void))
57f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeconf0, (void))
58f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeconf1, (void))
59f1aa6320Sths DEF_HELPER(void, do_mtc0_yqmask, (void))
60f1aa6320Sths DEF_HELPER(void, do_mtc0_vpeopt, (void))
61f1aa6320Sths DEF_HELPER(void, do_mtc0_entrylo0, (void))
62f1aa6320Sths DEF_HELPER(void, do_mtc0_tcstatus, (void))
63f1aa6320Sths DEF_HELPER(void, do_mttc0_tcstatus, (void))
64f1aa6320Sths DEF_HELPER(void, do_mtc0_tcbind, (void))
65f1aa6320Sths DEF_HELPER(void, do_mttc0_tcbind, (void))
66f1aa6320Sths DEF_HELPER(void, do_mtc0_tcrestart, (void))
67f1aa6320Sths DEF_HELPER(void, do_mttc0_tcrestart, (void))
68f1aa6320Sths DEF_HELPER(void, do_mtc0_tchalt, (void))
69f1aa6320Sths DEF_HELPER(void, do_mttc0_tchalt, (void))
70f1aa6320Sths DEF_HELPER(void, do_mtc0_tccontext, (void))
71f1aa6320Sths DEF_HELPER(void, do_mttc0_tccontext, (void))
72f1aa6320Sths DEF_HELPER(void, do_mtc0_tcschedule, (void))
73f1aa6320Sths DEF_HELPER(void, do_mttc0_tcschedule, (void))
74f1aa6320Sths DEF_HELPER(void, do_mtc0_tcschefback, (void))
75f1aa6320Sths DEF_HELPER(void, do_mttc0_tcschefback, (void))
76f1aa6320Sths DEF_HELPER(void, do_mtc0_entrylo1, (void))
77f1aa6320Sths DEF_HELPER(void, do_mtc0_context, (void))
78f1aa6320Sths DEF_HELPER(void, do_mtc0_pagemask, (void))
79f1aa6320Sths DEF_HELPER(void, do_mtc0_pagegrain, (void))
80f1aa6320Sths DEF_HELPER(void, do_mtc0_wired, (void))
81f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf0, (void))
82f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf1, (void))
83f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf2, (void))
84f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf3, (void))
85f1aa6320Sths DEF_HELPER(void, do_mtc0_srsconf4, (void))
86f1aa6320Sths DEF_HELPER(void, do_mtc0_hwrena, (void))
87f1aa6320Sths DEF_HELPER(void, do_mtc0_count, (void))
88f1aa6320Sths DEF_HELPER(void, do_mtc0_entryhi, (void))
89f1aa6320Sths DEF_HELPER(void, do_mttc0_entryhi, (void))
90f1aa6320Sths DEF_HELPER(void, do_mtc0_compare, (void))
91f1aa6320Sths DEF_HELPER(void, do_mtc0_status, (void))
92f1aa6320Sths DEF_HELPER(void, do_mttc0_status, (void))
93f1aa6320Sths DEF_HELPER(void, do_mtc0_intctl, (void))
94f1aa6320Sths DEF_HELPER(void, do_mtc0_srsctl, (void))
95f1aa6320Sths DEF_HELPER(void, do_mtc0_cause, (void))
96f1aa6320Sths DEF_HELPER(void, do_mtc0_ebase, (void))
97f1aa6320Sths DEF_HELPER(void, do_mtc0_config0, (void))
98f1aa6320Sths DEF_HELPER(void, do_mtc0_config2, (void))
99f1aa6320Sths DEF_HELPER(void, do_mtc0_watchlo, (uint32_t sel))
100f1aa6320Sths DEF_HELPER(void, do_mtc0_watchhi, (uint32_t sel))
101f1aa6320Sths DEF_HELPER(void, do_mtc0_xcontext, (void))
102f1aa6320Sths DEF_HELPER(void, do_mtc0_framemask, (void))
103f1aa6320Sths DEF_HELPER(void, do_mtc0_debug, (void))
104f1aa6320Sths DEF_HELPER(void, do_mttc0_debug, (void))
105f1aa6320Sths DEF_HELPER(void, do_mtc0_performance0, (void))
106f1aa6320Sths DEF_HELPER(void, do_mtc0_taglo, (void))
107f1aa6320Sths DEF_HELPER(void, do_mtc0_datalo, (void))
108f1aa6320Sths DEF_HELPER(void, do_mtc0_taghi, (void))
109f1aa6320Sths DEF_HELPER(void, do_mtc0_datahi, (void))
110f1aa6320Sths #endif /* !CONFIG_USER_ONLY */
111f1aa6320Sths 
112f1aa6320Sths /* MIPS MT functions */
113f1aa6320Sths DEF_HELPER(void, do_mftgpr, (uint32_t sel))
114f1aa6320Sths DEF_HELPER(void, do_mftlo, (uint32_t sel))
115f1aa6320Sths DEF_HELPER(void, do_mfthi, (uint32_t sel))
116f1aa6320Sths DEF_HELPER(void, do_mftacx, (uint32_t sel))
117f1aa6320Sths DEF_HELPER(void, do_mftdsp, (void))
118f1aa6320Sths DEF_HELPER(void, do_mttgpr, (uint32_t sel))
119f1aa6320Sths DEF_HELPER(void, do_mttlo, (uint32_t sel))
120f1aa6320Sths DEF_HELPER(void, do_mtthi, (uint32_t sel))
121f1aa6320Sths DEF_HELPER(void, do_mttacx, (uint32_t sel))
122f1aa6320Sths DEF_HELPER(void, do_mttdsp, (void))
123f1aa6320Sths DEF_HELPER(void, do_dmt, (void))
124f1aa6320Sths DEF_HELPER(void, do_emt, (void))
125f1aa6320Sths DEF_HELPER(void, do_dvpe, (void))
126f1aa6320Sths DEF_HELPER(void, do_evpe, (void))
127f1aa6320Sths DEF_HELPER(void, do_fork, (void))
128f1aa6320Sths DEF_HELPER(void, do_yield, (void))
129f1aa6320Sths 
130f1aa6320Sths /* CP1 functions */
131f1aa6320Sths DEF_HELPER(void, do_cfc1, (uint32_t reg))
132f1aa6320Sths DEF_HELPER(void, do_ctc1, (uint32_t reg))
1335d0fc900Sths 
1345d0fc900Sths DEF_HELPER(void, do_float_cvtd_s, (void))
1355d0fc900Sths DEF_HELPER(void, do_float_cvtd_w, (void))
1365d0fc900Sths DEF_HELPER(void, do_float_cvtd_l, (void))
1375d0fc900Sths DEF_HELPER(void, do_float_cvtl_d, (void))
1385d0fc900Sths DEF_HELPER(void, do_float_cvtl_s, (void))
1395d0fc900Sths DEF_HELPER(void, do_float_cvtps_pw, (void))
1405d0fc900Sths DEF_HELPER(void, do_float_cvtpw_ps, (void))
1415d0fc900Sths DEF_HELPER(void, do_float_cvts_d, (void))
1425d0fc900Sths DEF_HELPER(void, do_float_cvts_w, (void))
1435d0fc900Sths DEF_HELPER(void, do_float_cvts_l, (void))
1445d0fc900Sths DEF_HELPER(void, do_float_cvts_pl, (void))
1455d0fc900Sths DEF_HELPER(void, do_float_cvts_pu, (void))
1465d0fc900Sths DEF_HELPER(void, do_float_cvtw_s, (void))
1475d0fc900Sths DEF_HELPER(void, do_float_cvtw_d, (void))
1485d0fc900Sths 
1495d0fc900Sths DEF_HELPER(void, do_float_addr_ps, (void))
1505d0fc900Sths DEF_HELPER(void, do_float_mulr_ps, (void))
1515d0fc900Sths 
1525d0fc900Sths #define FOP_PROTO(op)                            \
1535d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
1545d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _d, (void))
1555d0fc900Sths FOP_PROTO(roundl)
1565d0fc900Sths FOP_PROTO(roundw)
1575d0fc900Sths FOP_PROTO(truncl)
1585d0fc900Sths FOP_PROTO(truncw)
1595d0fc900Sths FOP_PROTO(ceill)
1605d0fc900Sths FOP_PROTO(ceilw)
1615d0fc900Sths FOP_PROTO(floorl)
1625d0fc900Sths FOP_PROTO(floorw)
1635d0fc900Sths FOP_PROTO(rsqrt)
1645d0fc900Sths FOP_PROTO(recip)
1655d0fc900Sths #undef FOP_PROTO
1665d0fc900Sths 
1675d0fc900Sths #define FOP_PROTO(op)                            \
1685d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _s, (void))  \
1695d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _d, (void))  \
1705d0fc900Sths DEF_HELPER(void, do_float_ ## op ## _ps, (void))
1715d0fc900Sths FOP_PROTO(add)
1725d0fc900Sths FOP_PROTO(sub)
1735d0fc900Sths FOP_PROTO(mul)
1745d0fc900Sths FOP_PROTO(div)
1755d0fc900Sths FOP_PROTO(recip1)
1765d0fc900Sths FOP_PROTO(recip2)
1775d0fc900Sths FOP_PROTO(rsqrt1)
1785d0fc900Sths FOP_PROTO(rsqrt2)
1795d0fc900Sths #undef FOP_PROTO
1805d0fc900Sths 
1815d0fc900Sths #define FOP_PROTO(op)                            \
1825d0fc900Sths DEF_HELPER(void, do_cmp_d_ ## op, (long cc))     \
1835d0fc900Sths DEF_HELPER(void, do_cmpabs_d_ ## op, (long cc))  \
1845d0fc900Sths DEF_HELPER(void, do_cmp_s_ ## op, (long cc))     \
1855d0fc900Sths DEF_HELPER(void, do_cmpabs_s_ ## op, (long cc))  \
1865d0fc900Sths DEF_HELPER(void, do_cmp_ps_ ## op, (long cc))    \
1875d0fc900Sths DEF_HELPER(void, do_cmpabs_ps_ ## op, (long cc))
1885d0fc900Sths FOP_PROTO(f)
1895d0fc900Sths FOP_PROTO(un)
1905d0fc900Sths FOP_PROTO(eq)
1915d0fc900Sths FOP_PROTO(ueq)
1925d0fc900Sths FOP_PROTO(olt)
1935d0fc900Sths FOP_PROTO(ult)
1945d0fc900Sths FOP_PROTO(ole)
1955d0fc900Sths FOP_PROTO(ule)
1965d0fc900Sths FOP_PROTO(sf)
1975d0fc900Sths FOP_PROTO(ngle)
1985d0fc900Sths FOP_PROTO(seq)
1995d0fc900Sths FOP_PROTO(ngl)
2005d0fc900Sths FOP_PROTO(lt)
2015d0fc900Sths FOP_PROTO(nge)
2025d0fc900Sths FOP_PROTO(le)
2035d0fc900Sths FOP_PROTO(ngt)
2045d0fc900Sths #undef FOP_PROTO
20508ba7963Sths 
20608ba7963Sths /* Special functions */
2072b0233abSths DEF_HELPER(void, do_di, (void))
2082b0233abSths DEF_HELPER(void, do_ei, (void))
2092b0233abSths DEF_HELPER(void, do_eret, (void))
2102b0233abSths DEF_HELPER(void, do_deret, (void))
2112b0233abSths DEF_HELPER(void, do_rdhwr_cpunum, (void))
2122b0233abSths DEF_HELPER(void, do_rdhwr_synci_step, (void))
2132b0233abSths DEF_HELPER(void, do_rdhwr_cc, (void))
2142b0233abSths DEF_HELPER(void, do_rdhwr_ccres, (void))
21508ba7963Sths DEF_HELPER(void, do_pmon, (int function))
21608ba7963Sths DEF_HELPER(void, do_wait, (void))
2172b0233abSths 
2182b0233abSths /* Bitfield operations. */
2192b0233abSths DEF_HELPER(void, do_ext, (uint32_t pos, uint32_t size))
2202b0233abSths DEF_HELPER(void, do_ins, (uint32_t pos, uint32_t size))
2212b0233abSths DEF_HELPER(void, do_wsbh, (void))
2222b0233abSths #ifdef TARGET_MIPS64
2232b0233abSths DEF_HELPER(void, do_dext, (uint32_t pos, uint32_t size))
2242b0233abSths DEF_HELPER(void, do_dins, (uint32_t pos, uint32_t size))
2252b0233abSths DEF_HELPER(void, do_dsbh, (void))
2262b0233abSths DEF_HELPER(void, do_dshd, (void))
2272b0233abSths #endif
228