1/*
2 *  QEMU MIPS sysemu helpers
3 *
4 *  Copyright (c) 2004-2005 Jocelyn Mayer
5 *  Copyright (c) 2006 Marius Groeger (FPU operations)
6 *  Copyright (c) 2006 Thiemo Seufer (MIPS32R2 support)
7 *  Copyright (c) 2009 CodeSourcery (MIPS16 and microMIPS support)
8 *
9 * SPDX-License-Identifier: LGPL-2.1-or-later
10 */
11
12/* CP0 helpers */
13DEF_HELPER_1(mfc0_mvpcontrol, tl, env)
14DEF_HELPER_1(mfc0_mvpconf0, tl, env)
15DEF_HELPER_1(mfc0_mvpconf1, tl, env)
16DEF_HELPER_1(mftc0_vpecontrol, tl, env)
17DEF_HELPER_1(mftc0_vpeconf0, tl, env)
18DEF_HELPER_1(mfc0_random, tl, env)
19DEF_HELPER_1(mfc0_tcstatus, tl, env)
20DEF_HELPER_1(mftc0_tcstatus, tl, env)
21DEF_HELPER_1(mfc0_tcbind, tl, env)
22DEF_HELPER_1(mftc0_tcbind, tl, env)
23DEF_HELPER_1(mfc0_tcrestart, tl, env)
24DEF_HELPER_1(mftc0_tcrestart, tl, env)
25DEF_HELPER_1(mfc0_tchalt, tl, env)
26DEF_HELPER_1(mftc0_tchalt, tl, env)
27DEF_HELPER_1(mfc0_tccontext, tl, env)
28DEF_HELPER_1(mftc0_tccontext, tl, env)
29DEF_HELPER_1(mfc0_tcschedule, tl, env)
30DEF_HELPER_1(mftc0_tcschedule, tl, env)
31DEF_HELPER_1(mfc0_tcschefback, tl, env)
32DEF_HELPER_1(mftc0_tcschefback, tl, env)
33DEF_HELPER_1(mfc0_count, tl, env)
34DEF_HELPER_1(mfc0_saar, tl, env)
35DEF_HELPER_1(mfhc0_saar, tl, env)
36DEF_HELPER_1(mftc0_entryhi, tl, env)
37DEF_HELPER_1(mftc0_status, tl, env)
38DEF_HELPER_1(mftc0_cause, tl, env)
39DEF_HELPER_1(mftc0_epc, tl, env)
40DEF_HELPER_1(mftc0_ebase, tl, env)
41DEF_HELPER_2(mftc0_configx, tl, env, tl)
42DEF_HELPER_1(mfc0_lladdr, tl, env)
43DEF_HELPER_1(mfc0_maar, tl, env)
44DEF_HELPER_1(mfhc0_maar, tl, env)
45DEF_HELPER_2(mfc0_watchlo, tl, env, i32)
46DEF_HELPER_2(mfc0_watchhi, tl, env, i32)
47DEF_HELPER_2(mfhc0_watchhi, tl, env, i32)
48DEF_HELPER_1(mfc0_debug, tl, env)
49DEF_HELPER_1(mftc0_debug, tl, env)
50#ifdef TARGET_MIPS64
51DEF_HELPER_1(dmfc0_tcrestart, tl, env)
52DEF_HELPER_1(dmfc0_tchalt, tl, env)
53DEF_HELPER_1(dmfc0_tccontext, tl, env)
54DEF_HELPER_1(dmfc0_tcschedule, tl, env)
55DEF_HELPER_1(dmfc0_tcschefback, tl, env)
56DEF_HELPER_1(dmfc0_lladdr, tl, env)
57DEF_HELPER_1(dmfc0_maar, tl, env)
58DEF_HELPER_2(dmfc0_watchlo, tl, env, i32)
59DEF_HELPER_2(dmfc0_watchhi, tl, env, i32)
60DEF_HELPER_1(dmfc0_saar, tl, env)
61#endif /* TARGET_MIPS64 */
62
63DEF_HELPER_2(mtc0_index, void, env, tl)
64DEF_HELPER_2(mtc0_mvpcontrol, void, env, tl)
65DEF_HELPER_2(mtc0_vpecontrol, void, env, tl)
66DEF_HELPER_2(mttc0_vpecontrol, void, env, tl)
67DEF_HELPER_2(mtc0_vpeconf0, void, env, tl)
68DEF_HELPER_2(mttc0_vpeconf0, void, env, tl)
69DEF_HELPER_2(mtc0_vpeconf1, void, env, tl)
70DEF_HELPER_2(mtc0_yqmask, void, env, tl)
71DEF_HELPER_2(mtc0_vpeopt, void, env, tl)
72DEF_HELPER_2(mtc0_entrylo0, void, env, tl)
73DEF_HELPER_2(mtc0_tcstatus, void, env, tl)
74DEF_HELPER_2(mttc0_tcstatus, void, env, tl)
75DEF_HELPER_2(mtc0_tcbind, void, env, tl)
76DEF_HELPER_2(mttc0_tcbind, void, env, tl)
77DEF_HELPER_2(mtc0_tcrestart, void, env, tl)
78DEF_HELPER_2(mttc0_tcrestart, void, env, tl)
79DEF_HELPER_2(mtc0_tchalt, void, env, tl)
80DEF_HELPER_2(mttc0_tchalt, void, env, tl)
81DEF_HELPER_2(mtc0_tccontext, void, env, tl)
82DEF_HELPER_2(mttc0_tccontext, void, env, tl)
83DEF_HELPER_2(mtc0_tcschedule, void, env, tl)
84DEF_HELPER_2(mttc0_tcschedule, void, env, tl)
85DEF_HELPER_2(mtc0_tcschefback, void, env, tl)
86DEF_HELPER_2(mttc0_tcschefback, void, env, tl)
87DEF_HELPER_2(mtc0_entrylo1, void, env, tl)
88DEF_HELPER_2(mtc0_context, void, env, tl)
89DEF_HELPER_2(mtc0_memorymapid, void, env, tl)
90DEF_HELPER_2(mtc0_pagemask, void, env, tl)
91DEF_HELPER_2(mtc0_pagegrain, void, env, tl)
92DEF_HELPER_2(mtc0_segctl0, void, env, tl)
93DEF_HELPER_2(mtc0_segctl1, void, env, tl)
94DEF_HELPER_2(mtc0_segctl2, void, env, tl)
95DEF_HELPER_2(mtc0_pwfield, void, env, tl)
96DEF_HELPER_2(mtc0_pwsize, void, env, tl)
97DEF_HELPER_2(mtc0_wired, void, env, tl)
98DEF_HELPER_2(mtc0_srsconf0, void, env, tl)
99DEF_HELPER_2(mtc0_srsconf1, void, env, tl)
100DEF_HELPER_2(mtc0_srsconf2, void, env, tl)
101DEF_HELPER_2(mtc0_srsconf3, void, env, tl)
102DEF_HELPER_2(mtc0_srsconf4, void, env, tl)
103DEF_HELPER_2(mtc0_hwrena, void, env, tl)
104DEF_HELPER_2(mtc0_pwctl, void, env, tl)
105DEF_HELPER_2(mtc0_count, void, env, tl)
106DEF_HELPER_2(mtc0_saari, void, env, tl)
107DEF_HELPER_2(mtc0_saar, void, env, tl)
108DEF_HELPER_2(mthc0_saar, void, env, tl)
109DEF_HELPER_2(mtc0_entryhi, void, env, tl)
110DEF_HELPER_2(mttc0_entryhi, void, env, tl)
111DEF_HELPER_2(mtc0_compare, void, env, tl)
112DEF_HELPER_2(mtc0_status, void, env, tl)
113DEF_HELPER_2(mttc0_status, void, env, tl)
114DEF_HELPER_2(mtc0_intctl, void, env, tl)
115DEF_HELPER_2(mtc0_srsctl, void, env, tl)
116DEF_HELPER_2(mtc0_cause, void, env, tl)
117DEF_HELPER_2(mttc0_cause, void, env, tl)
118DEF_HELPER_2(mtc0_ebase, void, env, tl)
119DEF_HELPER_2(mttc0_ebase, void, env, tl)
120DEF_HELPER_2(mtc0_config0, void, env, tl)
121DEF_HELPER_2(mtc0_config2, void, env, tl)
122DEF_HELPER_2(mtc0_config3, void, env, tl)
123DEF_HELPER_2(mtc0_config4, void, env, tl)
124DEF_HELPER_2(mtc0_config5, void, env, tl)
125DEF_HELPER_2(mtc0_lladdr, void, env, tl)
126DEF_HELPER_2(mtc0_maar, void, env, tl)
127DEF_HELPER_2(mthc0_maar, void, env, tl)
128DEF_HELPER_2(mtc0_maari, void, env, tl)
129DEF_HELPER_3(mtc0_watchlo, void, env, tl, i32)
130DEF_HELPER_3(mtc0_watchhi, void, env, tl, i32)
131DEF_HELPER_3(mthc0_watchhi, void, env, tl, i32)
132DEF_HELPER_2(mtc0_xcontext, void, env, tl)
133DEF_HELPER_2(mtc0_framemask, void, env, tl)
134DEF_HELPER_2(mtc0_debug, void, env, tl)
135DEF_HELPER_2(mttc0_debug, void, env, tl)
136DEF_HELPER_2(mtc0_performance0, void, env, tl)
137DEF_HELPER_2(mtc0_errctl, void, env, tl)
138DEF_HELPER_2(mtc0_taglo, void, env, tl)
139DEF_HELPER_2(mtc0_datalo, void, env, tl)
140DEF_HELPER_2(mtc0_taghi, void, env, tl)
141DEF_HELPER_2(mtc0_datahi, void, env, tl)
142
143#if defined(TARGET_MIPS64)
144DEF_HELPER_2(dmtc0_entrylo0, void, env, i64)
145DEF_HELPER_2(dmtc0_entrylo1, void, env, i64)
146#endif
147
148/* MIPS MT functions */
149DEF_HELPER_2(mftgpr, tl, env, i32)
150DEF_HELPER_2(mftlo, tl, env, i32)
151DEF_HELPER_2(mfthi, tl, env, i32)
152DEF_HELPER_2(mftacx, tl, env, i32)
153DEF_HELPER_1(mftdsp, tl, env)
154DEF_HELPER_3(mttgpr, void, env, tl, i32)
155DEF_HELPER_3(mttlo, void, env, tl, i32)
156DEF_HELPER_3(mtthi, void, env, tl, i32)
157DEF_HELPER_3(mttacx, void, env, tl, i32)
158DEF_HELPER_2(mttdsp, void, env, tl)
159DEF_HELPER_0(dmt, tl)
160DEF_HELPER_0(emt, tl)
161DEF_HELPER_1(dvpe, tl, env)
162DEF_HELPER_1(evpe, tl, env)
163
164/* R6 Multi-threading */
165DEF_HELPER_1(dvp, tl, env)
166DEF_HELPER_1(evp, tl, env)
167
168/* TLB */
169DEF_HELPER_1(tlbwi, void, env)
170DEF_HELPER_1(tlbwr, void, env)
171DEF_HELPER_1(tlbp, void, env)
172DEF_HELPER_1(tlbr, void, env)
173DEF_HELPER_1(tlbinv, void, env)
174DEF_HELPER_1(tlbinvf, void, env)
175DEF_HELPER_3(ginvt, void, env, tl, i32)
176
177/* Special */
178DEF_HELPER_1(di, tl, env)
179DEF_HELPER_1(ei, tl, env)
180DEF_HELPER_1(eret, void, env)
181DEF_HELPER_1(eretnc, void, env)
182DEF_HELPER_1(deret, void, env)
183DEF_HELPER_3(cache, void, env, tl, i32)
184