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 * Copyright 2007-2008 Analog Devices Inc.
12 * Licensed under the GPL-2 or later.
15 #include <linux/linkage.h>
16 #include <linux/init.h>
17 #include <linux/unistd.h>
18 #include <asm/entry.h>
22 ENTRY(_fixed_code_start)
25 ENTRY(_sigreturn_stub)
26 P0 = __NR_rt_sigreturn;
28 /* Speculative execution paranoia. */
30 ENDPROC (_sigreturn_stub)
35 * Inputs: P0: memory address to use
37 * Output: R0: old contents of the memory address, zero extended.
43 ENDPROC (_atomic_xchg32)
47 * Compare and swap, 32 bit.
48 * Inputs: P0: memory address to use
50 * R2: new value to store
51 * The new value is stored if the contents of the memory
52 * address is equal to the compare value.
53 * Output: R0: old contents of the memory address.
62 ENDPROC (_atomic_cas32)
67 * Inputs: P0: memory address to use
69 * Outputs: R0: new contents of the memory address.
70 * R1: previous contents of the memory address.
77 ENDPROC (_atomic_add32)
82 * Inputs: P0: memory address to use
83 * R0: value to subtract
84 * Outputs: R0: new contents of the memory address.
85 * R1: previous contents of the memory address.
92 ENDPROC (_atomic_sub32)
97 * Inputs: P0: memory address to use
99 * Outputs: R0: new contents of the memory address.
100 * R1: previous contents of the memory address.
107 ENDPROC (_atomic_ior32)
111 * Atomic and, 32 bit.
112 * Inputs: P0: memory address to use
114 * Outputs: R0: new contents of the memory address.
115 * R1: previous contents of the memory address.
122 ENDPROC (_atomic_and32)
126 * Atomic xor, 32 bit.
127 * Inputs: P0: memory address to use
129 * Outputs: R0: new contents of the memory address.
130 * R1: previous contents of the memory address.
137 ENDPROC (_atomic_xor32)
141 * safe_user_instruction
142 * Four NOPS are enough to allow the pipeline to speculativily load
143 * execute anything it wants. After that, things have gone bad, and
144 * we are stuck - so panic. Since we might be in user space, we can't
145 * call panic, so just cause a unhandled exception, this should cause
146 * a dump of the trace buffer so we can tell were we are, and a reboot
148 ENTRY(_safe_user_instruction)
151 ENDPROC(_safe_user_instruction)
153 ENTRY(_fixed_code_end)