This forum was built by humans, for humans. AI was used exclusively for security auditing. The forum officially launched on November 24, 2026. Read more

romdump.net
romdump.net › Forum › Silicon & Architectures › Shared pseudocode: part 33 of 36

Writeup Shared pseudocode: part 33 of 36

started by admin

admin admin admingod mode Posts 116
Rep 505
Joined Nov 2026
2d ago OP #145

Shared pseudocode from the offline Arm documentation snapshot. Part 33 of 36.

    when EL1 => return IsFeatureImplemented(FEAT_AA32EL1);    when EL2 => return IsFeatureImplemented(FEAT_AA32EL2);    when EL3 => return IsFeatureImplemented(FEAT_AA32EL3);end;

end;


## Library pseudocode for shared/functions/system/HaveAArch64

// HaveAArch64 // ============= // Return TRUE if the highest Exception level is using AArch64 state.

readonly func HaveAArch64() => boolean begin return (IsFeatureImplemented(FEAT_AA64EL0) || IsFeatureImplemented(FEAT_AA64EL1) || IsFeatureImplemented(FEAT_AA64EL2) || IsFeatureImplemented(FEAT_AA64EL3) ); end;


## Library pseudocode for shared/functions/system/HaveEL

// HaveEL // ======== // Return TRUE if Exception level 'el' is supported

readonly func HaveEL(el : bits(2)) => boolean begin case el of when EL1,EL0 => return TRUE; // EL1 and EL0 must exist when EL2 => return IsFeatureImplemented(FEAT_AA64EL2) || IsFeatureImplemented(FEAT_AA32EL2); when EL3 => return IsFeatureImplemented(FEAT_AA64EL3) || IsFeatureImplemented(FEAT_AA32EL3); otherwise => unreachable; end; end;


## Library pseudocode for shared/functions/system/HaveELUsingSecurityState

// HaveELUsingSecurityState // ========================== // Returns TRUE if Exception level 'el' with Security state 'ss' is supported, FALSE otherwise.

readonly func HaveELUsingSecurityState(el : bits(2), ss : SecurityState) => boolean begin if (el) then return FALSE; end;

case el of
    when EL3 =>
        if IsFeatureImplemented(FEAT_RME) then
            return ss == SS_Root;
        end;
    return ss == SS_Secure;when EL2 =>    case ss of        when SS_Realm     => return IsFeatureImplemented(FEAT_RME);        when SS_NonSecure => return ();        when SS_Secure    => return IsFeatureImplemented(FEAT_SEL2);        otherwise         => return FALSE;    end;when EL1 =>    case ss of        when SS_Realm     => return IsFeatureImplemented(FEAT_RME);        when SS_NonSecure => return ();        when SS_Secure    => return IsFeatureImplemented(FEAT_Secure) && HaveAArch64();        otherwise         => return FALSE;    end;when EL0 =>    case ss of        when SS_Realm     => return IsFeatureImplemented(FEAT_RME);        when SS_NonSecure => return ();        when SS_Secure    => return IsFeatureImplemented(FEAT_Secure);        otherwise         => return FALSE;    end;otherwise =>    unreachable;

end;

end;


## Library pseudocode for shared/functions/system/HaveSecureState

// HaveSecureState // ================= // Return TRUE if Secure State is supported.

readonly func HaveSecureState() => boolean begin return IsFeatureImplemented(FEAT_Secure); end;


## Library pseudocode for shared/functions/system/HighestEL

// HighestEL // =========== // Returns the highest implemented Exception level.

readonly func HighestEL() => bits(2) begin if HaveEL(EL3) then return EL3; elsif HaveEL(EL2) then return EL2; else return EL1; end; end;


## Library pseudocode for shared/functions/system/Hint\_CLRBHB

// Hint_CLRBHB // ============= // Provides a hint to clear the branch history for the current context.

impdef func Hint_CLRBHB begin return; end;


## Library pseudocode for shared/functions/system/Hint\_DGH

// Hint_DGH // ========== // Provides a hint to close any gathering occurring within the implementation.

impdef func Hint_DGH begin return; end;


## Library pseudocode for shared/functions/system/Hint\_ScopeRelease

// Hint_ScopeRelease // =================== // Signals to the memory system that if the next instruction in program order has Release semantics // or is a Data Memory Barrier that defines a Barrier scope with a preceding Scoped Release // Boundary, then these instructions do not create a Barrier-ordered-before relationship between // any Effect in program order before the Scoped Release Boundary and the Effect with Release // semantics or any Effect in program order after the DMB Effect.

impdef func Hint_ScopeRelease(stshstrm : boolean) begin return; end;


## Library pseudocode for shared/functions/system/Hint\_ScopedReleaseBoundary

// Hint_ScopedReleaseBoundary // ============================ // Signals to the memory system that a corresponding instruction with Release semantics or Data // Memory Barrier will subsequently occur in program order, and if that corresponding instruction // defines a Barrier scope with the Scoped Release Boundary, then these instructions do not create // a Barrier-ordered-before relationship between any Effect in program order before the Scoped // Release Boundary and the Effect with Release semantics or any Effect in program order after the // DMB Effect.

impdef func Hint_ScopedReleaseBoundary begin return; end;


## Library pseudocode for shared/functions/system/Hint\_SharedUpdate

// Hint_SharedUpdate // =================== // Provides a hint to the memory system that if the next instruction in program order generates an // Explicit Memory Effect, then it is to a location that one or more other threads of execution // are likely to subsequently update, and there is a performance benefit to ensuring subsequent // updates by other threads of execution may complete with minimal latency.

impdef func Hint_SharedUpdate(priority : boolean) begin return; end;


## Library pseudocode for shared/functions/system/Hint\_StoreConcurrentPriority

// Hint_StoreConcurrentPriority // ============================== // Provides a hint to the memory system that if the next instruction in program order generates an // Explicit Memory Write Effect, then there is a performance benefit if the corresponding Explicit // Memory Write Effect is sequenced before Explicit Memory Effects from other threads of execution // in the coherence order to the same location.

impdef func Hint_StoreConcurrentPriority begin return; end;


## Library pseudocode for shared/functions/system/Hint\_StoreShared

// Hint_StoreShared // ================== // Provides a hint that if the next instruction is an explicit write it is being waited on by // observers and as such the data should propagate to them with minimum latency. // A stream value of FALSE indicates KEEP whilst a value of TRUE indicates STRM.

impdef func Hint_StoreShared(stream : boolean) begin return; end;


## Library pseudocode for shared/functions/system/Hint\_WFE

