Renovate the "fault" microop implementation.

--HG--
extra : convert_revision : dc9d67dd5413f00f16d37cb2d0f8b0d10971e14a
This commit is contained in:
Gabe Black 2007-06-19 14:50:35 +00:00
parent 056cfc345b
commit ebe4d05f70

View file

@ -59,8 +59,27 @@
// //
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
def template MicroFaultExecute {{ output header {{
Fault %(class_name)s ::execute(%(CPU_exec_context)s *xc, class MicroFault : public X86MicroopBase
{
protected:
Fault fault;
void buildMe();
public:
MicroFault(ExtMachInst _machInst, const char * instMnem,
bool isMicro, bool isDelayed, bool isFirst, bool isLast,
Fault _fault);
MicroFault(ExtMachInst _machInst, const char * instMnem,
Fault _fault);
%(BasicExecDeclare)s
};
}};
output decoder {{
Fault MicroFault::execute(%(CPU_exec_context)s *xc,
Trace::InstRecord *traceData) const Trace::InstRecord *traceData) const
{ {
//Return the fault we were constructed with //Return the fault we were constructed with
@ -68,58 +87,35 @@ def template MicroFaultExecute {{
} }
}}; }};
def template MicroFaultDeclare {{ output decoder {{
class %(class_name)s : public X86MicroopBase inline MicroFault::MicroFault(
{
protected:
Fault fault;
void buildMe();
public:
%(class_name)s(ExtMachInst _machInst,
const char * instMnem,
bool isMicro, bool isDelayed, bool isFirst, bool isLast,
Fault _fault);
%(class_name)s(ExtMachInst _machInst,
const char * instMnem,
Fault _fault);
%(BasicExecDeclare)s
};
}};
def template MicroFaultConstructor {{
inline void %(class_name)s::buildMe()
{
%(constructor)s;
}
inline %(class_name)s::%(class_name)s(
ExtMachInst machInst, const char * instMnem, Fault _fault) : ExtMachInst machInst, const char * instMnem, Fault _fault) :
%(base_class)s(machInst, "%(mnemonic)s", instMnem, X86MicroopBase(machInst, "fault", instMnem,
false, false, false, false, %(op_class)s), fault(_fault) false, false, false, false, No_OpClass), fault(_fault)
{ {
buildMe();
} }
inline %(class_name)s::%(class_name)s( inline MicroFault::MicroFault(
ExtMachInst machInst, const char * instMnem, ExtMachInst machInst, const char * instMnem,
bool isMicro, bool isDelayed, bool isFirst, bool isLast, bool isMicro, bool isDelayed, bool isFirst, bool isLast,
Fault _fault) : Fault _fault) :
%(base_class)s(machInst, "%(mnemonic)s", instMnem, X86MicroopBase(machInst, "fault", instMnem,
isMicro, isDelayed, isFirst, isLast, %(op_class)s), isMicro, isDelayed, isFirst, isLast, No_OpClass),
fault(_fault) fault(_fault)
{ {
buildMe();
} }
}}; }};
let {{ let {{
# This microop takes in a single parameter, a fault to return. class Fault(X86Microop):
iop = InstObjParams("fault", "GenFault", 'X86MicroopBase', {"code" : ""}) def __init__(self, fault):
header_output += MicroFaultDeclare.subst(iop) self.fault = fault
decoder_output += MicroFaultConstructor.subst(iop)
exec_output += MicroFaultExecute.subst(iop) def getAllocator(self, *microFlags):
allocator = '''new MicroFault(machInst, mnemonic
%(flags)s, %(fault)s)''' % {
"flags" : self.microFlagsText(microFlags),
"fault" : self.fault}
return allocator
microopClasses["fault"] = Fault
}}; }};