diff options
author | Doug Gilbert <dgilbert@us.ibm.com> | 2011-08-22 17:14:23 -0500 |
---|---|---|
committer | Douglas R. Gilbert <dgilbert@us.ibm.com> | 2011-08-25 13:52:09 -0500 |
commit | bf46e7954689c41cccc897b8b00bcc5db5245374 (patch) | |
tree | c7807ff84dd5f8519fb0b065e03ba4939255d485 /src/kernel/syscall.C | |
parent | 968add63523933786a85ab271b277d79dc5851e6 (diff) | |
download | talos-hostboot-bf46e7954689c41cccc897b8b00bcc5db5245374.tar.gz talos-hostboot-bf46e7954689c41cccc897b8b00bcc5db5245374.zip |
map virtual address to physical address in kernel
Change-Id: Id18e604facd517598a18968af3dff927026ad894
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/272
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/kernel/syscall.C')
-rw-r--r-- | src/kernel/syscall.C | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C index c33f2b40a..098474d8e 100644 --- a/src/kernel/syscall.C +++ b/src/kernel/syscall.C @@ -36,6 +36,7 @@ #include <kernel/cpuid.H> #include <kernel/misc.H> #include <kernel/msghandler.H> +#include <kernel/vmmmgr.H> extern "C" void kernel_execute_decrementer() @@ -386,20 +387,28 @@ namespace Systemcalls */ void FutexWait(task_t * t) { - uint64_t * uaddr = (uint64_t *) TASK_GETARG0(t); + 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); - if (rc != 0) // Can only set rc if we still have control of the task, - // which is only (for certain) on error rc's. + //translate uaddr from user space to kernel space + uaddr = VmmManager::findPhysicalAddress(uaddr); + if(uaddr != (uint64_t)(-EFAULT)) + { + uint64_t rc = FutexManager::wait(t,(uint64_t *)uaddr,val); + 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); + } + } + else { - TASK_SETRTN(t,rc); + printk("Task %d terminated. No physical address found for address 0x%p", + t->tid, (void *) uaddr); + TaskEnd(t); } } @@ -409,15 +418,23 @@ namespace Systemcalls */ void FutexWake(task_t * t) { - uint64_t * uaddr = (uint64_t *) TASK_GETARG0(t); + uint64_t uaddr = (uint64_t) TASK_GETARG0(t); uint64_t count = (uint64_t) TASK_GETARG1(t); - // TODO translate uaddr from user space to kernel space - // Right now they are the same - - uint64_t started = FutexManager::wake(uaddr,count); + // translate uaddr from user space to kernel space + uaddr = VmmManager::findPhysicalAddress(uaddr); + if(uaddr != (uint64_t)(-EFAULT)) + { + uint64_t started = FutexManager::wake((uint64_t *)uaddr,count); - TASK_SETRTN(t,started); + TASK_SETRTN(t,started); + } + else + { + printk("Task %d terminated. No physical address found for address 0x%p", + t->tid, (void *) uaddr); + TaskEnd(t); + } } /** |