{
// Shift Rm by an immediate value
int32_t
-ArmStaticInstBase::shift_rm_imm(uint32_t base, uint32_t shamt,
+ArmStaticInst::shift_rm_imm(uint32_t base, uint32_t shamt,
uint32_t type, uint32_t cfval) const
{
assert(shamt < 32);
// Shift Rm by Rs
int32_t
-ArmStaticInstBase::shift_rm_rs(uint32_t base, uint32_t shamt,
+ArmStaticInst::shift_rm_rs(uint32_t base, uint32_t shamt,
uint32_t type, uint32_t cfval) const
{
enum ArmShiftType shiftType;
// Generate C for a shift by immediate
bool
-ArmStaticInstBase::shift_carry_imm(uint32_t base, uint32_t shamt,
+ArmStaticInst::shift_carry_imm(uint32_t base, uint32_t shamt,
uint32_t type, uint32_t cfval) const
{
enum ArmShiftType shiftType;
// Generate C for a shift by Rs
bool
-ArmStaticInstBase::shift_carry_rs(uint32_t base, uint32_t shamt,
+ArmStaticInst::shift_carry_rs(uint32_t base, uint32_t shamt,
uint32_t type, uint32_t cfval) const
{
enum ArmShiftType shiftType;
void
-ArmStaticInstBase::printReg(std::ostream &os, int reg) const
+ArmStaticInst::printReg(std::ostream &os, int reg) const
{
if (reg < FP_Base_DepTag) {
switch (reg) {
}
void
-ArmStaticInstBase::printMnemonic(std::ostream &os,
+ArmStaticInst::printMnemonic(std::ostream &os,
const std::string &suffix,
bool withPred) const
{
}
void
-ArmStaticInstBase::printMemSymbol(std::ostream &os,
+ArmStaticInst::printMemSymbol(std::ostream &os,
const SymbolTable *symtab,
const std::string &prefix,
const Addr addr,
}
void
-ArmStaticInstBase::printShiftOperand(std::ostream &os,
+ArmStaticInst::printShiftOperand(std::ostream &os,
IntRegIndex rm,
bool immShift,
uint32_t shiftAmt,
}
void
-ArmStaticInstBase::printDataInst(std::ostream &os, bool withImm,
+ArmStaticInst::printDataInst(std::ostream &os, bool withImm,
bool immShift, bool s, IntRegIndex rd, IntRegIndex rn,
IntRegIndex rm, IntRegIndex rs, uint32_t shiftAmt,
ArmShiftType type, uint32_t imm) const
}
std::string
-ArmStaticInstBase::generateDisassembly(Addr pc,
+ArmStaticInst::generateDisassembly(Addr pc,
const SymbolTable *symtab) const
{
std::stringstream ss;
namespace ArmISA
{
-class ArmStaticInstBase : public StaticInst
+class ArmStaticInst : public StaticInst
{
protected:
int32_t shift_rm_imm(uint32_t base, uint32_t shamt,
uint32_t type, uint32_t cfval) const;
// Constructor
- ArmStaticInstBase(const char *mnem, ExtMachInst _machInst,
- OpClass __opClass)
+ ArmStaticInst(const char *mnem, ExtMachInst _machInst,
+ OpClass __opClass)
: StaticInst(mnem, _machInst, __opClass)
{
}
return pc + 8;
}
+ // Perform an regular branch.
template<class XC>
static void
setNextPC(XC *xc, Addr val)
xc->setNextPC((xc->readNextPC() & PcModeMask) |
(val & ~PcModeMask));
}
-};
-
-class ArmStaticInst : public ArmStaticInstBase
-{
- protected:
- ArmStaticInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
- : ArmStaticInstBase(mnem, _machInst, __opClass)
- {
- }
+ // Perform an interworking branch.
template<class XC>
static void
- setNextPC(XC *xc, Addr val)
- {
- xc->setNextPC((xc->readNextPC() & PcModeMask) |
- (val & ~PcModeMask));
- }
-};
-
-class ArmInterWorking : public ArmStaticInstBase
-{
- protected:
- ArmInterWorking(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
- : ArmStaticInstBase(mnem, _machInst, __opClass)
- {
- }
-
- template<class XC>
- static void
- setNextPC(XC *xc, Addr val)
+ setIWNextPC(XC *xc, Addr val)
{
Addr stateBits = xc->readPC() & PcModeMask;
Addr jBit = (ULL(1) << PcJBitShift);
newPc = newPc | stateBits;
xc->setNextPC(newPc);
}
+
+ // Perform an interworking branch in ARM mode, a regular branch
+ // otherwise.
+ template<class XC>
+ static void
+ setAIWNextPC(XC *xc, Addr val)
+ {
+ Addr stateBits = xc->readPC() & PcModeMask;
+ Addr jBit = (ULL(1) << PcJBitShift);
+ Addr tBit = (ULL(1) << PcTBitShift);
+ if (!jBit && !tBit) {
+ setIWNextPC(xc, val);
+ } else {
+ setNextPC(xc, val);
+ }
+ }
};
}
((%(reg_idx)s == PCReg) ? setNextPC(xc, %(final_val)s) :
xc->%(func)s(this, %(op_idx)s, %(final_val)s))
'''
+ maybeIWPCWrite = '''
+ ((%(reg_idx)s == PCReg) ? setIWNextPC(xc, %(final_val)s) :
+ xc->%(func)s(this, %(op_idx)s, %(final_val)s))
+ '''
readNPC = 'xc->readNextPC() & ~PcModeMask'
writeNPC = 'setNextPC(xc, %(final_val)s)'
+ writeIWNPC = 'setIWNextPC(xc, %(final_val)s)'
}};
def operands {{
#Abstracted integer reg operands
'Dest': ('IntReg', 'uw', 'dest', 'IsInteger', 0,
maybePCRead, maybePCWrite),
+ 'IWDest': ('IntReg', 'uw', 'dest', 'IsInteger', 0,
+ maybePCRead, maybeIWPCWrite),
+ 'AIWDest': ('IntReg', 'uw', 'dest', 'IsInteger', 0,
+ maybePCRead, maybeIWPCWrite),
'Base': ('IntReg', 'uw', 'base', 'IsInteger', 1,
maybePCRead, maybePCWrite),
'Index': ('IntReg', 'uw', 'index', 'IsInteger', 2,
'Fpexc': ('ControlReg', 'uw', 'MISCREG_FPEXC', None, 45),
'NPC': ('NPC', 'ud', None, (None, None, 'IsControl'), 51,
readNPC, writeNPC),
+ 'IWNPC': ('NPC', 'ud', None, (None, None, 'IsControl'), 51,
+ readNPC, writeIWNPC),
}};