// Hint_WFE // ========== // Provides a hint indicating that the PE can enter a low-power state and // remain there until a wakeup event occurs.

func Hint_WFE begin if IsEventRegisterSet() then ClearEventRegister(); return; end;

var trap : boolean;
var target_el : bits(2);
(trap, target_el) = AArch64_CheckForWFxTrap(WFxType_WFE);
if trap then
    if IsFeatureImplemented(FEAT_TWED) then
        // Determine if trap delay is enabled and delay amount
        var delay_enabled : boolean;
        var delay : integer;
        (delay_enabled, delay) = WFETrapDelay(target_el);
        if WaitForEventUntilDelay(delay_enabled, delay) then
            // Event arrived before delay
            return;
        end;
    end;
// Proceed with trappingif target_el == EL3 && EL3SDDUndef() then    Undefined();else    AArch64_WFxTrap(WFxType_WFE, target_el);end;

else WaitForEvent(); end;

end;


## Library pseudocode for shared/functions/system/Hint\_WFET

// Hint_WFET // =========== // Provides a hint indicating that the PE can enter a low-power state // and remain there until a wakeup event occurs or, for WFET, a local // timeout event is generated when the virtual timer value equals or // exceeds the supplied threshold value.

func Hint_WFET(localtimeout : integer) begin if IsEventRegisterSet() then ClearEventRegister(); return; end;

if IsFeatureImplemented(FEAT_WFxT) && LocalTimeoutEvent(localtimeout) then
    // No further operation if the local timeout has expired.
    EndOfInstruction(EndOfInstructionReason_Retired);
end;

var trap : boolean; var target_el : bits(2); (trap, target_el) = AArch64_CheckForWFxTrap(WFxType_WFET); if trap then if IsFeatureImplemented(FEAT_TWED) then // Determine if trap delay is enabled and delay amount var delay_enabled : boolean; var delay : integer; (delay_enabled, delay) = WFETrapDelay(target_el); if WaitForEventUntilDelay(delay_enabled, delay) then // Event arrived before the delay expired return; end; end;

// Proceed with trappingif target_el == EL3 && EL3SDDUndef() then    Undefined();else    AArch64_WFxTrap(WFxType_WFET, target_el);end;

else WaitForEvent(localtimeout); end;

end;


## Library pseudocode for shared/functions/system/Hint\_WFI

// Hint_WFI // ========== // Provides a hint indicating that the PE can enter a low-power state and // remain there until a wakeup event occurs.

func Hint_WFI begin if AArch64_InterruptPending() then // No further operation if an interrupt is pending. EndOfInstruction(EndOfInstructionReason_Retired); end;

var trap : boolean;var target_el : bits(2);(trap, target_el) = AArch64_CheckForWFxTrap(WFxType_WFI);if trap then    if target_el == EL3 && EL3SDDUndef() then        Undefined();    end;    AArch64_WFxTrap(WFxType_WFI, target_el);else    WaitForInterrupt();end;

end;


## Library pseudocode for shared/functions/system/Hint\_WFIT

// Hint_WFIT // =========== // Provides a hint indicating that the PE can enter a low-power state and // remain there until a wakeup event occurs or, for WFIT, a local timeout // event is generated when the virtual timer value equals or exceeds the // supplied threshold value.

func Hint_WFIT(localtimeout : integer) begin if (AArch64_InterruptPending() || (IsFeatureImplemented(FEAT_WFxT) && LocalTimeoutEvent(localtimeout))) then // No further operation if an interrupt is pending or the local timeout has expired. EndOfInstruction(EndOfInstructionReason_Retired); end;

var trap : boolean;var target_el : bits(2);(trap, target_el) = AArch64_CheckForWFxTrap(WFxType_WFIT);if trap then    if target_el == EL3 && EL3SDDUndef() then        Undefined();    end;    AArch64_WFxTrap(WFxType_WFIT, target_el);else    WaitForInterrupt(localtimeout);end;

end;


## Library pseudocode for shared/functions/system/Hint\_Yield

// Hint_Yield // ============ // Provides a hint that the task performed by a thread is of low // importance so that it could yield to improve overall performance.

impdef func Hint_Yield begin return; end;


## Library pseudocode for shared/functions/system/IRQPending

// IRQPending // ============ // Returns a tuple indicating if there is any pending physical IRQ // and if the pending IRQ has superpriority.

readonly impdef func IRQPending() => (boolean, boolean) begin return (FALSE, FALSE); end;


## Library pseudocode for shared/functions/system/IllegalExceptionReturn

// IllegalExceptionReturn // ========================

readonly func IllegalExceptionReturn{N}(spsr : bits(N)) => boolean begin // Check for illegal return: // * To an unimplemented Exception level. // * To EL2 in Secure state, when SecureEL2 is not enabled. // * To EL0 using AArch64 state, with SPSR.M[0]==1. // * To AArch64 state with SPSR.M[1]==1. // * To AArch32 state with an illegal value of SPSR.M. let (valid, target) : (boolean, bits(2)) = ELFromSPSR{N}(spsr); if !valid then return TRUE; end;

// Check for return to higher Exception level.
if UInt(target) > UInt(PSTATE.EL) then return TRUE; end;

let spsr_mode_is_aarch32 : boolean = (spsr[4] == '1');

// Check for illegal return: // * To EL1, EL2 or EL3 with register width specified in the SPSR different from the // Execution state used in the Exception level being returned to, as determined by // the SCR_EL3.RW or HCR_EL2.RW bits, or as configured from reset. // * To EL0 using AArch64 state when EL1 is using AArch32 state as determined by the // SCR_EL3.RW or HCR_EL2.RW bits or as configured from reset. // * To AArch64 state from AArch32 state (should be caught by above). let (known, target_el_is_aarch32) : (boolean, boolean) = ELUsingAArch32K(target); assert known || (target == EL0 && (EL1)); if known && spsr_mode_is_aarch32 != target_el_is_aarch32 then return TRUE; end;

// Check for illegal return from AArch32 to AArch64. if UsingAArch32() && !spsr_mode_is_aarch32 then return TRUE; end; // Check for illegal return to EL1 when HCR_EL2.TGE is set and when either of // * SecureEL2 is enabled. // * SecureEL2 is not enabled and EL1 is in Non-secure state. if EL2Enabled() && target == EL1 && HCR_EL2().TGE == '1' then if (() || IsSecureEL2Enabled()) then return TRUE; end; end;

