trap.isa revision 2022
1360SN/A//////////////////////////////////////////////////////////////////// 21458SN/A// 3360SN/A// Trap instructions 4360SN/A// 5360SN/A 6360SN/Aoutput header {{ 7360SN/A /** 8360SN/A * Base class for integer operations. 9360SN/A */ 10360SN/A class Trap : public SparcStaticInst 11360SN/A { 12360SN/A protected: 13360SN/A 14360SN/A /// Constructor 15360SN/A Trap(const char *mnem, MachInst _machInst, OpClass __opClass) : SparcStaticInst(mnem, _machInst, __opClass) 16360SN/A { 17360SN/A } 18360SN/A 19360SN/A std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const; 20360SN/A }; 21360SN/A}}; 22360SN/A 23360SN/Aoutput decoder {{ 24360SN/A std::string Trap::generateDisassembly(Addr pc, const SymbolTable *symtab) const 25360SN/A { 26360SN/A return "Disassembly of integer instruction\n"; 272665Ssaidi@eecs.umich.edu } 282665Ssaidi@eecs.umich.edu}}; 292665Ssaidi@eecs.umich.edu 30360SN/Adef template TrapExecute {{ 31360SN/A Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const 322093SN/A { 33360SN/A //Call into the trap handler with the appropriate fault 34360SN/A return No_Fault; 35360SN/A } 36360SN/A 37360SN/A //Write the resulting state to the execution context 38360SN/A %(op_wb)s; 392474SN/A 40360SN/A return No_Fault; 416658Snate@binkert.org } 422680Sktlim@umich.edu}}; 431717SN/A 442474SN/A// Primary format for integer operate instructions: 45360SN/Adef format Trap(code, *opt_flags) {{ 466029Ssteve.reinhardt@amd.com orig_code = code 472667Sstever@eecs.umich.edu cblk = CodeBlock(code) 48360SN/A iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags) 49360SN/A header_output = BasicDeclare.subst(iop) 502107SN/A decoder_output = BasicConstructor.subst(iop) 51360SN/A decode_block = BasicDecodeWithMnemonic.subst(iop) 52360SN/A exec_output = TrapExecute.subst(iop) 533114Sgblack@eecs.umich.edu}}; 54360SN/A