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(mftc0_entryhi, tl, env) 35DEF_HELPER_1(mftc0_status, tl, env) 36DEF_HELPER_1(mftc0_cause, tl, env) 37DEF_HELPER_1(mftc0_epc, tl, env) 38DEF_HELPER_1(mftc0_ebase, tl, env) 39DEF_HELPER_2(mftc0_configx, tl, env, tl) 40DEF_HELPER_1(mfc0_lladdr, tl, env) 41DEF_HELPER_1(mfc0_maar, tl, env) 42DEF_HELPER_1(mfhc0_maar, tl, env) 43DEF_HELPER_2(mfc0_watchlo, tl, env, i32) 44DEF_HELPER_2(mfc0_watchhi, tl, env, i32) 45DEF_HELPER_2(mfhc0_watchhi, tl, env, i32) 46DEF_HELPER_1(mfc0_debug, tl, env) 47DEF_HELPER_1(mftc0_debug, tl, env) 48#ifdef TARGET_MIPS64 49DEF_HELPER_1(dmfc0_tcrestart, tl, env) 50DEF_HELPER_1(dmfc0_tchalt, tl, env) 51DEF_HELPER_1(dmfc0_tccontext, tl, env) 52DEF_HELPER_1(dmfc0_tcschedule, tl, env) 53DEF_HELPER_1(dmfc0_tcschefback, tl, env) 54DEF_HELPER_1(dmfc0_lladdr, tl, env) 55DEF_HELPER_1(dmfc0_maar, tl, env) 56DEF_HELPER_2(dmfc0_watchlo, tl, env, i32) 57DEF_HELPER_2(dmfc0_watchhi, tl, env, i32) 58#endif /* TARGET_MIPS64 */ 59 60DEF_HELPER_2(mtc0_index, void, env, tl) 61DEF_HELPER_2(mtc0_mvpcontrol, void, env, tl) 62DEF_HELPER_2(mtc0_vpecontrol, void, env, tl) 63DEF_HELPER_2(mttc0_vpecontrol, void, env, tl) 64DEF_HELPER_2(mtc0_vpeconf0, void, env, tl) 65DEF_HELPER_2(mttc0_vpeconf0, void, env, tl) 66DEF_HELPER_2(mtc0_vpeconf1, void, env, tl) 67DEF_HELPER_2(mtc0_yqmask, void, env, tl) 68DEF_HELPER_2(mtc0_vpeopt, void, env, tl) 69DEF_HELPER_2(mtc0_entrylo0, void, env, tl) 70DEF_HELPER_2(mtc0_tcstatus, void, env, tl) 71DEF_HELPER_2(mttc0_tcstatus, void, env, tl) 72DEF_HELPER_2(mtc0_tcbind, void, env, tl) 73DEF_HELPER_2(mttc0_tcbind, void, env, tl) 74DEF_HELPER_2(mtc0_tcrestart, void, env, tl) 75DEF_HELPER_2(mttc0_tcrestart, void, env, tl) 76DEF_HELPER_2(mtc0_tchalt, void, env, tl) 77DEF_HELPER_2(mttc0_tchalt, void, env, tl) 78DEF_HELPER_2(mtc0_tccontext, void, env, tl) 79DEF_HELPER_2(mttc0_tccontext, void, env, tl) 80DEF_HELPER_2(mtc0_tcschedule, void, env, tl) 81DEF_HELPER_2(mttc0_tcschedule, void, env, tl) 82DEF_HELPER_2(mtc0_tcschefback, void, env, tl) 83DEF_HELPER_2(mttc0_tcschefback, void, env, tl) 84DEF_HELPER_2(mtc0_entrylo1, void, env, tl) 85DEF_HELPER_2(mtc0_context, void, env, tl) 86DEF_HELPER_2(mtc0_memorymapid, void, env, tl) 87DEF_HELPER_2(mtc0_pagemask, void, env, tl) 88DEF_HELPER_2(mtc0_pagegrain, void, env, tl) 89DEF_HELPER_2(mtc0_segctl0, void, env, tl) 90DEF_HELPER_2(mtc0_segctl1, void, env, tl) 91DEF_HELPER_2(mtc0_segctl2, void, env, tl) 92DEF_HELPER_2(mtc0_pwfield, void, env, tl) 93DEF_HELPER_2(mtc0_pwsize, void, env, tl) 94DEF_HELPER_2(mtc0_wired, void, env, tl) 95DEF_HELPER_2(mtc0_srsconf0, void, env, tl) 96DEF_HELPER_2(mtc0_srsconf1, void, env, tl) 97DEF_HELPER_2(mtc0_srsconf2, void, env, tl) 98DEF_HELPER_2(mtc0_srsconf3, void, env, tl) 99DEF_HELPER_2(mtc0_srsconf4, void, env, tl) 100DEF_HELPER_2(mtc0_hwrena, void, env, tl) 101DEF_HELPER_2(mtc0_pwctl, void, env, tl) 102DEF_HELPER_2(mtc0_count, void, env, tl) 103DEF_HELPER_2(mtc0_entryhi, void, env, tl) 104DEF_HELPER_2(mttc0_entryhi, void, env, tl) 105DEF_HELPER_2(mtc0_compare, void, env, tl) 106DEF_HELPER_2(mtc0_status, void, env, tl) 107DEF_HELPER_2(mttc0_status, void, env, tl) 108DEF_HELPER_2(mtc0_intctl, void, env, tl) 109DEF_HELPER_2(mtc0_srsctl, void, env, tl) 110DEF_HELPER_2(mtc0_cause, void, env, tl) 111DEF_HELPER_2(mttc0_cause, void, env, tl) 112DEF_HELPER_2(mtc0_ebase, void, env, tl) 113DEF_HELPER_2(mttc0_ebase, void, env, tl) 114DEF_HELPER_2(mtc0_config0, void, env, tl) 115DEF_HELPER_2(mtc0_config2, void, env, tl) 116DEF_HELPER_2(mtc0_config3, void, env, tl) 117DEF_HELPER_2(mtc0_config4, void, env, tl) 118DEF_HELPER_2(mtc0_config5, void, env, tl) 119DEF_HELPER_2(mtc0_lladdr, void, env, tl) 120DEF_HELPER_2(mtc0_maar, void, env, tl) 121DEF_HELPER_2(mthc0_maar, void, env, tl) 122DEF_HELPER_2(mtc0_maari, void, env, tl) 123DEF_HELPER_3(mtc0_watchlo, void, env, tl, i32) 124DEF_HELPER_3(mtc0_watchhi, void, env, tl, i32) 125DEF_HELPER_3(mthc0_watchhi, void, env, tl, i32) 126DEF_HELPER_2(mtc0_xcontext, void, env, tl) 127DEF_HELPER_2(mtc0_framemask, void, env, tl) 128DEF_HELPER_2(mtc0_debug, void, env, tl) 129DEF_HELPER_2(mttc0_debug, void, env, tl) 130DEF_HELPER_2(mtc0_performance0, void, env, tl) 131DEF_HELPER_2(mtc0_errctl, void, env, tl) 132DEF_HELPER_2(mtc0_taglo, void, env, tl) 133DEF_HELPER_2(mtc0_datalo, void, env, tl) 134DEF_HELPER_2(mtc0_taghi, void, env, tl) 135DEF_HELPER_2(mtc0_datahi, void, env, tl) 136 137#if defined(TARGET_MIPS64) 138DEF_HELPER_2(dmtc0_entrylo0, void, env, i64) 139DEF_HELPER_2(dmtc0_entrylo1, void, env, i64) 140#endif 141 142/* MIPS MT functions */ 143DEF_HELPER_2(mftgpr, tl, env, i32) 144DEF_HELPER_2(mftlo, tl, env, i32) 145DEF_HELPER_2(mfthi, tl, env, i32) 146DEF_HELPER_2(mftacx, tl, env, i32) 147DEF_HELPER_1(mftdsp, tl, env) 148DEF_HELPER_3(mttgpr, void, env, tl, i32) 149DEF_HELPER_3(mttlo, void, env, tl, i32) 150DEF_HELPER_3(mtthi, void, env, tl, i32) 151DEF_HELPER_3(mttacx, void, env, tl, i32) 152DEF_HELPER_2(mttdsp, void, env, tl) 153DEF_HELPER_0(dmt, tl) 154DEF_HELPER_0(emt, tl) 155DEF_HELPER_1(dvpe, tl, env) 156DEF_HELPER_1(evpe, tl, env) 157 158/* R6 Multi-threading */ 159DEF_HELPER_1(dvp, tl, env) 160DEF_HELPER_1(evp, tl, env) 161 162/* TLB */ 163DEF_HELPER_1(tlbwi, void, env) 164DEF_HELPER_1(tlbwr, void, env) 165DEF_HELPER_1(tlbp, void, env) 166DEF_HELPER_1(tlbr, void, env) 167DEF_HELPER_1(tlbinv, void, env) 168DEF_HELPER_1(tlbinvf, void, env) 169DEF_HELPER_3(ginvt, void, env, tl, i32) 170 171/* Special */ 172DEF_HELPER_1(di, tl, env) 173DEF_HELPER_1(ei, tl, env) 174DEF_HELPER_1(eret, void, env) 175DEF_HELPER_1(eretnc, void, env) 176DEF_HELPER_1(deret, void, env) 177DEF_HELPER_3(cache, void, env, tl, i32) 178 179#ifdef TARGET_MIPS64 180/* Longson CSR */ 181DEF_HELPER_2(lcsr_rdcsr, i64, env, tl) 182DEF_HELPER_2(lcsr_drdcsr, i64, env, tl) 183DEF_HELPER_3(lcsr_wrcsr, void, env, tl, tl) 184DEF_HELPER_3(lcsr_dwrcsr, void, env, tl, tl) 185#endif 186