summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/futexmgr.C2
-rw-r--r--src/kernel/syscall.C9
2 files changed, 9 insertions, 2 deletions
diff --git a/src/kernel/futexmgr.C b/src/kernel/futexmgr.C
index 6271471aa..37ad54586 100644
--- a/src/kernel/futexmgr.C
+++ b/src/kernel/futexmgr.C
@@ -33,7 +33,7 @@ uint64_t FutexManager::_wait(task_t* i_task, uint64_t * i_addr, uint64_t i_val)
iv_lock.lock();
- if(*i_addr != i_val)
+ if(unlikely(*i_addr != i_val))
{
// some other thread has modified the futex
// bail-out retry required.
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index f96f8d372..1001ef361 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -356,11 +356,18 @@ namespace Systemcalls
uint64_t * uaddr = (uint64_t *) TASK_GETARG0(t);
uint64_t val = (uint64_t) TASK_GETARG1(t);
+ // Set RC to success initially.
+ TASK_SETRTN(t,0);
+
//TODO translate uaddr from user space to kernel space
// Right now they are the same.
uint64_t rc = FutexManager::wait(t,uaddr,val);
- TASK_SETRTN(t,rc);
+ if (rc != 0) // Can only set rc if we still have control of the task,
+ // which is only (for certain) on error rc's.
+ {
+ TASK_SETRTN(t,rc);
+ }
}
/**
OpenPOWER on IntegriCloud