Path: blob/master/arch/blackfin/kernel/fixed_code.S
10817 views
/*1* This file contains sequences of code that will be copied to a2* fixed location, defined in <asm/fixed_code.h>. The interrupt3* handlers ensure that these sequences appear to be atomic when4* executed from userspace.5* These are aligned to 16 bytes, so that we have some space to replace6* these sequences with something else (e.g. kernel traps if we ever do7* BF561 SMP).8*9* Copyright 2007-2008 Analog Devices Inc.10*11* Licensed under the GPL-2 or later.12*/1314#include <linux/linkage.h>15#include <linux/init.h>16#include <linux/unistd.h>17#include <asm/entry.h>1819__INIT2021ENTRY(_fixed_code_start)2223.align 1624ENTRY(_sigreturn_stub)25P0 = __NR_rt_sigreturn;26EXCPT 0;27/* Speculative execution paranoia. */280: JUMP.S 0b;29ENDPROC (_sigreturn_stub)3031.align 1632/*33* Atomic swap, 8 bit.34* Inputs: P0: memory address to use35* R1: value to store36* Output: R0: old contents of the memory address, zero extended.37*/38ENTRY(_atomic_xchg32)39R0 = [P0];40[P0] = R1;41rts;42ENDPROC (_atomic_xchg32)4344.align 1645/*46* Compare and swap, 32 bit.47* Inputs: P0: memory address to use48* R1: compare value49* R2: new value to store50* The new value is stored if the contents of the memory51* address is equal to the compare value.52* Output: R0: old contents of the memory address.53*/54ENTRY(_atomic_cas32)55R0 = [P0];56CC = R0 == R1;57IF !CC JUMP 1f;58[P0] = R2;591:60rts;61ENDPROC (_atomic_cas32)6263.align 1664/*65* Atomic add, 32 bit.66* Inputs: P0: memory address to use67* R0: value to add68* Outputs: R0: new contents of the memory address.69* R1: previous contents of the memory address.70*/71ENTRY(_atomic_add32)72R1 = [P0];73R0 = R1 + R0;74[P0] = R0;75rts;76ENDPROC (_atomic_add32)7778.align 1679/*80* Atomic sub, 32 bit.81* Inputs: P0: memory address to use82* R0: value to subtract83* Outputs: R0: new contents of the memory address.84* R1: previous contents of the memory address.85*/86ENTRY(_atomic_sub32)87R1 = [P0];88R0 = R1 - R0;89[P0] = R0;90rts;91ENDPROC (_atomic_sub32)9293.align 1694/*95* Atomic ior, 32 bit.96* Inputs: P0: memory address to use97* R0: value to ior98* Outputs: R0: new contents of the memory address.99* R1: previous contents of the memory address.100*/101ENTRY(_atomic_ior32)102R1 = [P0];103R0 = R1 | R0;104[P0] = R0;105rts;106ENDPROC (_atomic_ior32)107108.align 16109/*110* Atomic and, 32 bit.111* Inputs: P0: memory address to use112* R0: value to and113* Outputs: R0: new contents of the memory address.114* R1: previous contents of the memory address.115*/116ENTRY(_atomic_and32)117R1 = [P0];118R0 = R1 & R0;119[P0] = R0;120rts;121ENDPROC (_atomic_and32)122123.align 16124/*125* Atomic xor, 32 bit.126* Inputs: P0: memory address to use127* R0: value to xor128* Outputs: R0: new contents of the memory address.129* R1: previous contents of the memory address.130*/131ENTRY(_atomic_xor32)132R1 = [P0];133R0 = R1 ^ R0;134[P0] = R0;135rts;136ENDPROC (_atomic_xor32)137138.align 16139/*140* safe_user_instruction141* Four NOPS are enough to allow the pipeline to speculativily load142* execute anything it wants. After that, things have gone bad, and143* we are stuck - so panic. Since we might be in user space, we can't144* call panic, so just cause a unhandled exception, this should cause145* a dump of the trace buffer so we can tell were we are, and a reboot146*/147ENTRY(_safe_user_instruction)148NOP; NOP; NOP; NOP;149EXCPT 0x4;150ENDPROC(_safe_user_instruction)151152ENTRY(_fixed_code_end)153154__FINIT155156157