Basics

TCG Frontend Ops1 implements supported operations for the targe CPU (what QEMU executes; not where QEMU executes).

[tcg/tcg.h]() contains frontend helpers.

// file // tcg/tcg.h

ALL CHERI/MIPS Instructinos are defined as emulating functions in target/mips/helper.h

// file
//  target/mips/helper.h

// QEMU-CHERI extension:
DEF_HELPER_1(mfc0_rtc64, i64, env)
DEF_HELPER_2(mtc0_rtc64, void, env, i64)
// BERI extension:
DEF_HELPER_1(mfc0_coreid, tl, env)

DEF_HELPER_2(cheri_debug_message, void, env, i64)

#if defined(TARGET_CHERI)
DEF_HELPER_2(mtc2_dumpcstate, void, env, tl)
DEF_HELPER_1(ccheck_btarget, void, env)
DEF_HELPER_2(ccheck_pc, void, env, i64)
DEF_HELPER_3(ccheck_store, tl, env, tl, i32)
DEF_HELPER_3(ccheck_store_right, tl, env, tl, i32)
DEF_HELPER_3(ccheck_load, tl, env, tl, i32)
DEF_HELPER_3(ccheck_load_right, tl, env, tl, i32)
DEF_HELPER_5(cinvalidate_tag, void, env, tl, i32, i32, tl)
DEF_HELPER_5(cinvalidate_tag_left_right, void, env, tl, i32, i32, tl)
DEF_HELPER_5(cinvalidate_tag32, void, env, tl, i32, i32, i32)
DEF_HELPER_4(candperm, void, env, i32, i32, tl)
DEF_HELPER_3(cbez, tl, env, i32, i32)
DEF_HELPER_3(cbnz, tl, env, i32, i32)
DEF_HELPER_3(cbts, tl, env, i32, i32)
DEF_HELPER_3(cbtu, tl, env, i32, i32)
DEF_HELPER_3(ccall, void, env, i32, i32)
DEF_HELPER_3(ccall_notrap, tl, env, i32, i32)
DEF_HELPER_3(ccheckperm, void, env, i32, tl)
DEF_HELPER_3(cchecktype, void, env, i32, i32)
DEF_HELPER_2(cclearreg, void, env, i32)
DEF_HELPER_3(ccleartag, void, env, i32, i32)
DEF_HELPER_4(cfromptr, void, env, i32, i32, tl)
DEF_HELPER_2(cgetaddr, tl, env, i32)
DEF_HELPER_2(cgetbase, tl, env, i32)
DEF_HELPER_1(cgetcause, tl, env)
DEF_HELPER_2(cgetlen, tl, env, i32)
DEF_HELPER_2(cgetoffset, tl, env, i32)
DEF_HELPER_2(cgetpcc, void, env, i32)
DEF_HELPER_3(cgetpccsetoffset, void, env, i32, tl)
DEF_HELPER_2(cgetperm, tl, env, i32)
DEF_HELPER_2(cgetsealed, tl, env, i32)
DEF_HELPER_2(cgettag, tl, env, i32)
DEF_HELPER_2(cgettype, tl, env, i32)
DEF_HELPER_4(cincbase, void, env, i32, i32, tl)
DEF_HELPER_4(cincoffset, void, env, i32, i32, tl)
DEF_HELPER_3(cjalr, tl, env, i32, i32)
DEF_HELPER_2(cjr, tl, env, i32)
DEF_HELPER_1(creturn, void, env)
DEF_HELPER_4(cseal, void, env, i32, i32, i32)
DEF_HELPER_4(ccseal, void, env, i32, i32, i32)
DEF_HELPER_4(csetbounds, void, env, i32, i32, tl)
DEF_HELPER_4(csetboundsexact, void, env, i32, i32, tl)
DEF_HELPER_2(crap, tl, env, tl)
DEF_HELPER_2(cram, tl, env, tl)
DEF_HELPER_3(csub, tl, env, i32, i32)
DEF_HELPER_2(csetcause, void, env, tl)
DEF_HELPER_4(csetlen, void, env, i32, i32, tl)
DEF_HELPER_4(csetoffset, void, env, i32, i32, tl)
DEF_HELPER_3(ctoptr, tl, env, i32, i32)
DEF_HELPER_4(cunseal, void, env, i32, i32, i32)
DEF_HELPER_4(cmovz, void, env, i32, i32, tl)
DEF_HELPER_4(cmovn, void, env, i32, i32, tl)
DEF_HELPER_4(cbuildcap, void, env, i32, i32, i32)
DEF_HELPER_4(ccopytype, void, env, i32, i32, i32)

DEF_HELPER_3(creadhwr, void, env, i32, i32)
DEF_HELPER_3(cwritehwr, void, env, i32, i32)
DEF_HELPER_3(csealentry, void, env, i32, i32)
DEF_HELPER_3(cloadtags, tl, env, i32, i64)

DEF_HELPER_3(ceq, tl, env, i32, i32)
DEF_HELPER_3(cne, tl, env, i32, i32)
DEF_HELPER_3(clt, tl, env, i32, i32)
DEF_HELPER_3(cle, tl, env, i32, i32)
DEF_HELPER_3(cltu, tl, env, i32, i32)
DEF_HELPER_3(cleu, tl, env, i32, i32)
DEF_HELPER_3(cexeq, tl, env, i32, i32)
DEF_HELPER_3(cnexeq, tl, env, i32, i32)
DEF_HELPER_4(csetaddr, void, env, i32, i32, tl)
DEF_HELPER_3(cgetandaddr, tl, env, i32, tl)
DEF_HELPER_4(candaddr, void, env, i32, i32, tl)
DEF_HELPER_3(ctestsubset, tl, env, i32, i32)

DEF_HELPER_5(cload, tl, env, i32, tl, i32, i32)

DEF_HELPER_5(cstore, tl, env, i32, tl, i32, i32)

DEF_HELPER_3(cloadlinked, tl, env, i32, i32)

DEF_HELPER_3(cstorecond, tl, env, i32, i32)

DEF_HELPER_3(cscc_without_tcg, tl, env, i32, i32)
DEF_HELPER_5(csc_without_tcg, void, env, i32, i32, tl, i32)
DEF_HELPER_5(clc_without_tcg, void, env, i32, i32, tl, i32)
DEF_HELPER_3(cllc_without_tcg, void, env, i32, i32)
#endif



#if defined(TARGET_CHERI)
/* cannot access EPC directly since it is the offset of EPCC */
DEF_HELPER_1(mfc0_epc, tl, env)
DEF_HELPER_2(mtc0_epc, void, env, tl)
DEF_HELPER_1(mfc0_error_epc, tl, env)
DEF_HELPER_2(mtc0_error_epc, void, env, tl)
#endif


#if defined(TARGET_CHERI)
DEF_HELPER_2(rdhwr_statcounters_icount, tl, env, i32)
DEF_HELPER_1(rdhwr_statcounters_reset, tl, env)
DEF_HELPER_1(rdhwr_statcounters_itlb_miss, tl, env)
DEF_HELPER_1(rdhwr_statcounters_dtlb_miss, tl, env)
DEF_HELPER_2(rdhwr_statcounters_memory, tl, env, i32)
DEF_HELPER_2(rdhwr_statcounters_ignored, tl, env, i32)
#endif

New instruction

TCG frontend.

TCG Frontend

TCG Basics

DecodeTree Specification

Created Sep 20, 2019 // Last Updated May 27, 2020

If you could revise
the fundmental principles of
computer system design
to improve security...

... what would you change?