Index: uspace/lib/libc/Makefile
===================================================================
--- uspace/lib/libc/Makefile	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/Makefile	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -52,4 +52,6 @@
 	generic/string.c \
 	generic/fibril.c \
+	generic/pcb.c \
+	generic/smc.c \
 	generic/thread.c \
 	generic/tls.c \
Index: uspace/lib/libc/arch/amd64/src/entry.s
===================================================================
--- uspace/lib/libc/arch/amd64/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/amd64/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -35,7 +35,10 @@
 ## User-space task entry point
 #
+# %rdi contains the PCB pointer
 #
 __entry:
+	# %rdi was deliberately chosen as the first argument is also in %rdi
+	# Pass PCB pointer to __main (no operation)
 	call __main
-	call main
+
 	call __exit
Index: uspace/lib/libc/arch/arm32/src/entry.s
===================================================================
--- uspace/lib/libc/arch/arm32/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/arm32/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -35,7 +35,10 @@
 ## User-space task entry point
 #
+# r1 contains the PCB pointer
 #
 __entry:
+	# Pass pcb_ptr to __main as the first argument (in r0)
+	mov r0, r1
 	bl __main
-	bl main
+
 	bl __exit
Index: uspace/lib/libc/arch/ia32/src/entry.s
===================================================================
--- uspace/lib/libc/arch/ia32/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/ia32/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -35,4 +35,5 @@
 ## User-space task entry point
 #
+# %ebx contains the PCB pointer
 #
 __entry:
@@ -42,6 +43,8 @@
 	mov %ax, %fs
 	# Do not set %gs, it contains descriptor that can see TLS
-	
+
+	# Pass the PCB pointer to __main as the first argument
+	pushl %ebx
 	call __main
-	call main
+
 	call __exit
Index: uspace/lib/libc/arch/ia64/src/entry.s
===================================================================
--- uspace/lib/libc/arch/ia64/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/ia64/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -35,11 +35,13 @@
 ## User-space task entry point
 #
+# r2 contains the PCB pointer
 #
 __entry:
 	alloc loc0 = ar.pfs, 0, 1, 2, 0
-	mov r1 = _gp 
+	mov r1 = _gp
+
+	# Pass PCB pointer as the first argument to __main
+	mov out0 = r2
 	br.call.sptk.many b0 = __main
 0:
-	br.call.sptk.many b0 = main
-1:
 	br.call.sptk.many b0 = __exit
Index: uspace/lib/libc/arch/mips32/src/entry.s
===================================================================
--- uspace/lib/libc/arch/mips32/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/mips32/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -36,4 +36,5 @@
 ## User-space task entry point
 #
+# $a0 ($4) contains the PCB pointer
 #
 .ent __entry
@@ -41,6 +42,5 @@
 	.frame $sp, 32, $31
 	.cpload $25
-	
-	
+
 	# Mips o32 may store its arguments on stack, make space (16 bytes),
 	# so that it could work with -O0
@@ -49,9 +49,10 @@
 	addiu $sp, -32
 	.cprestore 16   # Allow PIC code
-	
+
+	# Pass pcb_ptr to __main() as the first argument. pcb_ptr is already
+	# in $a0. As the first argument is passed in $a0, no operation
+	# is needed.
+
 	jal __main
-	nop
-	
-	jal main
 	nop
 	
Index: uspace/lib/libc/arch/ppc32/src/entry.s
===================================================================
--- uspace/lib/libc/arch/ppc32/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/ppc32/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -35,7 +35,10 @@
 ## User-space task entry point
 #
+# r3 contains the PCB pointer
 #
 __entry:
+	# Pass the PCB pointer to __main() as the first argument.
+	# Since the first argument is passed in r3, no operation is needed.
 	bl __main
-	bl main
+
 	bl __exit
Index: uspace/lib/libc/arch/ppc64/src/entry.s
===================================================================
--- uspace/lib/libc/arch/ppc64/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/ppc64/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -32,5 +32,4 @@
 
 .globl __entry
