dcps2

Debug Change PE State to EL2 (A32)

DCPS2

Switches execution to EL2 (Debug).

Details

Changes PE execution state to EL2 for debugging purposes. This is an A32-only instruction that immediately changes exception level and may update execution state; it does not return (implicit branch to debug handler). Condition flags are not affected by the instruction itself but are context-switched at the target exception level.

Pseudocode Operation

DebugChangeEL(EL2); // Changes exception level and branches to debug handler

Example

DCPS2

Encoding

Binary Layout
111101111000
1111
1000
0000000000
10
 
Format System
Opcode 0xF78F8002
Extension A32 (System)

Operands

Reference (Arm AArch32 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0xF78F8002 DCPS2 T32 111101111000 | 1111 | 1000 | 0000000000 | 10

Description

Debug Change PE State to EL2 allows the debugger to move the PE into EL2 from a lower Exception level. DCPS2 is undefined if any of: When the PE executes DCPS2: For more information on the operation of the DCPS<n> instructions, see DCPS.

Operation

if !Halted() || !EL2Enabled() then UNDEFINED;

if ELUsingAArch32(EL2) then
    AArch32.WriteMode(M32_Hyp);
    PSTATE.E = HSCTLR.EE;

    ELR_hyp = bits(32) UNKNOWN;
    HSR = bits(32) UNKNOWN;
    SPSR_hyp = bits(32) UNKNOWN;

    DLR = bits(32) UNKNOWN;
    DSPSR = bits(32) UNKNOWN;
else                                        // Targeting EL2 using AArch64
    AArch64.MaybeZeroRegisterUppers();
    MaybeZeroSVEUppers(EL2);
    PSTATE.nRW = '0';
    PSTATE.SP = '1';
    PSTATE.EL = EL2;
    if HavePANExt() && SCTLR_EL2.SPAN == '0' && HCR_EL2.E2H == '1' && HCR_EL2.TGE == '1' then
        PSTATE.PAN = '1';
    if HaveUAOExt() then PSTATE.UAO = '0';

    ELR_EL2 = bits(64) UNKNOWN;
    ESR_EL2 = bits(64) UNKNOWN;
    SPSR_EL2 = bits(64) UNKNOWN;

    DLR_EL0 = bits(64) UNKNOWN;
    DSPSR_EL0 = bits(64) UNKNOWN;

    // SCTLR_EL2.IESB might be ignored in Debug state.
    if (HaveIESB() && SCTLR_EL2.IESB == '1' &&
          !ConstrainUnpredictableBool(Unpredictable_IESBinDebug)) then
        SynchronizeErrors();

UpdateEDSCRFields();                        // Update EDSCR PE state flags