stac

Set AC Flag in EFLAGS

STAC

Sets Alignment Check flag (Allow user memory access).

Pseudocode Operation

EFLAGS.AC ← 1;

Encoding

Binary Layout
0F
+0
01
+1
CB
+2
 
Format Legacy
Opcode NP 0F 01 CB
Extension SMAP

Operands

Related

More in SMAP

Instruction Forms

Opcode Instruction Op/En 64/32-bit Mode CPUID Description
NP 0F 01 CB STAC ZO V/V SMAP Set the AC flag in the EFLAGS register.

Description

Sets the AC flag bit in EFLAGS register. This may enable alignment checking of user-mode data accesses. This allows explicit supervisor-mode data accesses to user-mode pages even if the SMAP bit is set in the CR4 register. This instruction's operation is the same in non-64-bit modes and 64-bit mode. Attempts to execute STAC when CPL > 0 cause #UD.

Operation

EFLAGS.AC := 1;

Flags Affected

AC set. Other flags are unaffected.

Exceptions

Protected Mode Exceptions

#UD If the LOCK prefix is used. If the CPL > 0. If CPUID.07H.00H:EBX.SMAP[20] = 0.

Real-Address Mode Exceptions

#UD If the LOCK prefix is used. If CPUID.07H.00H:EBX.SMAP[20] = 0.

Virtual-8086 Mode Exceptions

#UD The STAC instruction is not recognized in virtual-8086 mode.

Compatibility Mode Exceptions

#UD If the LOCK prefix is used. If the CPL > 0. If CPUID.07H.00H:EBX.SMAP[20] = 0.

64-Bit Mode Exceptions

#UD If the LOCK prefix is used. If the CPL > 0. If CPUID.07H.00H:EBX.SMAP[20] = 0. STAC-Set AC Flag in EFLAGS Register Vol. 2B 4-670