Index: generic/src/proc/task.c
===================================================================
--- generic/src/proc/task.c	(revision e74cb73cbab961321532b012b1090380dd325f74)
+++ generic/src/proc/task.c	(revision 1065603efb7bcf9b443a20c1bfea32b1545909c0)
@@ -27,4 +27,5 @@
  */
 
+#include <main/uinit.h>
 #include <proc/thread.h>
 #include <proc/task.h>
@@ -39,4 +40,6 @@
 #include <ipc/ns.h>
 #include <memstr.h>
+
+#include <elf.h>
 
 SPINLOCK_INITIALIZE(tasks_lock);
@@ -60,5 +63,5 @@
  * @param as Task's address space.
  *
- * @return New task's structure on success, NULL on failure.
+ * @return New task's structure
  *
  */
@@ -89,2 +92,35 @@
 }
 
+/** Create new task with 1 thread and run it
+ *
+ * @return Task of the running program or NULL on error
+ */
+task_t * task_run_program(void *program_addr)
+{
+	as_t *as;
+	as_area_t *a;
+	int rc;
+	thread_t *t;
+	task_t *task;
+
+	as = as_create(0);
+
+	rc = elf_load((elf_header_t *) config.init_addr, as);
+	if (rc != EE_OK) {
+		as_free(as);
+		return NULL;
+	} 
+	
+	task = task_create(as);
+	t = thread_create(uinit, (void *)((elf_header_t *) config.init_addr)->e_entry, 
+			  task, THREAD_USER_STACK);
+	
+	/*
+	 * Create the data as_area.
+	 */
+	a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS);
+	
+	thread_ready(t);
+
+	return task;
+}
