diff options
| author | Borislav Petkov <bp@suse.de> | 2016-11-23 21:13:40 +0100 |
|---|---|---|
| committer | Borislav Petkov <bp@suse.de> | 2016-11-23 21:13:40 +0100 |
| commit | 627bc29ed90ca50dbf7a4e7b43c267a2920bbadb (patch) | |
| tree | 838d8aca5a04166b6ad74a2ef0f5291224768501 /arch/arc/kernel/process.c | |
| parent | 044e7a414be9ba20826e5fd482214686193fe7b6 (diff) | |
| parent | 3f5a7896a5096fd50030a04d4c3f28a7441e30a5 (diff) | |
Merge tip:ras/core to pick up dependent changes
tip:ras/core contains the respective Fam17h x86 RAS bits which
amd64_edac is going to use. So merge it into the EDAC branch.
Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'arch/arc/kernel/process.c')
| -rw-r--r-- | arch/arc/kernel/process.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c index be1972bd2729..59aa43cb146e 100644 --- a/arch/arc/kernel/process.c +++ b/arch/arc/kernel/process.c @@ -41,6 +41,39 @@ SYSCALL_DEFINE0(arc_gettls) return task_thread_info(current)->thr_ptr; } +SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) +{ + int uval; + int ret; + + /* + * This is only for old cores lacking LLOCK/SCOND, which by defintion + * can't possibly be SMP. Thus doesn't need to be SMP safe. + * And this also helps reduce the overhead for serializing in + * the UP case + */ + WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP)); + + if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) + return -EFAULT; + + preempt_disable(); + + ret = __get_user(uval, uaddr); + if (ret) + goto done; + + if (uval != expected) + ret = -EAGAIN; + else + ret = __put_user(new, uaddr); + +done: + preempt_enable(); + + return ret; +} + void arch_cpu_idle(void) { /* sleep, but enable all interrupts before committing */ |
