1 ////////////////////////////////////////////////////////////////////
8 * Base class for trap instructions,
9 * or instructions that always fault.
11 class Trap : public SparcStaticInst
16 Trap(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
17 SparcStaticInst(mnem, _machInst, __opClass), trapNum(SW_TRAP)
21 std::string generateDisassembly(Addr pc,
22 const SymbolTable *symtab) const;
29 std::string Trap::generateDisassembly(Addr pc,
30 const SymbolTable *symtab) const
32 std::stringstream response;
34 printMnemonic(response, mnemonic);
35 ccprintf(response, " ");
36 printReg(response, _srcRegIdx[0]);
37 ccprintf(response, ", 0x%x", trapNum);
38 ccprintf(response, ", or ");
39 printReg(response, _srcRegIdx[1]);
40 return response.str();
44 def template TrapExecute {{
45 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
46 Trace::InstRecord *traceData) const
48 Fault fault = NoFault;
56 def format Trap(code, *opt_flags) {{
58 cblk = CodeBlock(code)
59 iop = InstObjParams(name, Name, 'Trap', cblk, opt_flags)
60 header_output = BasicDeclare.subst(iop)
61 decoder_output = BasicConstructor.subst(iop)
62 decode_block = BasicDecode.subst(iop)
63 exec_output = TrapExecute.subst(iop)