smc

Secure Monitor Call (Thumb)

SMC #<imm>

Calls the Secure Monitor (EL3) from Thumb state.

Details

Generates a secure monitor call exception, transitioning to EL3 with an optional 16-bit immediate value encoding the secure service request. The instruction is unconditional and available in Thumb state. Execution requires that secure state is supported; the secure monitor takes control and may use the immediate as a service identifier.

Pseudocode Operation

ExceptionSyndromeISS ← imm16; RaiseException(SecureMonitorCallException)

Example

SMC #16

Encoding

Binary Layout
11110111111
1
imm4
10
0
0
000000000000
 
Format Thumb System
Opcode 0xF7F08000
Extension A32 (Security)

Operands

  • imm
    ID

Reference (Arm AArch32 ISA)

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();