aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/setup.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2007-06-20 23:34:16 -0400
committerBryan Wu <bryan.wu@analog.com>2007-06-20 23:34:16 -0400
commit7adfb58fbd0a27469d26536f99b66391c4c8e2a0 (patch)
tree59e511ac2ddca77fe7c9d51bc6f6c6f0049a313b /arch/blackfin/kernel/setup.c
parent0ba9e350a2c129ce2878d415cf51e88611cbc0e5 (diff)
Blackfin arch: defines and provides entry points for certain user space functions at fixed addresses
This patch defines (and provides) entry points for certain user space functions at fixed addresses. The Blackfin has no usable atomic instructions, but we can ensure that these code sequences appear atomic from a user space point of view by detecting when we're in the process of executing them during the interrupt handler return path. This allows much more efficient pthread lock implementations than the bfin_spinlock syscall we're currently using. Also provided is a small sys_rt_sigreturn stub which can be used by the signal handler setup code. The signal.c part will be committed separately. Signed-off-by: Bernd Schmidt <bernd.schmidt@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch/blackfin/kernel/setup.c')
-rw-r--r--arch/blackfin/kernel/setup.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 76bf2cea61d7..534227f4da30 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -42,6 +42,7 @@
42#include <asm/cacheflush.h> 42#include <asm/cacheflush.h>
43#include <asm/blackfin.h> 43#include <asm/blackfin.h>
44#include <asm/cplbinit.h> 44#include <asm/cplbinit.h>
45#include <asm/fixed_code.h>
45 46
46u16 _bfin_swrst; 47u16 _bfin_swrst;
47 48
@@ -404,6 +405,27 @@ void __init setup_arch(char **cmdline_p)
404 405
405 printk(KERN_INFO "Hardware Trace Enabled\n"); 406 printk(KERN_INFO "Hardware Trace Enabled\n");
406 bfin_write_TBUFCTL(0x03); 407 bfin_write_TBUFCTL(0x03);
408
409 /* Copy atomic sequences to their fixed location, and sanity check that
410 these locations are the ones that we advertise to userspace. */
411 memcpy((void *)FIXED_CODE_START, &fixed_code_start,
412 FIXED_CODE_END - FIXED_CODE_START);
413 BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start
414 != SIGRETURN_STUB - FIXED_CODE_START);
415 BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start
416 != ATOMIC_XCHG32 - FIXED_CODE_START);
417 BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start
418 != ATOMIC_CAS32 - FIXED_CODE_START);
419 BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start
420 != ATOMIC_ADD32 - FIXED_CODE_START);
421 BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start
422 != ATOMIC_SUB32 - FIXED_CODE_START);
423 BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start
424 != ATOMIC_IOR32 - FIXED_CODE_START);
425 BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start
426 != ATOMIC_AND32 - FIXED_CODE_START);
427 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
428 != ATOMIC_XOR32 - FIXED_CODE_START);
407} 429}
408 430
409static int __init topology_init(void) 431static int __init topology_init(void)