trap.isa revision 2686
12686Sksewell@umich.edu// -*- mode:c++ -*-
22686Sksewell@umich.edu
32022SN/A////////////////////////////////////////////////////////////////////
42022SN/A//
52022SN/A// Trap instructions
62022SN/A//
72022SN/A
82022SN/Aoutput header {{
92022SN/A        /**
102022SN/A         * Base class for integer operations.
112022SN/A         */
122028SN/A        class Trap : public MipsStaticInst
132022SN/A        {
142022SN/A                protected:
152022SN/A
162022SN/A                /// Constructor
172028SN/A                Trap(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass)
182022SN/A                {
192022SN/A                }
202022SN/A
212022SN/A                std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
222022SN/A        };
232022SN/A}};
242022SN/A
252022SN/Aoutput decoder {{
262022SN/A        std::string Trap::generateDisassembly(Addr pc, const SymbolTable *symtab) const
272022SN/A        {
282686Sksewell@umich.edu                return "Disassembly of trap instruction\n";
292022SN/A        }
302022SN/A}};
312022SN/A
322022SN/Adef template TrapExecute {{
332686Sksewell@umich.edu        //Edit This Template When Traps Are Implemented
342022SN/A        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
352022SN/A        {
362022SN/A                //Write the resulting state to the execution context
372022SN/A                %(op_wb)s;
382022SN/A
392686Sksewell@umich.edu                //Call into the trap handler with the appropriate fault
402022SN/A                return No_Fault;
412022SN/A        }
422022SN/A}};
432022SN/A
442239SN/Adef format Trap(code, *flags) {{
452686Sksewell@umich.edu        code = 'panic(\"'
462686Sksewell@umich.edu        code += 'Trap Exception Handler Is Currently Not Implemented.'
472686Sksewell@umich.edu        code += '\");'
482239SN/A        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
492022SN/A        header_output = BasicDeclare.subst(iop)
502022SN/A        decoder_output = BasicConstructor.subst(iop)
512239SN/A        decode_block = BasicDecode.subst(iop)
522239SN/A        exec_output = BasicExecute.subst(iop)
532022SN/A}};
54