-.globl __entry_driver
 
 ## User-space task entry point
@@ -39,10 +38,3 @@
 __entry:
 	bl __main
-	bl __io_init
-	bl main
 	bl __exit
-
-__entry_driver:
-	bl __main
-	bl main
-	bl __exit
Index: uspace/lib/libc/arch/sparc64/src/entry.s
===================================================================
--- uspace/lib/libc/arch/sparc64/src/entry.s	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/arch/sparc64/src/entry.s	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -35,11 +35,14 @@
 ## User-space task entry point
 #
+# %o0 contains uarg
+# %o1 contains pcb_ptr
 #
 __entry:
+	# Pass pcb_ptr as the first argument to __main()
+	mov %o1, %o0
 	sethi %hi(_gp), %l7
 	call __main
 	or %l7, %lo(_gp), %l7
-	call main
-	nop
+
 	call __exit
 	nop
Index: uspace/lib/libc/generic/as.c
===================================================================
--- uspace/lib/libc/generic/as.c	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/generic/as.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -84,4 +84,18 @@
 {
 	return __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t ) address);
+}
+
+/** Change address-space area flags.
+ *
+ * @param address Virtual address pointing into the address space area being
+ * 	modified.
+ * @param flags New flags describing type of the area.
+ *
+ * @return Zero on success or a code from @ref errno.h on failure.
+ */
+int as_area_change_flags(void *address, int flags)
+{
+	return __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address,
+	    (sysarg_t) flags);
 }
 
Index: uspace/lib/libc/generic/io/stream.c
===================================================================
--- uspace/lib/libc/generic/io/stream.c	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/generic/io/stream.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -97,4 +97,13 @@
 }
 
+void close_console(void)
+{
+	if (console_phone >= 0) {
+		if (ipc_hangup(console_phone) == 0) {
+			console_phone = -1;
+		}
+	}
+}
+
 void klog_update(void)
 {
Index: uspace/lib/libc/generic/libc.c
===================================================================
--- uspace/lib/libc/generic/libc.c	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/generic/libc.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -49,6 +49,8 @@
 #include <async.h>
 #include <as.h>
+#include <loader/pcb.h>
 
 extern char _heap;
+extern int main(int argc, char *argv[]);
 
 void _exit(int status)
@@ -57,7 +59,9 @@
 }
 
-void __main(void)
+void __main(void *pcb_ptr)
 {
 	fibril_t *f;
+	int argc;
+	char **argv;
 
 	(void) as_area_create(&_heap, 1, AS_AREA_WRITE | AS_AREA_READ);
@@ -67,4 +71,17 @@
 	
 	open_console();
+
+	/* Save the PCB pointer */
+	__pcb = (pcb_t *)pcb_ptr;
+
+	if (__pcb == NULL) {
+		argc = 0;
+		argv = NULL;
+	} else {
+		argc = __pcb->argc;
+		argv = __pcb->argv;
+	}
+
+	main(argc, argv);
 }
 
Index: uspace/lib/libc/generic/pcb.c
===================================================================
--- uspace/lib/libc/generic/pcb.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
+++ uspace/lib/libc/generic/pcb.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2008 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <loader/pcb.h>
+
+pcb_t *__pcb;
+
+/** @}
+ */
Index: uspace/lib/libc/generic/smc.c
===================================================================
--- uspace/lib/libc/generic/smc.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
+++ uspace/lib/libc/generic/smc.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#include <libc.h>
+#include <sys/types.h>
+
+int smc_coherence(void *address, size_t size)
+{
+	return __SYSCALL2(SYS_SMC_COHERENCE, (sysarg_t) address,
+	    (sysarg_t) size);
+}
+
+/** @}
+ */
Index: uspace/lib/libc/generic/task.c
===================================================================
--- uspace/lib/libc/generic/task.c	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/generic/task.c	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2006 Jakub Jermar
+ * Copyright (c) 2008 Jiri Svoboda
  * All rights reserved.
  *
