smc

Secure Monitor Call (A32)

SMC<c> #<imm>

Calls the Secure Monitor (EL3).

Pseudocode Operation

exception_taken ← 'SMC'
ELR_EL3 ← PC + 4
SPSR_EL3 ← CPSR
CPSR.M ← '10110' (Monitor mode)
PC ← VECTOR_SMC

Example

SMC #16

Encoding

Binary Layout
cond
31:28
00010
27:23
11
22:21
0
20
000000000000
19:8
0111
7:4
imm4
3:0
 
Format System
Opcode 0x01600070
Extension A32 (System)

Operands

  • imm
    ID

Related

Other forms of smc

  • smc Secure Monitor Call (Thumb)

More in A32 (System)

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x01600070 SMC{<c>}{<q>} {#}<imm4> A32 cond | 00010 | 11 | 0 | 000000000000 | 0111 | imm4
0xF7F08000 SMC{<c>}{<q>} {#}<imm4> T32 11110111111 | 1 | imm4 | 10 | 0 | 0 | 000000000000

Description

Secure Monitor Call causes a Secure Monitor Call exception. For more information see Secure Monitor Call (SMC) exception. SMC is available only for software executing at EL1 or higher. It is undefined in User mode. If the values of HCR.TSC and SCR.SCD are both 0, execution of an SMC instruction at EL1 or higher generates a Secure Monitor Call exception that is taken to EL3. When EL3 is using AArch32 this exception is taken to Monitor mode. When EL3 is using AArch64, it is the SCR_EL3.SMD bit, rather than the SCR.SCD bit, that can change the effect of executing an SMC instruction. If the value of HCR.TSC is 1, execution of an SMC instruction in a Non-secure EL1 mode generates an exception that is taken to EL2, regardless of the value of SCR.SCD. When EL2 is using AArch32, this is a Hyp Trap exception that is taken to Hyp mode. For more information see Traps to Hyp mode of Non-secure EL1 execution of SMC instructions. If the value of HCR.TSC is 0 and the value of SCR.SCD is 1, the SMC instruction is:

Operation

if ConditionPassed() then
    EncodingSpecificOperations();

    AArch32.CheckForSMCUndefOrTrap();

    if !ELUsingAArch32(EL3) then
        if SCR_EL3.SMD == '1' then
            // SMC disabled.
            UNDEFINED;
    else
        if SCR.SCD == '1' then
            // SMC disabled
            if CurrentSecurityState() == SS_Secure then
                // Executes either as a NOP or UNALLOCATED.
                c = ConstrainUnpredictable(Unpredictable_SMD);
                assert c IN {Constraint_NOP, Constraint_UNDEF};
                if c == Constraint_NOP then EndOfInstruction();
            UNDEFINED;

    if !ELUsingAArch32(EL3) then
        AArch64.CallSecureMonitor(Zeros(16));
    else
        AArch32.TakeSMCException();