(0 << 2) | // 3:2
0; // 1:0
+ miscRegs[MISCREG_CPACR] = 0;
+ miscRegs[MISCREG_FPSID] = 0x410430A0;
//XXX We need to initialize the rest of the state.
}
exec_output = ""
vmsrIop = InstObjParams("vmsr", "Vmsr", "FpRegRegOp",
- { "code": vmsrrsEnabledCheckCode + \
+ { "code": vmsrEnabledCheckCode + \
"MiscDest = Op1;",
"predicate_test": predicateTest }, [])
header_output += FpRegRegOpDeclare.subst(vmsrIop);
decoder_output += FpRegRegOpConstructor.subst(vmsrIop);
exec_output += PredOpExecute.subst(vmsrIop);
- vmsrFpscrCode = vmsrrsEnabledCheckCode + '''
+ vmsrFpscrCode = vmsrEnabledCheckCode + '''
Fpscr = Op1 & ~FpCondCodesMask;
FpCondCodes = Op1 & FpCondCodesMask;
'''
exec_output += PredOpExecute.subst(vmsrFpscrIop);
vmrsIop = InstObjParams("vmrs", "Vmrs", "FpRegRegOp",
- { "code": vmsrrsEnabledCheckCode + \
+ { "code": vmrsEnabledCheckCode + \
"Dest = MiscOp1;",
"predicate_test": predicateTest }, [])
header_output += FpRegRegOpDeclare.subst(vmrsIop);
exec_output += PredOpExecute.subst(vmrsIop);
vmrsFpscrIop = InstObjParams("vmrs", "VmrsFpscr", "FpRegRegOp",
- { "code": vmsrrsEnabledCheckCode + \
+ { "code": vmrsEnabledCheckCode + \
"Dest = Fpscr | FpCondCodes;",
"predicate_test": predicateTest }, [])
header_output += FpRegRegOpDeclare.subst(vmrsFpscrIop);
decoder_output += FpRegRegOpConstructor.subst(vmrsFpscrIop);
exec_output += PredOpExecute.subst(vmrsFpscrIop);
- vmrsApsrCode = vmsrrsEnabledCheckCode + '''
+ vmrsApsrCode = vmrsEnabledCheckCode + '''
Dest = (MiscOp1 & imm) | (Dest & ~imm);
'''
vmrsApsrIop = InstObjParams("vmrs", "VmrsApsr", "FpRegRegImmOp",
decoder_output += FpRegRegImmOpConstructor.subst(vmrsApsrIop);
exec_output += PredOpExecute.subst(vmrsApsrIop);
- vmrsApsrFpscrCode = vmsrrsEnabledCheckCode + '''
+ vmrsApsrFpscrCode = vmrsEnabledCheckCode + '''
assert((imm & ~FpCondCodesMask) == 0);
Dest = (FpCondCodes & imm) | (Dest & ~imm);
'''
if not self.post:
eaCode += self.offset
eaCode += ";"
+
+ if self.flavor == "fp":
+ eaCode += vfpEnabledCheckCode
+
self.codeBlobs["ea_code"] = eaCode
# Code that actually handles the access
if not self.post:
eaCode += self.offset
eaCode += ";"
+
+ if self.flavor == "fp":
+ eaCode += vfpEnabledCheckCode
+
self.codeBlobs["ea_code"] = eaCode
# Code that actually handles the access
microLdrFpUopIop = InstObjParams('ldrfp_uop', 'MicroLdrFpUop',
'MicroMemOp',
{'memacc_code': microLdrFpUopCode,
- 'ea_code':
+ 'ea_code': vfpEnabledCheckCode +
'EA = Rb + (up ? imm : -imm);',
'predicate_test': predicateTest},
['IsMicroop'])
microLdrDBFpUopIop = InstObjParams('ldrfp_uop', 'MicroLdrDBFpUop',
'MicroMemOp',
{'memacc_code': microLdrFpUopCode,
- 'ea_code': '''
+ 'ea_code': vfpEnabledCheckCode + '''
EA = Rb + (up ? imm : -imm) +
(((CPSR)Cpsr).e ? 4 : 0);
''',
microLdrDTFpUopIop = InstObjParams('ldrfp_uop', 'MicroLdrDTFpUop',
'MicroMemOp',
{'memacc_code': microLdrFpUopCode,
- 'ea_code': '''
+ 'ea_code': vfpEnabledCheckCode + '''
EA = Rb + (up ? imm : -imm) -
(((CPSR)Cpsr).e ? 4 : 0);
''',
'MicroMemOp',
{'memacc_code': microStrFpUopCode,
'postacc_code': "",
- 'ea_code': 'EA = Rb + (up ? imm : -imm);',
+ 'ea_code': vfpEnabledCheckCode +
+ 'EA = Rb + (up ? imm : -imm);',
'predicate_test': predicateTest},
['IsMicroop'])
'MicroMemOp',
{'memacc_code': microStrFpUopCode,
'postacc_code': "",
- 'ea_code': '''
+ 'ea_code': vfpEnabledCheckCode + '''
EA = Rb + (up ? imm : -imm) +
(((CPSR)Cpsr).e ? 4 : 0);
''',
'MicroMemOp',
{'memacc_code': microStrFpUopCode,
'postacc_code': "",
- 'ea_code': '''
+ 'ea_code': vfpEnabledCheckCode + '''
EA = Rb + (up ? imm : -imm) -
(((CPSR)Cpsr).e ? 4 : 0);
''',
{ 'mem_decl' : memDecl,
'size' : size,
'memacc_code' : loadMemAccCode,
- 'ea_code' : eaCode,
+ 'ea_code' : simdEnabledCheckCode + eaCode,
'predicate_test' : predicateTest },
[ 'IsMicroop', 'IsMemRef', 'IsLoad' ])
storeIop = InstObjParams('strneon%(size)d_uop' % subst,
{ 'mem_decl' : memDecl,
'size' : size,
'memacc_code' : storeMemAccCode,
- 'ea_code' : eaCode,
+ 'ea_code' : simdEnabledCheckCode + eaCode,
'predicate_test' : predicateTest },
[ 'IsMicroop', 'IsMemRef', 'IsStore' ])
}
}};
-let {{
- simdEnabledCheckCode = '''
- if (!neonEnabled(Cpacr, Cpsr, Fpexc))
- return disabledFault();
- '''
-}};
-
let {{
header_output = ""
RegVect srcReg1, srcReg2, destReg;
'''
for reg in range(rCount):
- eWalkCode += '''
+ eWalkCode += simdEnabledCheckCode + '''
srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d.uw);
srcReg2.regs[%(reg)d] = htog(FpOp2P%(reg)d.uw);
''' % { "reg" : reg }
if not self.post:
eaCode += self.offset
eaCode += ";"
+
+ if self.flavor == "fp":
+ eaCode += vfpEnabledCheckCode
+
self.codeBlobs["ea_code"] = eaCode
# Code that actually handles the access
if not self.post:
eaCode += self.offset
eaCode += ";"
+
+ if self.flavor == "fp":
+ eaCode += vfpEnabledCheckCode
+
self.codeBlobs["ea_code"] = eaCode
# Code that actually handles the access
//
// Authors: Gabe Black
+let {{
+ simdEnabledCheckCode = '''
+ if (!neonEnabled(Cpacr, Cpsr, Fpexc))
+ return disabledFault();
+ '''
+}};
+
+
def template NeonRegRegRegOpDeclare {{
template <class _Element>
class %(class_name)s : public %(base_class)s
return disabledFault();
'''
- vmsrrsEnabledCheckCode = '''
+ vmsrEnabledCheckCode = '''
if (!vfpEnabled(Cpacr, Cpsr))
- return disabledFault();
+ if (dest != (int)MISCREG_FPEXC && dest != (int)MISCREG_FPSID)
+ return disabledFault();
+ if (!inPrivilegedMode(Cpsr))
+ if (dest != (int)MISCREG_FPSCR)
+ return disabledFault();
+
+ '''
+
+ vmrsEnabledCheckCode = '''
+ if (!vfpEnabled(Cpacr, Cpsr))
+ if (op1 != (int)MISCREG_FPEXC && op1 != (int)MISCREG_FPSID &&
+ op1 != (int)MISCREG_MVFR0 && op1 != (int)MISCREG_MVFR1)
+ return disabledFault();
+ if (!inPrivilegedMode(Cpsr))
+ if (op1 != (int)MISCREG_FPSCR)
+ return disabledFault();
'''
}};
vfpEnabled(CPACR cpacr, CPSR cpsr)
{
return cpacr.cp10 == 0x3 ||
- (cpacr.cp10 == 0x2 && inPrivilegedMode(cpsr));
+ (cpacr.cp10 == 0x1 && inPrivilegedMode(cpsr));
}
static inline bool