@@ -34,5 +35,11 @@
 
 #include <task.h>
+#include <ipc/ipc.h>
+#include <ipc/loader.h>
 #include <libc.h>
+#include <string.h>
+#include <stdlib.h>
+#include <async.h>
+#include <errno.h>
 
 task_id_t task_get_id(void)
@@ -45,7 +52,121 @@
 }
 
-int task_spawn(void *image, size_t size)
+static int task_spawn_loader(void)
 {
-	return __SYSCALL2(SYS_TASK_SPAWN, (sysarg_t) image, (sysarg_t) size);
+	int phone_id, rc;
+
+	rc = __SYSCALL1(SYS_PROGRAM_SPAWN_LOADER, (sysarg_t) &phone_id);
+	if (rc != 0)
+		return rc;
+
+	return phone_id;
+}
+
+static int loader_set_args(int phone_id, const char *argv[])
+{
+	aid_t req;
+	ipc_call_t answer;
+	ipcarg_t rc;
+
+	const char **ap;
+	char *dp;
+	char *arg_buf;
+	size_t buffer_size;
+	size_t len;
+
+	/* 
+	 * Serialize the arguments into a single array. First
+	 * compute size of the buffer needed.
+	 */
+	ap = argv;
+	buffer_size = 0;
+	while (*ap != NULL) {
+		buffer_size += strlen(*ap) + 1;
+		++ap;
+	}
+
+	arg_buf = malloc(buffer_size);
+	if (arg_buf == NULL) return ENOMEM;
+
+	/* Now fill the buffer with null-terminated argument strings */
+	ap = argv;
+	dp = arg_buf;
+	while (*ap != NULL) {
+		strcpy(dp, *ap);
+		dp += strlen(*ap) + 1;
+
+		++ap;
+	}
+
+	/* Send serialized arguments to the loader */
+
+	req = async_send_0(phone_id, LOADER_SET_ARGS, &answer);
+	rc = ipc_data_write_start(phone_id, (void *)arg_buf, buffer_size);
+	if (rc != EOK) {
+		async_wait_for(req, NULL);
+		return rc;
+	}
+
+	async_wait_for(req, &rc);
+	if (rc != EOK) return rc;
+
+	/* Free temporary buffer */
+	free(arg_buf);
+
+	return EOK;
+}
+
+/** Create a new task by running an executable from VFS.
+ *
+ * @param path	pathname of the binary to execute
+ * @param argv	command-line arguments
+ * @return	ID of the newly created task or zero on error.
+ */
+task_id_t task_spawn(const char *path, const char *argv[])
+{
+	int phone_id;
+	ipc_call_t answer;
+	aid_t req;
+	int rc;
+	ipcarg_t retval;
+
+	/* Spawn a program loader */	
+	phone_id = task_spawn_loader();
+	if (phone_id < 0) return 0;
+
+	/*
+	 * Say hello so that the loader knows the incoming connection's
+	 * phone hash.
+	 */
+	rc = async_req_0_0(phone_id, LOADER_HELLO);
+	if (rc != EOK) return 0;
+
+	/* Send program pathname */
+	req = async_send_0(phone_id, LOADER_SET_PATHNAME, &answer);
+	rc = ipc_data_write_start(phone_id, (void *)path, strlen(path));
+	if (rc != EOK) {
+		async_wait_for(req, NULL);
+		return 1;
+	}
+
+	async_wait_for(req, &retval);
+	if (retval != EOK) goto error;
+
+	/* Send arguments */
+	rc = loader_set_args(phone_id, argv);
+	if (rc != EOK) goto error;
+
+	/* Request loader to start the program */	
+	rc = async_req_0_0(phone_id, LOADER_RUN);
+	if (rc != EOK) goto error;
+
+	/* Success */
+	ipc_hangup(phone_id);
+	return 1;
+
+	/* Error exit */
+error:
+	ipc_hangup(phone_id);
+	return 0;
 }
 
