diff options
author | Bernd Schmidt <bernd.schmidt@analog.com> | 2007-06-20 23:34:16 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-06-20 23:34:16 -0400 |
commit | 7adfb58fbd0a27469d26536f99b66391c4c8e2a0 (patch) | |
tree | 59e511ac2ddca77fe7c9d51bc6f6c6f0049a313b /arch/blackfin/kernel/process.c | |
parent | 0ba9e350a2c129ce2878d415cf51e88611cbc0e5 (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/process.c')
-rw-r--r-- | arch/blackfin/kernel/process.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index 3eff7439d8d3..6b7a94ab96c2 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include <asm/blackfin.h> | 36 | #include <asm/blackfin.h> |
37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
38 | #include <asm/fixed_code.h> | ||
38 | 39 | ||
39 | #define LED_ON 0 | 40 | #define LED_ON 0 |
40 | #define LED_OFF 1 | 41 | #define LED_OFF 1 |
@@ -350,6 +351,70 @@ unsigned long get_wchan(struct task_struct *p) | |||
350 | return 0; | 351 | return 0; |
351 | } | 352 | } |
352 | 353 | ||
354 | void finish_atomic_sections (struct pt_regs *regs) | ||
355 | { | ||
356 | if (regs->pc < ATOMIC_SEQS_START || regs->pc >= ATOMIC_SEQS_END) | ||
357 | return; | ||
358 | |||
359 | switch (regs->pc) { | ||
360 | case ATOMIC_XCHG32 + 2: | ||
361 | put_user(regs->r1, (int *)regs->p0); | ||
362 | regs->pc += 2; | ||
363 | break; | ||
364 | |||
365 | case ATOMIC_CAS32 + 2: | ||
366 | case ATOMIC_CAS32 + 4: | ||
367 | if (regs->r0 == regs->r1) | ||
368 | put_user(regs->r2, (int *)regs->p0); | ||
369 | regs->pc = ATOMIC_CAS32 + 8; | ||
370 | break; | ||
371 | case ATOMIC_CAS32 + 6: | ||
372 | put_user(regs->r2, (int *)regs->p0); | ||
373 | regs->pc += 2; | ||
374 | break; | ||
375 | |||
376 | case ATOMIC_ADD32 + 2: | ||
377 | regs->r0 = regs->r1 + regs->r0; | ||
378 | /* fall through */ | ||
379 | case ATOMIC_ADD32 + 4: | ||
380 | put_user(regs->r0, (int *)regs->p0); | ||
381 | regs->pc = ATOMIC_ADD32 + 6; | ||
382 | break; | ||
383 | |||
384 | case ATOMIC_SUB32 + 2: | ||
385 | regs->r0 = regs->r1 - regs->r0; | ||
386 | /* fall through */ | ||
387 | case ATOMIC_SUB32 + 4: | ||
388 | put_user(regs->r0, (int *)regs->p0); | ||
389 | regs->pc = ATOMIC_SUB32 + 6; | ||
390 | break; | ||
391 | |||
392 | case ATOMIC_IOR32 + 2: | ||
393 | regs->r0 = regs->r1 | regs->r0; | ||
394 | /* fall through */ | ||
395 | case ATOMIC_IOR32 + 4: | ||
396 | put_user(regs->r0, (int *)regs->p0); | ||
397 | regs->pc = ATOMIC_IOR32 + 6; | ||
398 | break; | ||
399 | |||
400 | case ATOMIC_AND32 + 2: | ||
401 | regs->r0 = regs->r1 & regs->r0; | ||
402 | /* fall through */ | ||
403 | case ATOMIC_AND32 + 4: | ||
404 | put_user(regs->r0, (int *)regs->p0); | ||
405 | regs->pc = ATOMIC_AND32 + 6; | ||
406 | break; | ||
407 | |||
408 | case ATOMIC_XOR32 + 2: | ||
409 | regs->r0 = regs->r1 ^ regs->r0; | ||
410 | /* fall through */ | ||
411 | case ATOMIC_XOR32 + 4: | ||
412 | put_user(regs->r0, (int *)regs->p0); | ||
413 | regs->pc = ATOMIC_XOR32 + 6; | ||
414 | break; | ||
415 | } | ||
416 | } | ||
417 | |||
353 | #if defined(CONFIG_ACCESS_CHECK) | 418 | #if defined(CONFIG_ACCESS_CHECK) |
354 | int _access_ok(unsigned long addr, unsigned long size) | 419 | int _access_ok(unsigned long addr, unsigned long size) |
355 | { | 420 | { |