blob: cc36bb11072a35e292ffa7483f36a4630dc867af [file] [log] [blame]
pbrooka7812ae2008-11-17 14:43:54 +00001#include "def-helper.h"
ths30898802008-05-21 02:04:15 +00002
pbrooka7812ae2008-11-17 14:43:54 +00003/* FIXME: We should rename the helper functions and remove this hack. */
4#undef HELPER
5#define HELPER(name) do_##name
6
7
8DEF_HELPER_2(raise_exception_err, void, i32, int)
9DEF_HELPER_1(raise_exception, void, i32)
10DEF_HELPER_0(interrupt_restart, void)
ths7dd9e552008-06-08 07:42:23 +000011
thsc8c22272008-06-20 15:12:14 +000012#ifdef TARGET_MIPS64
pbrooka7812ae2008-11-17 14:43:54 +000013DEF_HELPER_3(ldl, tl, tl, tl, int)
14DEF_HELPER_3(ldr, tl, tl, tl, int)
15DEF_HELPER_3(sdl, void, tl, tl, int)
16DEF_HELPER_3(sdr, void, tl, tl, int)
thsc8c22272008-06-20 15:12:14 +000017#endif
pbrooka7812ae2008-11-17 14:43:54 +000018DEF_HELPER_3(lwl, tl, tl, tl, int)
19DEF_HELPER_3(lwr, tl, tl, tl, int)
20DEF_HELPER_3(swl, void, tl, tl, int)
21DEF_HELPER_3(swr, void, tl, tl, int)
thsc8c22272008-06-20 15:12:14 +000022
pbrooka7812ae2008-11-17 14:43:54 +000023DEF_HELPER_1(clo, tl, tl)
24DEF_HELPER_1(clz, tl, tl)
ths7dd9e552008-06-08 07:42:23 +000025#ifdef TARGET_MIPS64
pbrooka7812ae2008-11-17 14:43:54 +000026DEF_HELPER_1(dclo, tl, tl)
27DEF_HELPER_1(dclz, tl, tl)
28DEF_HELPER_2(dmult, void, tl, tl)
29DEF_HELPER_2(dmultu, void, tl, tl)
ths7dd9e552008-06-08 07:42:23 +000030#endif
thsf1aa6322008-06-09 07:13:38 +000031
pbrooka7812ae2008-11-17 14:43:54 +000032DEF_HELPER_2(muls, tl, tl, tl)
33DEF_HELPER_2(mulsu, tl, tl, tl)
34DEF_HELPER_2(macc, tl, tl, tl)
35DEF_HELPER_2(maccu, tl, tl, tl)
36DEF_HELPER_2(msac, tl, tl, tl)
37DEF_HELPER_2(msacu, tl, tl, tl)
38DEF_HELPER_2(mulhi, tl, tl, tl)
39DEF_HELPER_2(mulhiu, tl, tl, tl)
40DEF_HELPER_2(mulshi, tl, tl, tl)
41DEF_HELPER_2(mulshiu, tl, tl, tl)
42DEF_HELPER_2(macchi, tl, tl, tl)
43DEF_HELPER_2(macchiu, tl, tl, tl)
44DEF_HELPER_2(msachi, tl, tl, tl)
45DEF_HELPER_2(msachiu, tl, tl, tl)
ths92af06d2008-06-20 14:35:19 +000046
thsf1aa6322008-06-09 07:13:38 +000047#ifndef CONFIG_USER_ONLY
ths0eaef5a2008-07-23 16:14:22 +000048/* CP0 helpers */
pbrooka7812ae2008-11-17 14:43:54 +000049DEF_HELPER_0(mfc0_mvpcontrol, tl)
50DEF_HELPER_0(mfc0_mvpconf0, tl)
51DEF_HELPER_0(mfc0_mvpconf1, tl)
52DEF_HELPER_0(mfc0_random, tl)
53DEF_HELPER_0(mfc0_tcstatus, tl)
54DEF_HELPER_0(mftc0_tcstatus, tl)
55DEF_HELPER_0(mfc0_tcbind, tl)
56DEF_HELPER_0(mftc0_tcbind, tl)
57DEF_HELPER_0(mfc0_tcrestart, tl)
58DEF_HELPER_0(mftc0_tcrestart, tl)
59DEF_HELPER_0(mfc0_tchalt, tl)
60DEF_HELPER_0(mftc0_tchalt, tl)
61DEF_HELPER_0(mfc0_tccontext, tl)
62DEF_HELPER_0(mftc0_tccontext, tl)
63DEF_HELPER_0(mfc0_tcschedule, tl)
64DEF_HELPER_0(mftc0_tcschedule, tl)
65DEF_HELPER_0(mfc0_tcschefback, tl)
66DEF_HELPER_0(mftc0_tcschefback, tl)
67DEF_HELPER_0(mfc0_count, tl)
68DEF_HELPER_0(mftc0_entryhi, tl)
69DEF_HELPER_0(mftc0_status, tl)
70DEF_HELPER_0(mfc0_lladdr, tl)
71DEF_HELPER_1(mfc0_watchlo, tl, i32)
72DEF_HELPER_1(mfc0_watchhi, tl, i32)
73DEF_HELPER_0(mfc0_debug, tl)
74DEF_HELPER_0(mftc0_debug, tl)
thsf1aa6322008-06-09 07:13:38 +000075#ifdef TARGET_MIPS64
pbrooka7812ae2008-11-17 14:43:54 +000076DEF_HELPER_0(dmfc0_tcrestart, tl)
77DEF_HELPER_0(dmfc0_tchalt, tl)
78DEF_HELPER_0(dmfc0_tccontext, tl)
79DEF_HELPER_0(dmfc0_tcschedule, tl)
80DEF_HELPER_0(dmfc0_tcschefback, tl)
81DEF_HELPER_0(dmfc0_lladdr, tl)
82DEF_HELPER_1(dmfc0_watchlo, tl, i32)
thsf1aa6322008-06-09 07:13:38 +000083#endif /* TARGET_MIPS64 */
84
pbrooka7812ae2008-11-17 14:43:54 +000085DEF_HELPER_1(mtc0_index, void, tl)
86DEF_HELPER_1(mtc0_mvpcontrol, void, tl)
87DEF_HELPER_1(mtc0_vpecontrol, void, tl)
88DEF_HELPER_1(mtc0_vpeconf0, void, tl)
89DEF_HELPER_1(mtc0_vpeconf1, void, tl)
90DEF_HELPER_1(mtc0_yqmask, void, tl)
91DEF_HELPER_1(mtc0_vpeopt, void, tl)
92DEF_HELPER_1(mtc0_entrylo0, void, tl)
93DEF_HELPER_1(mtc0_tcstatus, void, tl)
94DEF_HELPER_1(mttc0_tcstatus, void, tl)
95DEF_HELPER_1(mtc0_tcbind, void, tl)
96DEF_HELPER_1(mttc0_tcbind, void, tl)
97DEF_HELPER_1(mtc0_tcrestart, void, tl)
98DEF_HELPER_1(mttc0_tcrestart, void, tl)
99DEF_HELPER_1(mtc0_tchalt, void, tl)
100DEF_HELPER_1(mttc0_tchalt, void, tl)
101DEF_HELPER_1(mtc0_tccontext, void, tl)
102DEF_HELPER_1(mttc0_tccontext, void, tl)
103DEF_HELPER_1(mtc0_tcschedule, void, tl)
104DEF_HELPER_1(mttc0_tcschedule, void, tl)
105DEF_HELPER_1(mtc0_tcschefback, void, tl)
106DEF_HELPER_1(mttc0_tcschefback, void, tl)
107DEF_HELPER_1(mtc0_entrylo1, void, tl)
108DEF_HELPER_1(mtc0_context, void, tl)
109DEF_HELPER_1(mtc0_pagemask, void, tl)
110DEF_HELPER_1(mtc0_pagegrain, void, tl)
111DEF_HELPER_1(mtc0_wired, void, tl)
112DEF_HELPER_1(mtc0_srsconf0, void, tl)
113DEF_HELPER_1(mtc0_srsconf1, void, tl)
114DEF_HELPER_1(mtc0_srsconf2, void, tl)
115DEF_HELPER_1(mtc0_srsconf3, void, tl)
116DEF_HELPER_1(mtc0_srsconf4, void, tl)
117DEF_HELPER_1(mtc0_hwrena, void, tl)
118DEF_HELPER_1(mtc0_count, void, tl)
119DEF_HELPER_1(mtc0_entryhi, void, tl)
120DEF_HELPER_1(mttc0_entryhi, void, tl)
121DEF_HELPER_1(mtc0_compare, void, tl)
122DEF_HELPER_1(mtc0_status, void, tl)
123DEF_HELPER_1(mttc0_status, void, tl)
124DEF_HELPER_1(mtc0_intctl, void, tl)
125DEF_HELPER_1(mtc0_srsctl, void, tl)
126DEF_HELPER_1(mtc0_cause, void, tl)
127DEF_HELPER_1(mtc0_ebase, void, tl)
128DEF_HELPER_1(mtc0_config0, void, tl)
129DEF_HELPER_1(mtc0_config2, void, tl)
130DEF_HELPER_2(mtc0_watchlo, void, tl, i32)
131DEF_HELPER_2(mtc0_watchhi, void, tl, i32)
132DEF_HELPER_1(mtc0_xcontext, void, tl)
133DEF_HELPER_1(mtc0_framemask, void, tl)
134DEF_HELPER_1(mtc0_debug, void, tl)
135DEF_HELPER_1(mttc0_debug, void, tl)
136DEF_HELPER_1(mtc0_performance0, void, tl)
137DEF_HELPER_1(mtc0_taglo, void, tl)
138DEF_HELPER_1(mtc0_datalo, void, tl)
139DEF_HELPER_1(mtc0_taghi, void, tl)
140DEF_HELPER_1(mtc0_datahi, void, tl)
thsf1aa6322008-06-09 07:13:38 +0000141
142/* MIPS MT functions */
pbrooka7812ae2008-11-17 14:43:54 +0000143DEF_HELPER_1(mftgpr, tl, i32);
144DEF_HELPER_1(mftlo, tl, i32)
145DEF_HELPER_1(mfthi, tl, i32)
146DEF_HELPER_1(mftacx, tl, i32)
147DEF_HELPER_0(mftdsp, tl)
148DEF_HELPER_2(mttgpr, void, tl, i32)
149DEF_HELPER_2(mttlo, void, tl, i32)
150DEF_HELPER_2(mtthi, void, tl, i32)
151DEF_HELPER_2(mttacx, void, tl, i32)
152DEF_HELPER_1(mttdsp, void, tl)
153DEF_HELPER_1(dmt, tl, tl)
154DEF_HELPER_1(emt, tl, tl)
155DEF_HELPER_1(dvpe, tl, tl)
156DEF_HELPER_1(evpe, tl, tl)
ths0eaef5a2008-07-23 16:14:22 +0000157#endif /* !CONFIG_USER_ONLY */
pbrooka7812ae2008-11-17 14:43:54 +0000158DEF_HELPER_2(fork, void, tl, tl)
159DEF_HELPER_1(yield, tl, tl)
thsf1aa6322008-06-09 07:13:38 +0000160
161/* CP1 functions */
pbrooka7812ae2008-11-17 14:43:54 +0000162DEF_HELPER_1(cfc1, tl, i32)
163DEF_HELPER_2(ctc1, void, tl, i32)
ths5d0fc902008-06-11 15:27:54 +0000164
pbrooka7812ae2008-11-17 14:43:54 +0000165DEF_HELPER_1(float_cvtd_s, i64, i32)
166DEF_HELPER_1(float_cvtd_w, i64, i32)
167DEF_HELPER_1(float_cvtd_l, i64, i64)
168DEF_HELPER_1(float_cvtl_d, i64, i64)
169DEF_HELPER_1(float_cvtl_s, i64, i32)
170DEF_HELPER_1(float_cvtps_pw, i64, i64)
171DEF_HELPER_1(float_cvtpw_ps, i64, i64)
172DEF_HELPER_1(float_cvts_d, i32, i64)
173DEF_HELPER_1(float_cvts_w, i32, i32)
174DEF_HELPER_1(float_cvts_l, i32, i64)
175DEF_HELPER_1(float_cvts_pl, i32, i32)
176DEF_HELPER_1(float_cvts_pu, i32, i32)
177DEF_HELPER_1(float_cvtw_s, i32, i32)
178DEF_HELPER_1(float_cvtw_d, i32, i64)
ths5d0fc902008-06-11 15:27:54 +0000179
pbrooka7812ae2008-11-17 14:43:54 +0000180DEF_HELPER_2(float_addr_ps, i64, i64, i64)
181DEF_HELPER_2(float_mulr_ps, i64, i64, i64)
ths5d0fc902008-06-11 15:27:54 +0000182
pbrooka7812ae2008-11-17 14:43:54 +0000183#define FOP_PROTO(op) \
184DEF_HELPER_1(float_ ## op ## l_s, i64, i32) \
185DEF_HELPER_1(float_ ## op ## l_d, i64, i64) \
186DEF_HELPER_1(float_ ## op ## w_s, i32, i32) \
187DEF_HELPER_1(float_ ## op ## w_d, i32, i64)
thsb6d96be2008-07-09 11:05:10 +0000188FOP_PROTO(round)
189FOP_PROTO(trunc)
190FOP_PROTO(ceil)
191FOP_PROTO(floor)
192#undef FOP_PROTO
193
pbrooka7812ae2008-11-17 14:43:54 +0000194#define FOP_PROTO(op) \
195DEF_HELPER_1(float_ ## op ## _s, i32, i32) \
196DEF_HELPER_1(float_ ## op ## _d, i64, i64)
thsa16336e2008-06-19 18:35:02 +0000197FOP_PROTO(sqrt)
ths5d0fc902008-06-11 15:27:54 +0000198FOP_PROTO(rsqrt)
199FOP_PROTO(recip)
200#undef FOP_PROTO
201
pbrooka7812ae2008-11-17 14:43:54 +0000202#define FOP_PROTO(op) \
203DEF_HELPER_1(float_ ## op ## _s, i32, i32) \
204DEF_HELPER_1(float_ ## op ## _d, i64, i64) \
205DEF_HELPER_1(float_ ## op ## _ps, i64, i64)
thsb6d96be2008-07-09 11:05:10 +0000206FOP_PROTO(abs)
207FOP_PROTO(chs)
208FOP_PROTO(recip1)
209FOP_PROTO(rsqrt1)
210#undef FOP_PROTO
211
pbrooka7812ae2008-11-17 14:43:54 +0000212#define FOP_PROTO(op) \
213DEF_HELPER_2(float_ ## op ## _s, i32, i32, i32) \
214DEF_HELPER_2(float_ ## op ## _d, i64, i64, i64) \
215DEF_HELPER_2(float_ ## op ## _ps, i64, i64, i64)
ths5d0fc902008-06-11 15:27:54 +0000216FOP_PROTO(add)
217FOP_PROTO(sub)
218FOP_PROTO(mul)
219FOP_PROTO(div)
thsb6d96be2008-07-09 11:05:10 +0000220FOP_PROTO(recip2)
221FOP_PROTO(rsqrt2)
222#undef FOP_PROTO
223
pbrooka7812ae2008-11-17 14:43:54 +0000224#define FOP_PROTO(op) \
225DEF_HELPER_3(float_ ## op ## _s, i32, i32, i32, i32) \
226DEF_HELPER_3(float_ ## op ## _d, i64, i64, i64, i64) \
227DEF_HELPER_3(float_ ## op ## _ps, i64, i64, i64, i64)
thsa16336e2008-06-19 18:35:02 +0000228FOP_PROTO(muladd)
229FOP_PROTO(mulsub)
230FOP_PROTO(nmuladd)
231FOP_PROTO(nmulsub)
ths5d0fc902008-06-11 15:27:54 +0000232#undef FOP_PROTO
233
pbrooka7812ae2008-11-17 14:43:54 +0000234#define FOP_PROTO(op) \
235DEF_HELPER_3(cmp_d_ ## op, void, i64, i64, int) \
236DEF_HELPER_3(cmpabs_d_ ## op, void, i64, i64, int) \
237DEF_HELPER_3(cmp_s_ ## op, void, i32, i32, int) \
238DEF_HELPER_3(cmpabs_s_ ## op, void, i32, i32, int) \
239DEF_HELPER_3(cmp_ps_ ## op, void, i64, i64, int) \
240DEF_HELPER_3(cmpabs_ps_ ## op, void, i64, i64, int)
ths5d0fc902008-06-11 15:27:54 +0000241FOP_PROTO(f)
242FOP_PROTO(un)
243FOP_PROTO(eq)
244FOP_PROTO(ueq)
245FOP_PROTO(olt)
246FOP_PROTO(ult)
247FOP_PROTO(ole)
248FOP_PROTO(ule)
249FOP_PROTO(sf)
250FOP_PROTO(ngle)
251FOP_PROTO(seq)
252FOP_PROTO(ngl)
253FOP_PROTO(lt)
254FOP_PROTO(nge)
255FOP_PROTO(le)
256FOP_PROTO(ngt)
257#undef FOP_PROTO
ths08ba7962008-06-12 03:15:13 +0000258
259/* Special functions */
ths0eaef5a2008-07-23 16:14:22 +0000260#ifndef CONFIG_USER_ONLY
pbrooka7812ae2008-11-17 14:43:54 +0000261DEF_HELPER_0(tlbwi, void)
262DEF_HELPER_0(tlbwr, void)
263DEF_HELPER_0(tlbp, void)
264DEF_HELPER_0(tlbr, void)
265DEF_HELPER_0(di, tl)
266DEF_HELPER_0(ei, tl)
267DEF_HELPER_0(eret, void)
268DEF_HELPER_0(deret, void)
ths0eaef5a2008-07-23 16:14:22 +0000269#endif /* !CONFIG_USER_ONLY */
pbrooka7812ae2008-11-17 14:43:54 +0000270DEF_HELPER_0(rdhwr_cpunum, tl)
271DEF_HELPER_0(rdhwr_synci_step, tl)
272DEF_HELPER_0(rdhwr_cc, tl)
273DEF_HELPER_0(rdhwr_ccres, tl)
274DEF_HELPER_1(pmon, void, int)
275DEF_HELPER_0(wait, void)
276
277#include "def-helper.h"