Index: uspace/lib/libc/include/as.h
===================================================================
--- uspace/lib/libc/include/as.h	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/include/as.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -43,4 +43,5 @@
 extern void *as_area_create(void *address, size_t size, int flags);
 extern int as_area_resize(void *address, size_t size, int flags);
+extern int as_area_change_flags(void *address, int flags);
 extern int as_area_destroy(void *address);
 extern void *set_maxheapsize(size_t mhs);
Index: uspace/lib/libc/include/io/stream.h
===================================================================
--- uspace/lib/libc/include/io/stream.h	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/include/io/stream.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -41,4 +41,5 @@
 
 extern void open_console(void);
+extern void close_console(void);
 extern void klog_update(void);
 
Index: uspace/lib/libc/include/ipc/loader.h
===================================================================
--- uspace/lib/libc/include/ipc/loader.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
+++ uspace/lib/libc/include/ipc/loader.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2008 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libcipc
+ * @{
+ */
+/** @file
+ */ 
+
+#ifndef LIBC_LOADER_H_
+#define LIBC_LOADER_H_
+
+#include <ipc/ipc.h>
+
+typedef enum {
+	LOADER_HELLO = IPC_FIRST_USER_METHOD,
+	LOADER_SET_PATHNAME,
+	LOADER_SET_ARGS,
+	LOADER_RUN
+} fb_request_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/include/libc.h
===================================================================
--- uspace/lib/libc/include/libc.h	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/include/libc.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -49,5 +49,5 @@
     __syscall(p1, p2, p3, p4, p5, p6,id)
 
-extern void __main(void);
+extern void __main(void *pcb_ptr);
 extern void __exit(void);
 
Index: uspace/lib/libc/include/loader/pcb.h
===================================================================
--- uspace/lib/libc/include/loader/pcb.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
+++ uspace/lib/libc/include/loader/pcb.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2008 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup fs
+ * @{
+ */
+/** @file
+ * @brief Program Control Block interface.
+ */
+
+#ifndef LIBC_PCB_H_
+#define LIBC_PCB_H_
+
+#include <sys/types.h>
+
+typedef void (*entry_point_t)(void);
+
+/**
+ * Holds pointers to data passed from the program loader to the program
+ * and/or to the dynamic linker. This includes the program entry point,
+ * arguments, environment variables etc.
+ */
+typedef struct {
+	/** Program entry point */
+	entry_point_t entry;
+
+	/** Number of command-line arguments */
+	int argc;
+	/** Command-line arguments */
+	char **argv;
+
+	/*
+	 * ELF-specific data
+	 */
+	/** Pointer to ELF dynamic section of the program */
+	void *dynamic;
+	/** Pointer to dynamic section of the runtime linker */
+	void *rtld_dynamic;
+	/** Runtime-linker load bias */
+	uintptr_t rtld_bias;
+} pcb_t;
+
+extern pcb_t *__pcb;
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/lib/libc/include/smc.h
===================================================================
--- uspace/lib/libc/include/smc.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
+++ uspace/lib/libc/include/smc.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_SMC_H_
+#define LIBC_SMC_H_
+
+#include <sys/types.h>
+
+extern int smc_coherence(void *address, size_t size);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/include/task.h
===================================================================
--- uspace/lib/libc/include/task.h	(revision 412a31eb32eab861db5c0576e4bd9ef9dd4d19a8)
+++ uspace/lib/libc/include/task.h	(revision 0d387d2adba60bc09a047a4aeb5fe9c90f7ad2cc)
@@ -41,5 +41,5 @@
 
 extern task_id_t task_get_id(void);
-extern int task_spawn(void *image, size_t size);
+extern task_id_t task_spawn(const char *path, const char *argv[]);
 
 #endif
