Legacy instructions

The arm64 port of the Linux kernel provides infrastructure to supportemulation of instructions which have been deprecated, or obsoleted inthe architecture. The infrastructure code uses undefined instructionhooks to support emulation. Where available it also allows turning onthe instruction execution in hardware.

The emulation mode can be controlled by writing to sysctl nodes(/proc/sys/abi). The following explains the different executionbehaviours and the corresponding values of the sysctl nodes -

  • Undef

    Value: 0

    Generates undefined instruction abort. Default for instructions thathave been obsoleted in the architecture, e.g., SWP

  • Emulate

    Value: 1

    Uses software emulation. To aid migration of software, in this modeusage of emulated instruction is traced as well as rate limitedwarnings are issued. This is the default for deprecatedinstructions, .e.g., CP15 barriers

  • Hardware Execution

    Value: 2

    Although marked as deprecated, some implementations may support theenabling/disabling of hardware support for the execution of theseinstructions. Using hardware execution generally provides betterperformance, but at the loss of ability to gather runtime statisticsabout the use of the deprecated instructions.

The default mode depends on the status of the instruction in thearchitecture. Deprecated instructions should default to emulationwhile obsolete instructions must be undefined by default.

Note: Instruction emulation may not be possible in all cases. Seeindividual instruction notes for further information.

Supported legacy instructions

  • SWP{B}

Node:

/proc/sys/abi/swp

Status:

Obsolete

Default:

Undef (0)

  • CP15 Barriers

Node:

/proc/sys/abi/cp15_barrier

Status:

Deprecated

Default:

Emulate (1)

  • SETEND

Node:

/proc/sys/abi/setend

Status:

Deprecated

Default:

Emulate (1)*

Note: All the cpus on the system must have mixed endian support at EL0for this feature to be enabled. If a new CPU - which doesn’t support mixedendian - is hotplugged in after this feature has been enabled, there couldbe unexpected results in the application.