Skip to content

Commit 925cd69

Browse files
committed
arch-arm: Disassemble DSB inst with CRm operand
This is either a symbolic operand such as "SY" or "NSH", or a 4-bit immediate. Change-Id: Id2851ba49441c3dbb02a8348cbf4e9b4fe2869f4
1 parent a390136 commit 925cd69

File tree

5 files changed

+49
-11
lines changed

5 files changed

+49
-11
lines changed

src/arch/arm/insts/misc64.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,4 +2654,27 @@ IsbOp64::generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
26542654
return ss.str();
26552655
}
26562656

2657+
std::string
2658+
DsbOp64::generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
2659+
{
2660+
std::stringstream ss;
2661+
ss << " " << mnemonic << " ";
2662+
switch (imm) {
2663+
case 1: ss << "OSHLD"; break;
2664+
case 2: ss << "OSHST"; break;
2665+
case 3: ss << "OSH"; break;
2666+
case 5: ss << "NSHLD"; break;
2667+
case 6: ss << "NSHST"; break;
2668+
case 7: ss << "NSH"; break;
2669+
case 9: ss << "ISHLD"; break;
2670+
case 10: ss << "ISHST"; break;
2671+
case 11: ss << "ISH"; break;
2672+
case 13: ss << "LD"; break;
2673+
case 14: ss << "ST"; break;
2674+
case 15: ss << "SY"; break;
2675+
default: ss << "#" << imm; break;
2676+
}
2677+
return ss.str();
2678+
}
2679+
26572680
} // namespace gem5

src/arch/arm/insts/misc64.hh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,20 @@ class IsbOp64 : public ArmISA::ArmStaticInst
371371
Addr pc, const loader::SymbolTable *symtab) const override;
372372
};
373373

374+
class DsbOp64 : public ArmISA::ArmStaticInst
375+
{
376+
protected:
377+
uint64_t imm;
378+
379+
DsbOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
380+
OpClass __opClass, uint64_t _imm) :
381+
ArmISA::ArmStaticInst(mnem, _machInst, __opClass), imm(_imm)
382+
{}
383+
384+
std::string generateDisassembly(
385+
Addr pc, const loader::SymbolTable *symtab) const override;
386+
};
387+
374388
} // namespace gem5
375389

376390
#endif

src/arch/arm/isa/formats/aarch64.isa

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,12 @@ namespace Aarch64
399399
if (bits(crm, 1, 0) == 0b10) {
400400
switch (bits(crm, 3, 2)) {
401401
case 0x1: // Non-Shareable
402-
return new Dsb64Local(machInst);
402+
return new Dsb64Local(machInst, crm);
403403
case 0x0: // OuterShareable
404404
case 0x2: // InnerShareable
405405
case 0x3: // FullSystem
406406
return new Dsb64Shareable(
407-
machInst, dec.dvmEnabled);
407+
machInst, crm, dec.dvmEnabled);
408408
default:
409409
GEM5_UNREACHABLE;
410410
}
@@ -416,12 +416,12 @@ namespace Aarch64
416416
case 0x4:
417417
switch (bits(crm, 3, 2)) {
418418
case 0x1: // Non-Shareable
419-
return new Dsb64Local(machInst);
419+
return new Dsb64Local(machInst, crm);
420420
case 0x0: // OuterShareable
421421
case 0x2: // InnerShareable
422422
case 0x3: // FullSystem
423423
return new Dsb64Shareable(
424-
machInst, dec.dvmEnabled);
424+
machInst, crm, dec.dvmEnabled);
425425
default:
426426
GEM5_UNREACHABLE;
427427
}

src/arch/arm/isa/insts/misc64.isa

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ let {{
194194
decoder_output += ImmOp64Constructor.subst(isbIop)
195195
exec_output += BasicExecute.subst(isbIop)
196196

197-
dsbLocalIop = ArmInstObjParams("dsb", "Dsb64Local", "ArmStaticInst", "",
197+
dsbLocalIop = ArmInstObjParams("dsb", "Dsb64Local", "DsbOp64", "",
198198
['IsReadBarrier', 'IsWriteBarrier',
199199
'IsSerializeAfter'])
200-
header_output += BasicDeclare.subst(dsbLocalIop)
201-
decoder_output += BasicConstructor64.subst(dsbLocalIop)
200+
header_output += ImmOp64Declare.subst(dsbLocalIop)
201+
decoder_output += ImmOp64Constructor.subst(dsbLocalIop)
202202
exec_output += BasicExecute.subst(dsbLocalIop)
203203

204204
dvmCode = '''
@@ -215,7 +215,7 @@ let {{
215215
PendingDvm = false;
216216
}
217217
'''
218-
dsbShareableIop = ArmInstObjParams("dsb", "Dsb64Shareable", "ArmStaticInst",
218+
dsbShareableIop = ArmInstObjParams("dsb", "Dsb64Shareable", "DsbOp64",
219219
{ "code" : "", "dvm_code" : dvmCode },
220220
['IsReadBarrier', 'IsWriteBarrier',
221221
'IsSerializeAfter'])

src/arch/arm/isa/templates/misc64.isa

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def template DvmDeclare {{
331331

332332
public:
333333
/// Constructor.
334-
%(class_name)s(ExtMachInst machInst, bool dvm_enabled);
334+
%(class_name)s(ExtMachInst machInst, uint64_t imm, bool dvm_enabled);
335335
Fault initiateAcc(ExecContext *, trace::InstRecord *) const override;
336336
Fault completeAcc(PacketPtr, ExecContext *,
337337
trace::InstRecord *) const override;
@@ -368,8 +368,9 @@ def template AtConstructor {{
368368
}};
369369

370370
def template DvmConstructor {{
371-
%(class_name)s::%(class_name)s(ExtMachInst machInst, bool dvm_enabled) :
372-
%(base_class)s("%(mnemonic)s", machInst, %(op_class)s),
371+
%(class_name)s::%(class_name)s(ExtMachInst machInst, uint64_t imm,
372+
bool dvm_enabled) :
373+
%(base_class)s("%(mnemonic)s", machInst, %(op_class)s, imm),
373374
dvmEnabled(dvm_enabled)
374375
{
375376
%(set_reg_idx_arr)s;

0 commit comments

Comments
 (0)