BXWritePC

ScarletNX's fixup arm.sail

An interworking branch takes the state from the target's bit 0 and clears it; with no CONSTRAINED UNPREDICTABLE choice (ConstrainUnpredictableBool, below) an A32 target's bit 1 stays. sail-arm's sets T in each way of an if on that bit, and sailgen writes no register under a condition known only when the guest runs, so T is the bit itself here

val BXWritePC : (bits(32), BranchType) -> unit

function BXWritePC (address_in, branch_type) = {
    address : bits(32) = address_in;
    PSTATE.T = [address[0]];
    address[0] = Bit(0b0);
    let branch_conditional : bool = not_bool((match AArch32_CurrentCond() {
      [bitone, bitone, bitone, _] => true,
      _ => false
    }) : bool);
    BranchTo(address, branch_type, branch_conditional)
}

Used by


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.