First steps toward getting full system to work with
[gem5.git] / arch / mips / isa / formats / trap.isa
1 ////////////////////////////////////////////////////////////////////
2 //
3 // Trap instructions
4 //
5
6 output header {{
7 /**
8 * Base class for integer operations.
9 */
10 class Trap : public MipsStaticInst
11 {
12 protected:
13
14 /// Constructor
15 Trap(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass)
16 {
17 }
18
19 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
20 };
21 }};
22
23 output decoder {{
24 std::string Trap::generateDisassembly(Addr pc, const SymbolTable *symtab) const
25 {
26 return "Disassembly of integer instruction\n";
27 }
28 }};
29
30 def template TrapExecute {{
31 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
32 {
33 //Call into the trap handler with the appropriate fault
34 return No_Fault;
35 }
36
37 //Write the resulting state to the execution context
38 %(op_wb)s;
39
40 return No_Fault;
41 }
42 }};
43
44 // Primary format for integer operate instructions:
45 def format Trap(code, *flags) {{
46 code = 'bool cond;\n' + code;
47 iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
48 header_output = BasicDeclare.subst(iop)
49 decoder_output = BasicConstructor.subst(iop)
50 decode_block = BasicDecode.subst(iop)
51 exec_output = BasicExecute.subst(iop)
52 }};