CLRBHB

Branches, exception generating and system instructions

fixed bit field field the encoding fixes should be

System hints

313029282726252423222120191817161514131211109876543210
11010101000000110010001011011111
CRmop2

11010101000000110010001011011111

Decode Sail

op : SystemHintOp = undefined;
match CRm @ op2 {
  0b0000000 => {
      op = SystemHintOp_NOP
  },
  0b0000001 => {
      op = SystemHintOp_YIELD
  },
  0b0000010 => {
      op = SystemHintOp_WFE
  },
  0b0000011 => {
      op = SystemHintOp_WFI
  },
  0b0000100 => {
      op = SystemHintOp_SEV
  },
  0b0000101 => {
      op = SystemHintOp_SEVL
  },
  0b0000110 => {
      if not_bool(HaveDGHExt()) then {
          EndOfInstruction()
      };
      op = SystemHintOp_DGH
  },
  0b0000111 => {
      throw(Error_See("XPACLRI"))
  },
  [bitzero, bitzero, bitzero, bitone, _, _, _] => {
      match op2 {
        0b000 => {
            throw(Error_See("PACIA1716"))
        },
        0b010 => {
            throw(Error_See("PACIB1716"))
        },
        0b100 => {
            throw(Error_See("AUTIA1716"))
        },
        0b110 => {
            throw(Error_See("AUTIB1716"))
        },
        _ => {
            EndOfInstruction()
        }
      }
  },
  0b0010000 => {
      if not_bool(HaveRASExt()) then {
          EndOfInstruction()
      };
      op = SystemHintOp_ESB
  },
  0b0010001 => {
      if not_bool(HaveStatisticalProfiling()) then {
          EndOfInstruction()
      };
      op = SystemHintOp_PSB
  },
  0b0010010 => {
      if not_bool(HaveSelfHostedTrace()) then {
          EndOfInstruction()
      };
      op = SystemHintOp_TSB
  },
  0b0010011 => {
      if not_bool(IsFeatureImplemented(FEAT_GCS)) then {
          EndOfInstruction()
      };
      op = SystemHintOp_GCSB
  },
  0b0010100 => {
      op = SystemHintOp_CSDB
  },
  0b0010110 => {
      if not_bool(HaveFeatCLRBHB()) then {
          EndOfInstruction()
      };
      op = SystemHintOp_CLRBHB
  },
  [bitzero, bitzero, bitone, bitone, _, _, _] => {
      match op2 {
        0b000 => {
            throw(Error_See("PACIAZ"))
        },
        0b001 => {
            throw(Error_See("PACIASP"))
        },
        0b010 => {
            throw(Error_See("PACIBZ"))
        },
        0b011 => {
            throw(Error_See("PACIBSP"))
        },
        0b100 => {
            throw(Error_See("AUTIAZ"))
        },
        0b101 => {
            throw(Error_See("AUTIASP"))
        },
        0b110 => {
            throw(Error_See("AUTIBZ"))
        },
        0b111 => {
            throw(Error_See("AUTIBSP"))
        }
      }
  },
  [bitzero, bitone, bitzero, bitzero, _, _, bitzero] => {
      op = SystemHintOp_BTI;
      SetBTypeCompatible(BTypeCompatible_BTI(op2[2 .. 1]))
  },
  0b0101000 => {
      if not_bool(IsFeatureImplemented(FEAT_CHK)) then {
          EndOfInstruction()
      };
      op = SystemHintOp_CHKFEAT
  },
  _ => {
      EndOfInstruction()
  }
};
execute_aarch64_instrs_system_hints(op)

Operation Sail

match op {
  SystemHintOp_YIELD => {
      Hint_Yield()
  },
  SystemHintOp_DGH => {
      Hint_DGH()
  },
  SystemHintOp_WFE => {
      let 'localtimeout = (1 << 64);
      Hint_WFE(localtimeout, WFxType_WFE)
  },
  SystemHintOp_WFI => {
      let 'localtimeout = (1 << 64);
      Hint_WFI(localtimeout, WFxType_WFI)
  },
  SystemHintOp_SEV => {
      SendEvent()
  },
  SystemHintOp_SEVL => {
      SendEventLocal()
  },
  SystemHintOp_ESB => {
      if HaveTME() & TSTATE.depth > 0 then {
          FailTransaction(TMFailure_ERR, false)
      };
      SynchronizeErrors();
      AArch64_ESBOperation();
      if (PSTATE.EL == EL0 | PSTATE.EL == EL1) & EL2Enabled() then {
          AArch64_vESBOperation()
      };
      TakeUnmaskedSErrorInterrupts()
  },
  SystemHintOp_PSB => {
      ProfilingSynchronizationBarrier()
  },
  SystemHintOp_TSB => {
      TraceSynchronizationBarrier()
  },
  SystemHintOp_GCSB => {
      GCSSynchronizationBarrier()
  },
  SystemHintOp_CHKFEAT => {
      X_set(16, 64) = AArch64_ChkFeat(X_read(16, 64))
  },
  SystemHintOp_CSDB => {
      ConsumptionOfSpeculativeDataBarrier()
  },
  SystemHintOp_CLRBHB => {
      Hint_CLRBHB()
  },
  SystemHintOp_BTI => {
      SetBTypeNext(0b00)
  },
  SystemHintOp_NOP => {
      return()
  },
  _ => {
      Unreachable()
  }
}

Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.