xref: /OK3568_Linux_fs/kernel/Documentation/arm64/legacy_instructions.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===================
2*4882a593SmuzhiyunLegacy instructions
3*4882a593Smuzhiyun===================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThe arm64 port of the Linux kernel provides infrastructure to support
6*4882a593Smuzhiyunemulation of instructions which have been deprecated, or obsoleted in
7*4882a593Smuzhiyunthe architecture. The infrastructure code uses undefined instruction
8*4882a593Smuzhiyunhooks to support emulation. Where available it also allows turning on
9*4882a593Smuzhiyunthe instruction execution in hardware.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunThe emulation mode can be controlled by writing to sysctl nodes
12*4882a593Smuzhiyun(/proc/sys/abi). The following explains the different execution
13*4882a593Smuzhiyunbehaviours and the corresponding values of the sysctl nodes -
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun* Undef
16*4882a593Smuzhiyun    Value: 0
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun  Generates undefined instruction abort. Default for instructions that
19*4882a593Smuzhiyun  have been obsoleted in the architecture, e.g., SWP
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun* Emulate
22*4882a593Smuzhiyun    Value: 1
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun  Uses software emulation. To aid migration of software, in this mode
25*4882a593Smuzhiyun  usage of emulated instruction is traced as well as rate limited
26*4882a593Smuzhiyun  warnings are issued. This is the default for deprecated
27*4882a593Smuzhiyun  instructions, .e.g., CP15 barriers
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun* Hardware Execution
30*4882a593Smuzhiyun    Value: 2
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun  Although marked as deprecated, some implementations may support the
33*4882a593Smuzhiyun  enabling/disabling of hardware support for the execution of these
34*4882a593Smuzhiyun  instructions. Using hardware execution generally provides better
35*4882a593Smuzhiyun  performance, but at the loss of ability to gather runtime statistics
36*4882a593Smuzhiyun  about the use of the deprecated instructions.
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunThe default mode depends on the status of the instruction in the
39*4882a593Smuzhiyunarchitecture. Deprecated instructions should default to emulation
40*4882a593Smuzhiyunwhile obsolete instructions must be undefined by default.
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunNote: Instruction emulation may not be possible in all cases. See
43*4882a593Smuzhiyunindividual instruction notes for further information.
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunSupported legacy instructions
46*4882a593Smuzhiyun-----------------------------
47*4882a593Smuzhiyun* SWP{B}
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun:Node: /proc/sys/abi/swp
50*4882a593Smuzhiyun:Status: Obsolete
51*4882a593Smuzhiyun:Default: Undef (0)
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun* CP15 Barriers
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun:Node: /proc/sys/abi/cp15_barrier
56*4882a593Smuzhiyun:Status: Deprecated
57*4882a593Smuzhiyun:Default: Emulate (1)
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun* SETEND
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun:Node: /proc/sys/abi/setend
62*4882a593Smuzhiyun:Status: Deprecated
63*4882a593Smuzhiyun:Default: Emulate (1)*
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun  Note: All the cpus on the system must have mixed endian support at EL0
66*4882a593Smuzhiyun  for this feature to be enabled. If a new CPU - which doesn't support mixed
67*4882a593Smuzhiyun  endian - is hotplugged in after this feature has been enabled, there could
68*4882a593Smuzhiyun  be unexpected results in the application.
69