trap.isa revision 2686:f0d591379ac3
1// -*- mode:c++ -*-
2
3////////////////////////////////////////////////////////////////////
4//
5// Trap instructions
6//
7
8output header {{
9        /**
10         * Base class for integer operations.
11         */
12        class Trap : public MipsStaticInst
13        {
14                protected:
15
16                /// Constructor
17                Trap(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass)
18                {
19                }
20
21                std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
22        };
23}};
24
25output decoder {{
26        std::string Trap::generateDisassembly(Addr pc, const SymbolTable *symtab) const
27        {
28                return "Disassembly of trap instruction\n";
29        }
30}};
31
32def template TrapExecute {{
33        //Edit This Template When Traps Are Implemented
34        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
35        {
36                //Write the resulting state to the execution context
37                %(op_wb)s;
38
39                //Call into the trap handler with the appropriate fault
40                return No_Fault;
41        }
42}};
43
44def format Trap(code, *flags) {{
45        code = 'panic(\"'
46        code += 'Trap Exception Handler Is Currently Not Implemented.'
47        code += '\");'
48        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
49        header_output = BasicDeclare.subst(iop)
50        decoder_output = BasicConstructor.subst(iop)
51        decode_block = BasicDecode.subst(iop)
52        exec_output = BasicExecute.subst(iop)
53}};
54