summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2010-09-09 15:21:12 -0500
committerPatrick Williams <iawillia@us.ibm.com>2010-09-09 15:21:12 -0500
commit51621c156c03feff0d5e4246ecd2e18473fd347d (patch)
tree4e64c4bb13b54a081e3b2d0d2db886d4f3379def /src/lib
parent80b83026362d07b10ed1ae16afb162f7699757cb (diff)
downloadtalos-hostboot-51621c156c03feff0d5e4246ecd2e18473fd347d.tar.gz
talos-hostboot-51621c156c03feff0d5e4246ecd2e18473fd347d.zip
Add task_exec system call.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/syscall_task.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/syscall_task.C b/src/lib/syscall_task.C
index a6b575b5e..eedd78235 100644
--- a/src/lib/syscall_task.C
+++ b/src/lib/syscall_task.C
@@ -3,6 +3,8 @@
#include <kernel/task.H>
#include <kernel/taskmgr.H>
#include <kernel/cpu.H>
+#include <sys/vfs.h>
+#include <sys/msg.h>
using namespace Systemcalls;
@@ -40,3 +42,32 @@ cpuid_t task_getcpuid()
asm volatile("addi %0, 13, 0" : "=r"(task));
return task->cpu->cpu;
}
+
+tid_t task_exec(const char* file, void* ptr)
+{
+ // The VFS process is responsible for finding the module and creating the
+ // new process. So, we send a message over to that process.
+
+ tid_t child = -1;
+
+ // Create message, send.
+ msg_q_t vfsQ = (msg_q_t)_syscall0(MSGQ_RESOLVE_ROOT);
+ msg_t* msg = msg_allocate();
+ msg->type = VFS_MSG_EXEC;
+ msg->data[0] = (uint64_t) file;
+ msg->data[1] = (uint64_t) ptr;
+ int rc = msg_sendrecv(vfsQ, msg);
+
+ if (0 == rc)
+ {
+ // Get child ID from message data 0.
+ child = (tid_t) msg->data[0];
+ }
+ else
+ {
+ child = rc;
+ }
+
+ msg_free(msg);
+ return child;
+}
OpenPOWER on IntegriCloud