2 * This file contains sequences of code that will be copied to a
3 * fixed location, defined in <asm/fixed_code.h>. The interrupt
4 * handlers ensure that these sequences appear to be atomic when
5 * executed from userspace.
6 * These are aligned to 16 bytes, so that we have some space to replace
7 * these sequences with something else (e.g. kernel traps if we ever do
10 #include <linux/linkage.h>
11 #include <linux/unistd.h>
12 #include <asm/entry.h>
15 ENTRY(_fixed_code_start)
18 ENTRY(_sigreturn_stub)
19 P0 = __NR_rt_sigreturn;
21 /* Speculative execution paranoia. */
23 ENDPROC (_sigreturn_stub)
28 * Inputs: P0: memory address to use
30 * Output: R0: old contents of the memory address, zero extended.
36 ENDPROC (_atomic_xchg32)
40 * Compare and swap, 32 bit.
41 * Inputs: P0: memory address to use
43 * R2: new value to store
44 * The new value is stored if the contents of the memory
45 * address is equal to the compare value.
46 * Output: R0: old contents of the memory address.
55 ENDPROC (_atomic_cas32)
60 * Inputs: P0: memory address to use
62 * Outputs: R0: new contents of the memory address.
63 * R1: previous contents of the memory address.
70 ENDPROC (_atomic_add32)
75 * Inputs: P0: memory address to use
76 * R0: value to subtract
77 * Outputs: R0: new contents of the memory address.
78 * R1: previous contents of the memory address.
85 ENDPROC (_atomic_sub32)
90 * Inputs: P0: memory address to use
92 * Outputs: R0: new contents of the memory address.
93 * R1: previous contents of the memory address.
100 ENDPROC (_atomic_ior32)
104 * Atomic and, 32 bit.
105 * Inputs: P0: memory address to use
107 * Outputs: R0: new contents of the memory address.
108 * R1: previous contents of the memory address.
115 ENDPROC (_atomic_and32)
119 * Atomic xor, 32 bit.
120 * Inputs: P0: memory address to use
122 * Outputs: R0: new contents of the memory address.
123 * R1: previous contents of the memory address.
130 ENDPROC (_atomic_xor32)
134 * safe_user_instruction
135 * Four NOPS are enough to allow the pipeline to speculativily load
136 * execute anything it wants. After that, things have gone bad, and
137 * we are stuck - so panic. Since we might be in user space, we can't
138 * call panic, so just cause a unhandled exception, this should cause
139 * a dump of the trace buffer so we can tell were we are, and a reboot
141 ENTRY(_safe_user_instruction)
144 ENDPROC(_safe_user_instruction)
146 ENTRY(_fixed_code_end)