Commit a33945a1 authored by Martyn Capewell's avatar Martyn Capewell Committed by Commit Bot

[arm64] Support CSDB instruction

Add support for CSDB, equivalent to HINT #20, in the system instruction space.

Additionally, relax the "unallocated" identification of hint instructions that
we don't support, such that they'll now disassemble as "unimplemented (System)"
rather than "unallocated".

Change-Id: Ia36d13fe17a98edb872f234e7cdda33d033618e8
Reviewed-on: https://chromium-review.googlesource.com/926806Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Martyn Capewell <martyn.capewell@arm.com>
Cr-Commit-Position: refs/heads/master@{#51420}
parent d9e305d4
......@@ -2989,6 +2989,8 @@ void Assembler::isb() {
Emit(ISB | ImmBarrierDomain(FullSystem) | ImmBarrierType(BarrierAll));
}
void Assembler::csdb() { hint(CSDB); }
void Assembler::fmov(const VRegister& vd, double imm) {
if (vd.IsScalar()) {
DCHECK(vd.Is1D());
......
......@@ -1752,6 +1752,9 @@ class Assembler : public AssemblerBase {
// Instruction synchronization barrier
void isb();
// Conditional speculation barrier.
void csdb();
// Alias for system instructions.
void nop() { hint(NOP); }
......
......@@ -412,7 +412,8 @@ enum SystemHint {
WFE = 2,
WFI = 3,
SEV = 4,
SEVL = 5
SEVL = 5,
CSDB = 20
};
enum BarrierDomain {
......
......@@ -168,11 +168,6 @@ void Decoder<V>::DecodeBranchSystemException(Instruction* instr) {
(instr->Mask(0x0039E000) == 0x00002000) ||
(instr->Mask(0x003AE000) == 0x00002000) ||
(instr->Mask(0x003CE000) == 0x00042000) ||
(instr->Mask(0x003FFFC0) == 0x000320C0) ||
(instr->Mask(0x003FF100) == 0x00032100) ||
(instr->Mask(0x003FF200) == 0x00032200) ||
(instr->Mask(0x003FF400) == 0x00032400) ||
(instr->Mask(0x003FF800) == 0x00032800) ||
(instr->Mask(0x0038F000) == 0x00005000) ||
(instr->Mask(0x0038E000) == 0x00006000)) {
V::VisitUnallocated(instr);
......
......@@ -1246,6 +1246,11 @@ void DisassemblingDecoder::VisitSystem(Instruction* instr) {
form = nullptr;
break;
}
case CSDB: {
mnemonic = "csdb";
form = nullptr;
break;
}
}
} else if (instr->Mask(MemBarrierFMask) == MemBarrierFixed) {
switch (instr->Mask(MemBarrierMask)) {
......
......@@ -416,6 +416,11 @@ void MacroAssembler::CmovX(const Register& rd,
}
}
void TurboAssembler::Csdb() {
DCHECK(allow_macro_instructions());
csdb();
}
void TurboAssembler::Cset(const Register& rd, Condition cond) {
DCHECK(allow_macro_instructions());
DCHECK(!rd.IsZero());
......
......@@ -559,6 +559,7 @@ class TurboAssembler : public Assembler {
inline void Dmb(BarrierDomain domain, BarrierType type);
inline void Dsb(BarrierDomain domain, BarrierType type);
inline void Isb();
inline void Csdb();
bool AllowThisStubCall(CodeStub* stub);
void CallStubDelayed(CodeStub* stub);
......
......@@ -2955,7 +2955,9 @@ void Simulator::VisitSystem(Instruction* instr) {
} else if (instr->Mask(SystemHintFMask) == SystemHintFixed) {
DCHECK(instr->Mask(SystemHintMask) == HINT);
switch (instr->ImmHint()) {
case NOP: break;
case NOP:
case CSDB:
break;
default: UNIMPLEMENTED();
}
} else if (instr->Mask(MemBarrierFMask) == MemBarrierFixed) {
......
......@@ -11849,8 +11849,7 @@ TEST(system_msr) {
TEARDOWN();
}
TEST(system_nop) {
TEST(system) {
INIT_V8();
SETUP();
RegisterDump before;
......@@ -11858,6 +11857,7 @@ TEST(system_nop) {
START();
before.Dump(&masm);
__ Nop();
__ Csdb();
END();
RUN();
......
......@@ -2038,6 +2038,9 @@ TEST_(barriers) {
// ISB
COMPARE(Isb(), "isb");
// CSDB
COMPARE(Csdb(), "csdb");
CLEANUP();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment