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() { ...@@ -2989,6 +2989,8 @@ void Assembler::isb() {
Emit(ISB | ImmBarrierDomain(FullSystem) | ImmBarrierType(BarrierAll)); Emit(ISB | ImmBarrierDomain(FullSystem) | ImmBarrierType(BarrierAll));
} }
void Assembler::csdb() { hint(CSDB); }
void Assembler::fmov(const VRegister& vd, double imm) { void Assembler::fmov(const VRegister& vd, double imm) {
if (vd.IsScalar()) { if (vd.IsScalar()) {
DCHECK(vd.Is1D()); DCHECK(vd.Is1D());
......
...@@ -1752,6 +1752,9 @@ class Assembler : public AssemblerBase { ...@@ -1752,6 +1752,9 @@ class Assembler : public AssemblerBase {
// Instruction synchronization barrier // Instruction synchronization barrier
void isb(); void isb();
// Conditional speculation barrier.
void csdb();
// Alias for system instructions. // Alias for system instructions.
void nop() { hint(NOP); } void nop() { hint(NOP); }
......
...@@ -412,7 +412,8 @@ enum SystemHint { ...@@ -412,7 +412,8 @@ enum SystemHint {
WFE = 2, WFE = 2,
WFI = 3, WFI = 3,
SEV = 4, SEV = 4,
SEVL = 5 SEVL = 5,
CSDB = 20
}; };
enum BarrierDomain { enum BarrierDomain {
......
...@@ -168,11 +168,6 @@ void Decoder<V>::DecodeBranchSystemException(Instruction* instr) { ...@@ -168,11 +168,6 @@ void Decoder<V>::DecodeBranchSystemException(Instruction* instr) {
(instr->Mask(0x0039E000) == 0x00002000) || (instr->Mask(0x0039E000) == 0x00002000) ||
(instr->Mask(0x003AE000) == 0x00002000) || (instr->Mask(0x003AE000) == 0x00002000) ||
(instr->Mask(0x003CE000) == 0x00042000) || (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(0x0038F000) == 0x00005000) ||
(instr->Mask(0x0038E000) == 0x00006000)) { (instr->Mask(0x0038E000) == 0x00006000)) {
V::VisitUnallocated(instr); V::VisitUnallocated(instr);
......
...@@ -1246,6 +1246,11 @@ void DisassemblingDecoder::VisitSystem(Instruction* instr) { ...@@ -1246,6 +1246,11 @@ void DisassemblingDecoder::VisitSystem(Instruction* instr) {
form = nullptr; form = nullptr;
break; break;
} }
case CSDB: {
mnemonic = "csdb";
form = nullptr;
break;
}
} }
} else if (instr->Mask(MemBarrierFMask) == MemBarrierFixed) { } else if (instr->Mask(MemBarrierFMask) == MemBarrierFixed) {
switch (instr->Mask(MemBarrierMask)) { switch (instr->Mask(MemBarrierMask)) {
......
...@@ -416,6 +416,11 @@ void MacroAssembler::CmovX(const Register& rd, ...@@ -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) { void TurboAssembler::Cset(const Register& rd, Condition cond) {
DCHECK(allow_macro_instructions()); DCHECK(allow_macro_instructions());
DCHECK(!rd.IsZero()); DCHECK(!rd.IsZero());
......
...@@ -559,6 +559,7 @@ class TurboAssembler : public Assembler { ...@@ -559,6 +559,7 @@ class TurboAssembler : public Assembler {
inline void Dmb(BarrierDomain domain, BarrierType type); inline void Dmb(BarrierDomain domain, BarrierType type);
inline void Dsb(BarrierDomain domain, BarrierType type); inline void Dsb(BarrierDomain domain, BarrierType type);
inline void Isb(); inline void Isb();
inline void Csdb();
bool AllowThisStubCall(CodeStub* stub); bool AllowThisStubCall(CodeStub* stub);
void CallStubDelayed(CodeStub* stub); void CallStubDelayed(CodeStub* stub);
......
...@@ -2955,7 +2955,9 @@ void Simulator::VisitSystem(Instruction* instr) { ...@@ -2955,7 +2955,9 @@ void Simulator::VisitSystem(Instruction* instr) {
} else if (instr->Mask(SystemHintFMask) == SystemHintFixed) { } else if (instr->Mask(SystemHintFMask) == SystemHintFixed) {
DCHECK(instr->Mask(SystemHintMask) == HINT); DCHECK(instr->Mask(SystemHintMask) == HINT);
switch (instr->ImmHint()) { switch (instr->ImmHint()) {
case NOP: break; case NOP:
case CSDB:
break;
default: UNIMPLEMENTED(); default: UNIMPLEMENTED();
} }
} else if (instr->Mask(MemBarrierFMask) == MemBarrierFixed) { } else if (instr->Mask(MemBarrierFMask) == MemBarrierFixed) {
......
...@@ -11849,8 +11849,7 @@ TEST(system_msr) { ...@@ -11849,8 +11849,7 @@ TEST(system_msr) {
TEARDOWN(); TEARDOWN();
} }
TEST(system) {
TEST(system_nop) {
INIT_V8(); INIT_V8();
SETUP(); SETUP();
RegisterDump before; RegisterDump before;
...@@ -11858,6 +11857,7 @@ TEST(system_nop) { ...@@ -11858,6 +11857,7 @@ TEST(system_nop) {
START(); START();
before.Dump(&masm); before.Dump(&masm);
__ Nop(); __ Nop();
__ Csdb();
END(); END();
RUN(); RUN();
......
...@@ -2038,6 +2038,9 @@ TEST_(barriers) { ...@@ -2038,6 +2038,9 @@ TEST_(barriers) {
// ISB // ISB
COMPARE(Isb(), "isb"); COMPARE(Isb(), "isb");
// CSDB
COMPARE(Csdb(), "csdb");
CLEANUP(); 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