// Check for an illegal return to EL1 by a Guest Hypervisor at EL1 when HCRX_EL2.NVTGE is set. if (() && IsFeatureImplemented(FEAT_NV3) && PSTATE.EL == EL1 && spsr[3:2] == '01' && EffectiveHCR_EL2_NVx() == '101' && IsHCRXEL2Enabled() && HCRX_EL2().NVTGE == '1' && NVHCR_EL2().TGE == '1') then return TRUE; end;

if (IsFeatureImplemented(FEAT_GCS) && PSTATE.EXLOCK == '0' && PSTATE.EL == target && GetCurrentEXLOCKEN()) then return TRUE; end;

return FALSE;

end;


## Library pseudocode for shared/functions/system/InstrSet

// InstrSet // ========

type InstrSet of enumeration {InstrSet_A64, InstrSet_A32, InstrSet_T32};


## Library pseudocode for shared/functions/system/InstructionFetchBarrier

// InstructionFetchBarrier // =========================

impdef func InstructionFetchBarrier begin return; end;


## Library pseudocode for shared/functions/system/InstructionSynchronizationBarrier

// InstructionSynchronizationBarrier // ===================================

impdef func InstructionSynchronizationBarrier begin return; end;


## Library pseudocode for shared/functions/system/IsASEInstruction

// IsASEInstruction // ================== // Returns TRUE if the current instruction is an ASIMD or SVE vector instruction.

impdef func IsASEInstruction() => boolean begin return FALSE; end;


## Library pseudocode for shared/functions/system/IsCurrentSecurityState

// IsCurrentSecurityState // ======================== // Returns TRUE if the current Security state matches // the given Security state, and FALSE otherwise.

func IsCurrentSecurityState(ss : SecurityState) => boolean begin return CurrentSecurityState() == ss; end;


## Library pseudocode for shared/functions/system/IsEventRegisterSet

// IsEventRegisterSet // ==================== // Return TRUE if the Event Register of this PE is set, and FALSE if it is clear.

func IsEventRegisterSet() => boolean begin return EventRegister == '1'; end;


## Library pseudocode for shared/functions/system/IsHighestEL

// IsHighestEL // ============= // Returns TRUE if given exception level is the highest exception level implemented

readonly func IsHighestEL(el : bits(2)) => boolean begin return HighestEL() == el; end;


## Library pseudocode for shared/functions/system/IsInHost

// IsInHost // ==========

readonly func IsInHost() => boolean begin return ELIsInHost(PSTATE.EL); end;


## Library pseudocode for shared/functions/system/IsSecureBelowEL3

// IsSecureBelowEL3 // ================== // Return TRUE if an Exception level below EL3 is in Secure state // or would be following an exception return to that level. // // That is, if at AArch64 EL3 or in AArch32 Monitor mode, whether an // exception return would pass to Secure or Non-secure state.

readonly func IsSecureBelowEL3() => boolean begin if HaveEL(EL3) then return if () then SCR().NS == '0' else SCR_EL3().NS == '0'; elsif HaveEL(EL2) && (!IsFeatureImplemented(FEAT_SEL2) || ()) then // If Secure EL2 is not an architecture option then we must be Non-secure. return FALSE; else // TRUE if PE is Secure or FALSE if Non-secure. return SecureOnlyImplementation(); end; end;


## Library pseudocode for shared/functions/system/IsSecureEL2Enabled

// IsSecureEL2Enabled // ==================== // Returns TRUE if Secure EL2 is enabled, FALSE otherwise.

readonly func IsSecureEL2Enabled() => boolean begin if HaveEL(EL2) && IsFeatureImplemented(FEAT_SEL2) then if HaveEL(EL3) then if (EL3) && SCR_EL3().EEL2 == '1' then return TRUE; else return FALSE; end; else return SecureOnlyImplementation(); end; else return FALSE; end; end;


## Library pseudocode for shared/functions/system/IsWFEsleep

// IsWFEsleep // ========== // Set if PE is in low power mode due to WFE(T) instruction

var IsWFEsleep : boolean;


## Library pseudocode for shared/functions/system/IsWFIsleep

// IsWFIsleep // ========== // Set if PE is in low power mode due to WFI(T) instruction

var IsWFIsleep : boolean;


## Library pseudocode for shared/functions/system/LocalTimeoutEvent

// LocalTimeoutEvent // =================== // Returns TRUE if CNTVCT_EL0 equals or exceeds the localtimeout value.

func LocalTimeoutEvent(localtimeout : integer) => boolean begin assert localtimeout >= 0;

let cntvct : bits(64) = VirtualCounterTimer();
if UInt(cntvct) >= localtimeout then
    return TRUE;
end;

IsLocalTimeoutEventPending = TRUE; LocalTimeoutVal = localtimeout[63:0]; // Store value to compare against // Virtual Counter Timer at subsequent clock ticks return FALSE;

end;


## Library pseudocode for shared/functions/system/Mode

// Mode bits // ========= // AArch32 PSTATE.M mode bits.

constant M32_User : bits(5) = '10000'; constant M32_FIQ : bits(5) = '10001'; constant M32_IRQ : bits(5) = '10010'; constant M32_Svc : bits(5) = '10011'; constant M32_Monitor : bits(5) = '10110'; constant M32_Abort : bits(5) = '10111'; constant M32_Hyp : bits(5) = '11010'; constant M32_Undef : bits(5) = '11011'; constant M32_System : bits(5) = '11111';


## Library pseudocode for shared/functions/system/NonSecureOnlyImplementation

// NonSecureOnlyImplementation // ============================= // Returns TRUE if the security state is always Non-secure for this implementation.

readonly func NonSecureOnlyImplementation() => boolean begin return !IsFeatureImplemented(FEAT_Secure) && (EL3); end;


## Library pseudocode for shared/functions/system/PLOfEL

// PLOfEL // ========

func PLOfEL(el : bits(2)) => PrivilegeLevel begin case el of when EL3 => return if () then PL1 else PL3; when EL2 => return PL2; when EL1 => return PL1; when EL0 => return PL0; end; end;


## Library pseudocode for shared/functions/system/PSTATE

// PSTATE // ====== // PE state bits. // There is no significance to the field order.

