45d44
< %(priv_check)s;
48,49c47
< fault = xc->read(EA, (uint%(mem_acc_size)s_t&)Mem, 0);
< %(code)s;
---
> %(fault_check)s;
51a50,57
> fault = xc->read(EA, (uint%(mem_acc_size)s_t&)Mem, 0);
> }
> if(fault == NoFault)
> {
> %(code)s;
> }
> if(fault == NoFault)
> {
67d72
< %(priv_check)s;
69c74,78
< fault = xc->read(EA, (uint%(mem_acc_size)s_t&)Mem, 0);
---
> %(fault_check)s;
> if(fault == NoFault)
> {
> fault = xc->read(EA, (uint%(mem_acc_size)s_t&)Mem, 0);
> }
99d107
< %(priv_check)s;
102,103c110
< %(code)s;
<
---
> %(fault_check)s;
105a113,116
> %(code)s;
> }
> if(fault == NoFault)
> {
125d135
< %(priv_check)s;
128c138
< %(code)s;
---
> %(fault_check)s;
130a141,144
> %(code)s;
> }
> if(fault == NoFault)
> {
157a172,200
> //Here are some code snippets which check for various fault conditions
> let {{
> # The LSB can be zero, since it's really the MSB in doubles and quads
> # and we're dealing with doubles
> BlockAlignmentFaultCheck = '''
> if(RD & 0xe)
> fault = new IllegalInstruction;
> else if(EA & 0x3f)
> fault = new MemAddressNotAligned;
> '''
> # XXX Need to take care of pstate.hpriv as well. The lower ASIs
> # are split into ones that are available in priv and hpriv, and
> # those that are only available in hpriv
> AlternateASIPrivFaultCheck = '''
> if(bits(Pstate,2,2) == 0 && (EXT_ASI & 0x80) == 0)
> fault = new PrivilegedAction;
> else if(AsiIsAsIfUser((ASI)EXT_ASI) && !bits(Pstate,2,2))
> fault = new PrivilegedAction;
> '''
>
> }};
>
> //A simple function to generate the name of the macro op of a certain
> //instruction at a certain micropc
> let {{
> def makeMicroName(name, microPc):
> return name + "::" + name + "_" + str(microPc)
> }};
>
160c203
< //privelege checks and the actual code all occur in the same function,
---
> //fault checks and the actual code all occur in the same function,
165c208
< priv, nameReg, nameImm, NameReg, NameImm, opt_flags):
---
> faultCode, nameReg, nameImm, NameReg, NameImm, opt_flags):
172c215
< opt_flags, {"priv_check": priv})
---
> opt_flags, {"fault_check": faultCode})
174c217
< {"priv_check": priv, "ea_code" : eaCode})
---
> {"fault_check": faultCode, "ea_code" : eaCode})