var PSTATE : collection { N : bits (1), // Negative condition flag Z : bits (1), // Zero condition flag C : bits (1), // Carry condition flag V : bits (1), // Overflow condition flag D : bits (1), // Debug mask bit [AArch64 only] A : bits (1), // SError interrupt mask bit I : bits (1), // IRQ mask bit F : bits (1), // FIQ mask bit EXLOCK : bits (1), // Lock exception return state PAN : bits (1), // Privileged Access Never Bit [v8.1] UAO : bits (1), // User Access Override [v8.2] DIT : bits (1), // Data Independent Timing [v8.4] TCO : bits (1), // Tag Check Override [v8.5, AArch64 only] PM : bits (1), // PMU exception Mask BTYPE : bits (2), // Branch Type [v8.5] PACM : bits (1), // PAC instruction modifier ZA : bits (1), // Accumulation array enabled [SME] SM : bits (1), // Streaming SVE mode enabled [SME] ALLINT : bits (1), // Interrupt mask bit UINJ : bits (1), // Undefined Exception Injection SS : bits (1), // Software step bit IL : bits (1), // Illegal Execution state bit EL : bits (2), // Exception level nRW : bits (1), // Execution state: 0=AArch64, 1=AArch32 SP : bits (1), // Stack pointer select: 0=SP0, 1=SPx [AArch64 only] Q : bits (1), // Cumulative saturation flag [AArch32 only] GE : bits (4), // Greater than or Equal flags [AArch32 only] SSBS : bits (1), // Speculative Store Bypass Safe IT : bits (8), // If-then bits, RES0 in CPSR [AArch32 only] J : bits (1), // J bit, RES0 [AArch32 only, RES0 in SPSR and CPSR] T : bits (1), // T32 bit, RES0 in CPSR [AArch32 only] E : bits (1), // Endianness bit [AArch32 only] M : bits (5) // Mode field [AArch32 only] };


## Library pseudocode for shared/functions/system/PhysicalCountInt

// PhysicalCountInt // ================== // Returns the integral part of physical count value of the System counter.

func PhysicalCountInt() => bits(64) begin return PhysicalCount[87:24]; end;


## Library pseudocode for shared/functions/system/PrivilegeLevel

// PrivilegeLevel // ============== // Privilege Level abstraction.

type PrivilegeLevel of enumeration {PL3, PL2, PL1, PL0};


## Library pseudocode for shared/functions/system/RestoredITBits

// RestoredITBits // ================ // Get the value of PSTATE.IT to be restored on this exception return.

func RestoredITBits{N}(spsr : bits(N)) => bits(8) begin let it : bits(8) = spsr[15:10,26:25];

// When PSTATE.IL is set, it is CONSTRAINED UNPREDICTABLE whether the IT bits are each set
// to zero or copied from the SPSR.
if PSTATE.IL == '1' then
    if ConstrainUnpredictableBool(Unpredictable_ILZEROIT) then return '00000000';
    else return it;
    end;
end;

// The IT bits are forced to zero when they are set to a reserved value. if !IsZero(it[7:4]) && IsZero(it[3:0]) then return '00000000'; end;

// The IT bits are forced to zero when returning to A32 state, or when returning to an EL // with the ITD bit set to 1, and the IT bits are describing a multi-instruction block. let itd : bit = if PSTATE.EL == EL2 then HSCTLR().ITD else SCTLR().ITD; if (spsr[5] == '0' && !IsZero(it)) || (itd == '1' && !IsZero(it[2:0])) then return '00000000'; else return it; end;

end;


## Library pseudocode for shared/functions/system/SecureOnlyImplementation

// SecureOnlyImplementation // ========================== // Returns TRUE if the security state is always Secure for this implementation.

readonly func SecureOnlyImplementation() => boolean begin return IsFeatureImplemented(FEAT_Secure) && (EL3); end;


## Library pseudocode for shared/functions/system/SecurityState

// SecurityState // ============= // The Security state of an execution context

type SecurityState of enumeration { SS_NonSecure, SS_Root, SS_Realm, SS_Secure };


## Library pseudocode for shared/functions/system/SecurityStateAtEL

// SecurityStateAtEL // =================== // Returns the effective security state at the exception level based off current settings.

readonly func SecurityStateAtEL(EL : bits(2)) => SecurityState begin if IsFeatureImplemented(FEAT_RME) then if EL == EL3 then return SS_Root; end; let effective_nse_ns : bits(2) = EffectiveSCR_EL3_NSE() :: EffectiveSCR_EL3_NS(); case effective_nse_ns of when '00' => if IsFeatureImplemented(FEAT_SEL2) then return SS_Secure; else unreachable; end; when '01' => return SS_NonSecure; when '11' => return SS_Realm; otherwise => unreachable; end; end;

if (EL3) then    if SecureOnlyImplementation() then        return SS_Secure;    else        return SS_NonSecure;    end;elsif EL == EL3 then    return SS_Secure;else    // For EL2 call only when EL2 is enabled in current security state    assert(EL != EL2 || EL2Enabled());    if (EL3) then        return if EffectiveSCR_EL3_NS() == '1' then SS_NonSecure else SS_Secure;    else        return if SCR().NS == '1' then SS_NonSecure else SS_Secure;    end;end;

end;


## Library pseudocode for shared/functions/system/SendEvent

// SendEvent // =========== // Signal an event to all PEs in a multiprocessor system to set their Event Registers. // When a PE executes the SEV instruction, it causes this function to be executed.

impdef func SendEvent begin SendEventLocal(); end;


## Library pseudocode for shared/functions/system/SendEventLocal

// SendEventLocal // ================ // Set the local Event Register of this PE. // When a PE executes the SEVL instruction, it causes this function to be executed.

func SendEventLocal begin EventRegister = '1'; return; end;


## Library pseudocode for shared/functions/system/SetAccumulatedFPExceptions

// SetAccumulatedFPExceptions // ============================ // Stores FP Exceptions accumulated by the PE.

impdef func SetAccumulatedFPExceptions(accumulated_exceptions : bits(8)) begin return; end;


## Library pseudocode for shared/functions/system/SetPSTATEFromPSR

// SetPSTATEFromPSR // ==================

func SetPSTATEFromPSR{N}(spsr : bits(N)) begin let illegal_psr_state : boolean = IllegalExceptionReturn{N}(spsr); SetPSTATEFromPSR{N}(spsr, illegal_psr_state); end;

// SetPSTATEFromPSR // ================== // Set PSTATE based on a PSR value

func SetPSTATEFromPSR{N}(spsr_in : bits(N), illegal_psr_state : boolean) begin var spsr : bits(N) = spsr_in; let from_aarch64 : boolean = (); PSTATE.SS = DebugExceptionReturnSS{N}(spsr); ShouldAdvanceSS = FALSE; if illegal_psr_state then PSTATE.IL = '1'; if IsFeatureImplemented(FEAT_SSBS) then PSTATE.SSBS = ARBITRARY : bit; end; if IsFeatureImplemented(FEAT_BTI) then PSTATE.BTYPE = ARBITRARY : bits(2); end; if IsFeatureImplemented(FEAT_UAO) then PSTATE.UAO = ARBITRARY : bit; end; if IsFeatureImplemented(FEAT_DIT) then PSTATE.DIT = ARBITRARY : bit; end; if IsFeatureImplemented(FEAT_MTE) then PSTATE.TCO = ARBITRARY : bit; end; if IsFeatureImplemented(FEAT_PAuth_LR) then PSTATE.PACM = ARBITRARY : bit; end; if IsFeatureImplemented(FEAT_UINJ) then PSTATE.UINJ = '0'; end; else // State that is reinstated only on a legal exception return PSTATE.IL = spsr[20]; if IsFeatureImplemented(FEAT_UINJ) then PSTATE.UINJ = spsr[36]; end; if spsr[4] == '1' then // AArch32 state AArch32_WriteMode(spsr[4:0]); // Sets PSTATE.EL correctly if IsFeatureImplemented(FEAT_SSBS) then PSTATE.SSBS = spsr[23]; end; else // AArch64 state PSTATE.nRW = '0'; (-, PSTATE.EL) = ELFromSPSR{N}(spsr); PSTATE.SP = spsr[0]; if IsFeatureImplemented(FEAT_BTI) then PSTATE.BTYPE = spsr[11:10]; end; if IsFeatureImplemented(FEAT_SSBS) then PSTATE.SSBS = spsr[12]; end; if IsFeatureImplemented(FEAT_UAO) then PSTATE.UAO = spsr[23]; end; if IsFeatureImplemented(FEAT_DIT) then PSTATE.DIT = spsr[24]; end; if IsFeatureImplemented(FEAT_MTE) then PSTATE.TCO = spsr[25]; end; if IsFeatureImplemented(FEAT_GCS) then PSTATE.EXLOCK = spsr[34]; end; if IsFeatureImplemented(FEAT_PAuth_LR) then PSTATE.PACM = if IsPACMEnabled() then spsr[35] else '0'; end; end; end;

// If PSTATE.IL is set, it is CONSTRAINED UNPREDICTABLE whether the T bit is set to zero or
// copied from SPSR.
if PSTATE.IL == '1' && PSTATE.nRW == '1' then
    if ConstrainUnpredictableBool(Unpredictable_ILZEROT) then spsr[5] = '0'; end;
end;

// State that is reinstated regardless of illegal exception return PSTATE.[N,Z,C,V] = spsr[31:28]; if IsFeatureImplemented(FEAT_PAN) then PSTATE.PAN = spsr[22]; end; if PSTATE.nRW == '1' then // AArch32 state PSTATE.Q = spsr[27]; PSTATE.IT = RestoredITBits{N}(spsr); ShouldAdvanceIT = FALSE; if IsFeatureImplemented(FEAT_DIT) then PSTATE.DIT = (if (Restarting() || from_aarch64) then spsr[24] else spsr[21]); end; PSTATE.GE = spsr[19:16]; PSTATE.E = spsr[9]; PSTATE.[A,I,F] = spsr[8:6]; // No PSTATE.D in AArch32 state PSTATE.T = spsr[5]; // PSTATE.J is RES0 else // AArch64 state if (IsFeatureImplemented(FEAT_EBEP) || IsFeatureImplemented(FEAT_SPE_EXC) || IsFeatureImplemented(FEAT_TRBE_EXC)) then PSTATE.PM = spsr[32]; end; if IsFeatureImplemented(FEAT_NMI) then PSTATE.ALLINT = spsr[13]; end; PSTATE.[D,A,I,F] = spsr[9:6]; // No PSTATE.[Q,IT,GE,E,T] in AArch64 state end; return;

end;


## Library pseudocode for shared/functions/system/ShouldAdvanceHS

// ShouldAdvanceHS // =============== // Cleared if we should not advance the EDESR.SS after the current instruction.

var ShouldAdvanceHS : boolean;


## Library pseudocode for shared/functions/system/ShouldAdvanceIT

// ShouldAdvanceIT // =============== // Cleared if we should not advance the PSTATE.IT after the current instruction.

var ShouldAdvanceIT : boolean;


## Library pseudocode for shared/functions/system/ShouldAdvanceSS

// ShouldAdvanceSS // =============== // Cleared if PSTATE.SS is written by the current instruction.

var ShouldAdvanceSS : boolean;


## Library pseudocode for shared/functions/system/SpeculationBarrier

// SpeculationBarrier // ====================

impdef func SpeculationBarrier begin // Since there is no speculation in asl model, this is a NOP. return; end;


## Library pseudocode for shared/functions/system/SynchronizeContext

// SynchronizeContext // ==================== // Context Synchronization event, includes Instruction Fetch Barrier effect

impdef func SynchronizeContext begin InstructionFetchBarrier(); end;


## Library pseudocode for shared/functions/system/SynchronizeErrors

// SynchronizeErrors // =================== // Implements the error synchronization event.

impdef func SynchronizeErrors begin return; end;


## Library pseudocode for shared/functions/system/TakeUnmaskedPhysicalSErrorInterrupts

// TakeUnmaskedPhysicalSErrorInterrupts // ====================================== // Take any pending unmasked physical SError interrupt.

impdef func TakeUnmaskedPhysicalSErrorInterrupts(iesb_req : boolean) begin return; end;


## Library pseudocode for shared/functions/system/TakeUnmaskedSErrorInterrupts

// TakeUnmaskedSErrorInterrupts // ============================== // Take any pending unmasked physical SError interrupt or unmasked virtual SError // interrupt.

impdef func TakeUnmaskedSErrorInterrupts begin return; end;


## Library pseudocode for shared/functions/system/ThisInstr

// ThisInstr // =========== // Return the bitstring encoding of the currently executing instruction.

impdef func ThisInstr() => bits(32) begin Unimplemented(); end;


## Library pseudocode for shared/functions/system/ThisInstrLength

// ThisInstrLength // ================= // Return the length of the current instruction.

impdef func ThisInstrLength() => integer begin Unimplemented(); end;


## Library pseudocode for shared/functions/system/UndefinedInjectionCheck

// UndefinedInjectionCheck // ========================= // Check PSTATE.UINJ to determine if execution of the current // instruction should cause an Undefined exception.

func UndefinedInjectionCheck begin if IsFeatureImplemented(FEAT_UINJ) && PSTATE.UINJ == '1' then Undefined(); end; end;


## Library pseudocode for shared/functions/system/UsingAArch32

// UsingAArch32 // ============== // Return TRUE if the current Exception level is using AArch32, FALSE if using AArch64_

readonly func UsingAArch32() => boolean begin let aarch32 : boolean = (PSTATE.nRW == '1'); if () then assert !aarch32; end; if () then assert aarch32; end; return aarch32; end;


## Library pseudocode for shared/functions/system/ValidSecurityStateAtEL

// ValidSecurityStateAtEL // ======================== // Returns TRUE if the current settings and architecture choices for this // implementation permit a valid Security state at the indicated EL.

func ValidSecurityStateAtEL(el : bits(2)) => boolean begin if (el) then return FALSE; end;

if el == EL3 then
    return TRUE;
end;

if IsFeatureImplemented(FEAT_RME) then let effective_nse_ns : bits(2) = EffectiveSCR_EL3_NSE() :: EffectiveSCR_EL3_NS(); if effective_nse_ns == '10' then return FALSE; end; end;

if el == EL2 then return EL2Enabled(); end;

return TRUE;

end;


## Library pseudocode for shared/functions/system/VirtualFIQPending

// VirtualFIQPending // =================== // Returns TRUE if there is any pending virtual FIQ.

impdef func VirtualFIQPending() => boolean begin return FALSE; end;


## Library pseudocode for shared/functions/system/VirtualIRQPending

// VirtualIRQPending // =================== // Returns TRUE if there is any pending virtual IRQ.

impdef func VirtualIRQPending() => boolean begin return FALSE; end;


## Library pseudocode for shared/functions/system/WFxType

// WFxType // ======= // WFx instruction types.

type WFxType of enumeration {WFxType_WFE, WFxType_WFI, WFxType_WFET, WFxType_WFIT};


## Library pseudocode for shared/functions/system/WaitForEvent

// WaitForEvent // ============== // PE optionally suspends execution until one of the following occurs: // - A WFE wakeup event. // - A reset. // - The implementation chooses to resume execution. // It is IMPLEMENTATION DEFINED whether restarting execution after the period of // suspension causes the Event Register to be cleared.

func WaitForEvent begin if Halted() then return; end; if () then EnterLowPowerState(); end; return; end;

// WaitForEvent // ============== // PE optionally suspends execution until one of the following occurs: // - A WFE wakeup event. // - A reset. // - The implementation chooses to resume execution. // - A Wait for Event with Timeout (WFET) is executing, and a local timeout event occurs // It is IMPLEMENTATION DEFINED whether restarting execution after the period of // suspension causes the Event Register to be cleared.

func WaitForEvent(localtimeout : integer) begin if Halted() then return; end; if !(IsEventRegisterSet() || LocalTimeoutEvent(localtimeout)) then EnterLowPowerState(); end; return; end;


## Library pseudocode for shared/functions/system/WaitForInterrupt

// WaitForInterrupt // ================== // PE optionally suspends execution until one of the following occurs: // - A WFI wakeup event. // - A reset. // - The implementation chooses to resume execution.

func WaitForInterrupt begin if Halted() then return; end; EnterLowPowerState(); return; end;

// WaitForInterrupt // ================== // PE optionally suspends execution until one of the following occurs: // - A WFI wakeup event. // - A reset. // - The implementation chooses to resume execution. // - A Wait for Interrupt with Timeout (WFIT) is executing, and a local timeout event occurs.

func WaitForInterrupt(localtimeout : integer) begin if Halted() then return; end; if (localtimeout) then EnterLowPowerState(); end; return; end;


## Library pseudocode for shared/functions/system/WatchpointRelatedSyndrome

// WatchpointRelatedSyndrome // =========================== // Update common Watchpoint related fields.

func WatchpointRelatedSyndrome(fault : FaultRecord) => bits(24) begin var syndrome : bits(24) = Zeros{};

if fault.watchptinfo.maybe_false_match then
    syndrome[16] = '1';                                          // WPF
elsif IsFeatureImplemented(FEAT_Debugv8p2) then
    syndrome[16] = ImpDefBit("WPF value on TRUE Watchpoint match");
end;

if IsRelaxedWatchpointAccess(fault.accessdesc) then if HaltOnBreakpointOrWatchpoint() then if ImpDefBool("EDWAR is not valid on watchpoint debug event") then syndrome[10] = '1'; // FnV end; else if ImpDefBool("FAR is not valid on watchpoint exception") then syndrome[10] = '1'; // FnV end; end; else if WatchpointFARNotPrecise(fault) then syndrome[15] = '1'; // FnP end; end;

// Watchpoint number is valid if FEAT_Debugv8p9 is implemented or // if Feat_Debugv8p2 is implemented and below set of conditions are satisfied: // - Any of FnV = 1 or FnP = 1 or WPF = 1. // - If the address recorded in FAR is not within a naturally-aligned block of memory. // Otherwise, it is IMPLEMENTATION DEFINED if watchpoint number is valid. if IsFeatureImplemented(FEAT_Debugv8p9) then syndrome[17] = '1'; // WPTV syndrome[23:18] = fault.watchptinfo.watchpt_num[5:0]; // WPT elsif IsFeatureImplemented(FEAT_Debugv8p2) then if syndrome[15] == '1' || syndrome[10] == '1' || syndrome[16] == '1' then syndrome[17] = '1'; // WPTV elsif (fault.vaddress, fault.watchptinfo.vaddress) then syndrome[17] = '1'; // WPTV elsif ImpDefBool("WPTV field is valid") then syndrome[17] = '1'; end; if syndrome[17] == '1' then syndrome[23:18] = fault.watchptinfo.watchpt_num[5:0]; // WPT else syndrome[23:18] = ARBITRARY : bits(6); end; end;

return syndrome;

end;


## Library pseudocode for shared/functions/tlbi

constant VMID_NONE : bits(NUM_VMIDBITS) = Zeros{}; constant ASID_NONE : bits(NUM_ASIDBITS) = Zeros{};


## Library pseudocode for shared/functions/tlbi/Broadcast

// Broadcast // =========

type Broadcast of enumeration { Broadcast_ISH, Broadcast_ForcedISH, Broadcast_ISH_CnP, // Broadcast only to PEs which would share TLB entries if CnP is 1. Broadcast_OSHnISH, // Broadcast only to PEs in the Outer shareability domain, but not // in the Inner shareability domain. Broadcast_OSH, Broadcast_NSH };


## Library pseudocode for shared/functions/tlbi/BroadcastTLBI

// BroadcastTLBI // =============== // IMPLEMENTATION DEFINED function to broadcast TLBI operation within the indicated broadcast // domain.

impdef func BroadcastTLBI(broadcast : Broadcast, r : TLBIRecord) begin BroadcastTLBI(broadcast, r, DEFAULT_TLBI_DOMAIN); end;

impdef func BroadcastTLBI(broadcast : Broadcast, r : TLBIRecord, domains : bits(16)) begin return; end;


## Library pseudocode for shared/functions/tlbi/ExcludeXS

// ExcludeXS // =========== // Returns TRUE if a TLBI maintenance instruction without the nXS qualifier executed at EL1 // behaves in the same way as the corresponding TLBI maintenance instruction with the nXS qualifier.

func ExcludeXS() => boolean begin return (IsFeatureImplemented(FEAT_XS) && PSTATE.EL == EL1 && IsHCRXEL2Enabled() && HCRX_EL2().FnXS == '1'); end;


## Library pseudocode for shared/functions/tlbi/TLBI

// TLBI // ====== // Invalidates TLB entries for which TLBIMatch() returns TRUE.

impdef func TLBI(r : TLBIRecord) begin return; end;


## Library pseudocode for shared/functions/tlbi/TLBILevel

// TLBILevel // =========

type TLBILevel of enumeration { TLBILevel_Any, // this applies to TLB entries at all levels TLBILevel_Last // this applies to TLB entries at last level only };


## Library pseudocode for shared/functions/tlbi/TLBIMemAttr

// TLBIMemAttr // =========== // Defines the attributes of the memory operations that must be completed in // order to deem the TLBI operation as completed.

type TLBIMemAttr of enumeration { TLBI_AllAttr, // All TLB entries within the scope of the invalidation TLBI_ExcludeXS // Only TLB entries with XS=0 within the scope of the invalidation };


## Library pseudocode for shared/functions/tlbi/TLBIOp

// TLBIOp // ======

type TLBIOp of enumeration { TLBIOp_DALL, // AArch32 Data TLBI operations - deprecated TLBIOp_DASID, TLBIOp_DVA, TLBIOp_IALL, // AArch32 Instruction TLBI operations - deprecated TLBIOp_IASID, TLBIOp_IVA, TLBIOp_ALL, TLBIOp_ASID, TLBIOp_IPAS2, TLBIPOp_IPAS2, TLBIOp_VAA, TLBIOp_VA, TLBIPOp_VAA, TLBIPOp_VA, TLBIOp_VMALL, TLBIOp_VMALLS12, TLBIOp_RIPAS2, TLBIPOp_RIPAS2, TLBIOp_RVAA, TLBIOp_RVA, TLBIPOp_RVAA, TLBIPOp_RVA, TLBIOp_RPA, TLBIOp_PAALL, TLBIOp_VMALLWS2 };


## Library pseudocode for shared/functions/tlbi/TLBIRecord

// TLBIRecord // ========== // Details related to a TLBI operation.

type TLBIRecord of record { op : TLBIOp, from_aarch64 : boolean, // originated as an AArch64 operation security : SecurityState, regime : Regime, use_vmid : boolean, vmid : bits(NUM_VMIDBITS), asid : bits(NUM_ASIDBITS), level : TLBILevel, attr : TLBIMemAttr, ipaspace : PASpace, // For operations that take IPA as input address address : bits(64), // input address, for range operations, start address end_address : bits(64), // for range operations, end; address d64 : boolean, // For operations that evict VMSAv8-64 based TLB entries d128 : boolean, // For operations that evict VMSAv9-128 based TLB entries ttl : bits(4), // translation table walk level holding the leaf entry // for the address being invalidated // For Non-Range Invalidations: // When the ttl is // '00xx' : this applies to all TLB entries // Otherwise : TLBIP instructions invalidates D128 TLB // entries only // TLBI instructions invalidates D64 TLB // entries only // For Range Invalidations: // When the ttl is // '00' : this applies to all TLB entries // Otherwise : TLBIP instructions invalidates D128 TLB // entries only // TLBI instructions invalidates D64 TLB // entries only tg : bits(2) // for range operations, translation granule };


## Library pseudocode for shared/functions/tlbi/VMID

// VMID // ==== // Effective VMID.

func VMID() => bits(NUM_VMIDBITS) begin if EL2Enabled() then if (EL2) then if IsFeatureImplemented(FEAT_VMID16) && VTCR_EL2().VS == '1' then return VTTBR_EL2().VMID; else return ZeroExtend{NUM_VMIDBITS}(VTTBR_EL2().VMID[7:0]); end; else return ZeroExtend{NUM_VMIDBITS}(VTTBR().VMID); end; elsif HaveEL(EL2) && IsFeatureImplemented(FEAT_SEL2) then return Zeros{NUM_VMIDBITS}; else return VMID_NONE; end; end;


## Library pseudocode for shared/functions/unbounded\_configs/Maximum

// Maximum walk levels // =================== let MAX_WALK_LEVELS : integer{} = (if IsFeatureImplemented(FEAT_D128) then 6 else (if IsFeatureImplemented(FEAT_LPA2) then 5 else 4));


## Library pseudocode for shared/functions/unbounded\_configs/Unbounded

// Unbounded Variables // =================== // Sets the upper limit for a specific loop or function.

constant Unbounded : integer{} = 2^128; config Unbounded_DiscardTransactionalWrites : integer{0..Unbounded} = Unbounded; config Unbounded_DescriptorUpdate : integer{0..Unbounded} = Unbounded; config Unbounded_semihost : integer{0..Unbounded} = Unbounded; config Unbounded_ParseTrace : integer{0..Unbounded} = Unbounded; config Unbounded_ParseExtensionPacket : integer{0..Unbounded} = Unbounded; config Unbounded_ULEB128 : integer{0..Unbounded} = Unbounded; config Unbounded_ULEB128n : integer{0..Unbounded} = Unbounded; config Unbounded_FloorPow2 : integer{0..Unbounded} = Unbounded; config Unbounded_NormalizeReal : integer{0..Unbounded} = Unbounded;


## Library pseudocode for shared/functions/unpredictable/ConstrainUnpredictable

// ConstrainUnpredictable // ======================== // Return the appropriate Constraint result to control the caller's behavior. // The return value is IMPLEMENTATION DEFINED within a permitted list for each // UNPREDICTABLE case. // (The permitted list is determined by an assert or case statement at the call site.)

readonly impdef func ConstrainUnpredictable(which : Unpredictable) => Constraint begin case which of when Unpredictable_VMSR => return Constraint_UNDEF; when Unpredictable_WBOVERLAPLD => return Constraint_WBSUPPRESS; // return loaded value when Unpredictable_WBOVERLAPST => return Constraint_NONE; // store pre-writeback value when Unpredictable_LDPOVERLAP => return Constraint_UNDEF; // instruction is UNDEFINED when Unpredictable_BASEOVERLAP => return Constraint_UNKNOWN; // use UNKNOWN address when Unpredictable_DATAOVERLAP => return Constraint_UNKNOWN; // store UNKNOWN value when Unpredictable_DEVPAGE2 => return Constraint_FAULT; // take an alignment fault when Unpredictable_RESTCF => return Constraint_UNKNOWN; // Do not take a fault when Unpredictable_DEVICETAGSTORE => return Constraint_NONE; // Do not take a fault when Unpredictable_INSTRDEVICE => return Constraint_NONE; // Do not take a fault when Unpredictable_RESCPACR => return Constraint_TRUE; // Map to UNKNOWN value when Unpredictable_RESMAIR => return Constraint_UNKNOWN; // Map to UNKNOWN value when Unpredictable_S1CTAGGED => return Constraint_FALSE; // SCTLR_ELx.C == '0' marks address as untagged when Unpredictable_S2RESMEMATTR => return Constraint_NC; // Map to Noncacheable value when Unpredictable_RESTEXCB => return Constraint_UNKNOWN; // Map to UNKNOWN value when Unpredictable_RESDACR => return Constraint_UNKNOWN; // Map to UNKNOWN value when Unpredictable_RESPRRR => return Constraint_UNKNOWN; // Map to UNKNOWN value when Unpredictable_RESVTCRS => return Constraint_UNKNOWN; // Map to UNKNOWN value when Unpredictable_RESTnSZ => return Constraint_FORCE; // Map to the limit value when Unpredictable_ESRCONDPASS => return Constraint_FALSE; // Report as "AL" when Unpredictable_ILZEROIT => return Constraint_FALSE; // Do not zero PSTATE.IT when Unpredictable_ILZEROT => return Constraint_FALSE; // Do not zero PSTATE.T when Unpredictable_BPVECTORCATCHPRI => return Constraint_TRUE; // Debug Vector Catch: match on 2nd halfword when Unpredictable_VCMATCHHALF => return Constraint_FALSE; // No match when Unpredictable_VCMATCHDAPA => return Constraint_FALSE; // No match on Data Abort or Prefetch abort when Unpredictable_WPMASKANDBAS => return Constraint_FALSE; // Watchpoint disabled when Unpredictable_WPBASCONTIGUOUS => return Constraint_FALSE; // Watchpoint disabled when Unpredictable_RESWPMASK => return Constraint_DISABLED; // Watchpoint disabled when Unpredictable_WPMASKEDBITS => return Constraint_FALSE; // Watchpoint disabled when Unpredictable_RESBPWPCTRL => return Constraint_DISABLED; // Breakpoint/watchpoint disabled when Unpredictable_BPNOTIMPL => return Constraint_DISABLED; // Breakpoint disabled when Unpredictable_RESBPTYPE => return Constraint_DISABLED; // Breakpoint disabled when Unpredictable_BPNOTCTXCMP => return Constraint_DISABLED; // Breakpoint disabled when Unpredictable_RESMDSELR => return Constraint_UNKNOWN; // Map to UNKNOWN value when Unpredictable_BPMATCHHALF => return Constraint_FALSE; // No match when Unpredictable_BPMISMATCHHALF => return Constraint_FALSE; // No match when Unpredictable_BPLINKINGDISABLED => return Constraint_FALSE; // Breakpoint does not match when Unpredictable_RESTARTALIGNPC => return Constraint_FALSE; // Do not force alignment when Unpredictable_RESTARTZEROUPPERPC => return Constraint_TRUE; // Force zero extension when Unpredictable_ZEROUPPER => return Constraint_TRUE; // zero top halves of X registers when Unpredictable_ERETZEROUPPERPC => return Constraint_TRUE; // zero top half of PC when Unpredictable_A32FORCEALIGNPC => return Constraint_FALSE; // Do not force alignment when Unpredictable_SMD => return Constraint_UNDEF; // disabled SMC is Unallocated when Unpredictable_NONFAULT => return Constraint_FALSE; // Speculation enabled when Unpredictable_SVEZEROUPPER => return Constraint_TRUE; // zero top bits of Z registers when Unpredictable_SVELDNFDATA => return Constraint_TRUE; // Load mem data in NF loads when Unpredictable_SVELDNFZERO => return Constraint_TRUE; // Write zeros in NF loads when Unpredictable_CHECKSPNONEACTIVE => return Constraint_TRUE; // Check SP alignment when Unpredictable_SMEZEROUPPER => return Constraint_TRUE; // zero top bits of ZA registers when Unpredictable_NVNV1 => return Constraint_NVNV1_00; // Map unpredictable configuration of HCR_EL2[NV,NV1] // to NV = 0 and NV1 = 0 when Unpredictable_BADDR_RESS => return Constraint_RESS; // Values behave as RESS when Unpredictable_Shareability => return Constraint_OSH; // Map reserved encoding of shareability to Outer Shareable when Unpredictable_AFUPDATE => // AF update for alignment or Permission fault return Constraint_TRUE; when Unpredictable_DBUPDATE => // DB State update for alignment fault return Constraint_TRUE; when Unpredictable_Unsupported_Atomic_HW_Update => return Constraint_FALSE; // Do not raise Unsupported Atomic HW Update fault // when encountering unsupported memory attributes when Unpredictable_IESBinDebug => // Use SCTLR_ELx[].IESB in Debug state return Constraint_TRUE; when Unpredictable_BADPMSFCR => // Bad settings for PMSFCR_EL1/PMSEVFR_EL1/PMSLATFR_EL1 return Constraint_TRUE; when Unpredictable_PMBPTR_Fault_AddressSize => return Constraint_FALSE; when Unpredictable_RES_PMU_VS => // Bad setting for SVE Streaming mode filter return Constraint_FALSE; when Unpredictable_COUNT_CHAIN => // Chained PMU counters idx, idx+1 are not in same range return Constraint_FALSE; when Unpredictable_EL1TIMESTAMP => // Bad settings for TRFCR_EL1 return Constraint_EL1TIMESTAMP; when Unpredictable_EL2TIMESTAMP => // Bad settings for TRFCR_EL2 return Constraint_EL2TIMESTAMP; when Unpredictable_ZEROBTYPE => return Constraint_TRUE; // Save BTYPE in SPSR_ELx/DPSR_EL0 as '00' when Unpredictable_CLEARERRITEZERO => // Clearing sticky errors when instruction in flight return Constraint_FALSE; when Unpredictable_ALUEXCEPTIONRETURN => return Constraint_UNDEF; when Unpredictable_DBGxVR_RESS => return Constraint_FALSE; when Unpredictable_PMSCR_PCT =>

Log in to reply.