Index: kernel/generic/include/arch.h
===================================================================
--- kernel/generic/include/arch.h	(revision 9c75782060ff62e5868fdca2b26e311fe5e9be29)
+++ kernel/generic/include/arch.h	(revision 473d5d202238ab61558d1695b8e41f478815a862)
@@ -41,5 +41,11 @@
 #include <mm/as.h>
 
-#define DEFAULT_CONTEXT  0
+/*
+ * THE is not an abbreviation, but the English definite article written in
+ * capital letters. It means the current pointer to something, e.g. thread,
+ * processor or address space. Kind reader of this comment shall appreciate
+ * the wit of constructs like THE->thread and similar.
+ */
+#define THE  ((the_t * )(get_stack_base()))
 
 #define CPU                  THE->cpu
@@ -47,8 +53,12 @@
 #define TASK                 THE->task
 #define AS                   THE->as
-#define CONTEXT              (THE->task ? THE->task->context : DEFAULT_CONTEXT)
 #define PREEMPTION_DISABLED  THE->preemption_disabled
+#define MAGIC                UINT32_C(0xfacefeed)
 
-#define context_check(ctx1, ctx2)  ((ctx1) == (ctx2))
+#define container_check(ctn1, ctn2)  ((ctn1) == (ctn2))
+
+#define DEFAULT_CONTAINER  0
+#define CONTAINER \
+	((THE->task) ? (THE->task->container) : (DEFAULT_CONTAINER))
 
 /**
@@ -63,13 +73,6 @@
 	cpu_t *cpu;                  /**< Executing cpu. */
 	as_t *as;                    /**< Current address space. */
+	uint32_t magic;              /**< Magic value */
 } the_t;
-
-/*
- * THE is not an abbreviation, but the English definite article written in
- * capital letters. It means the current pointer to something, e.g. thread,
- * processor or address space. Kind reader of this comment shall appreciate
- * the wit of constructs like THE->thread and similar.
- */
-#define THE  ((the_t * )(get_stack_base()))
 
 extern void the_initialize(the_t *);
Index: kernel/generic/src/ddi/ddi.c
===================================================================
--- kernel/generic/src/ddi/ddi.c	(revision 9c75782060ff62e5868fdca2b26e311fe5e9be29)
+++ kernel/generic/src/ddi/ddi.c	(revision 473d5d202238ab61558d1695b8e41f478815a862)
@@ -224,5 +224,5 @@
 	task_t *task = task_find_by_id(id);
 	
-	if ((!task) || (!context_check(CONTEXT, task->context))) {
+	if ((!task) || (!container_check(CONTAINER, task->container))) {
 		/*
 		 * There is no task with the specified ID
Index: kernel/generic/src/debug/panic.c
===================================================================
--- kernel/generic/src/debug/panic.c	(revision 9c75782060ff62e5868fdca2b26e311fe5e9be29)
+++ kernel/generic/src/debug/panic.c	(revision 473d5d202238ab61558d1695b8e41f478815a862)
@@ -95,11 +95,11 @@
 	printf("\n");
 	
-	printf("THE=%p", THE);
+	printf("THE=%p: ", THE);
 	if (THE != NULL) {
-		printf(": pe=%" PRIun " thr=%p task=%p cpu=%p as=%p",
+		printf("pe=%" PRIun " thr=%p task=%p cpu=%p as=%p magic=%#x\n",
 		    THE->preemption_disabled, THE->thread, THE->task,
-		    THE->cpu, THE->as);
-	}
-	printf("\n");
+		    THE->cpu, THE->as, THE->magic);
+	} else
+		printf("invalid\n");
 	
 	if (istate) {
Index: kernel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision 9c75782060ff62e5868fdca2b26e311fe5e9be29)
+++ kernel/generic/src/proc/task.c	(revision 473d5d202238ab61558d1695b8e41f478815a862)
@@ -190,5 +190,5 @@
 	str_cpy(task->name, TASK_NAME_BUFLEN, name);
 	
-	task->context = CONTEXT;
+	task->container = CONTAINER;
 	task->capabilities = 0;
 	task->ucycles = 0;
@@ -211,5 +211,5 @@
 	
 	if ((ipc_phone_0) &&
-	    (context_check(ipc_phone_0->task->context, task->context)))
+	    (container_check(ipc_phone_0->task->container, task->container)))
 		ipc_phone_connect(&task->phones[0], ipc_phone_0);
 	
@@ -584,5 +584,5 @@
 		printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p"
 		    " %9" PRIu64 "%c %9" PRIu64 "%c\n", task->taskid,
-		    task->name, task->context, task, task->as,
+		    task->name, task->container, task, task->as,
 		    ucycles, usuffix, kcycles, ksuffix);
 #endif
@@ -595,5 +595,5 @@
 	else
 		printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n",
-		    task->taskid, task->name, task->context, task, task->as);
+		    task->taskid, task->name, task->container, task, task->as);
 #endif
 	
@@ -625,5 +625,5 @@
 		printf("[id    ] [threads] [calls] [callee\n");
 	else
-		printf("[id    ] [name        ] [ctx] [address ] [as      ]"
+		printf("[id    ] [name        ] [ctn] [address ] [as      ]"
 		    " [ucycles ] [kcycles ]\n");
 #endif
@@ -634,5 +634,5 @@
 		    " [callee\n");
 	else
-		printf("[id    ] [name        ] [ctx] [address         ]"
+		printf("[id    ] [name        ] [ctn] [address         ]"
 		    " [as              ]\n");
 #endif
Index: kernel/generic/src/proc/the.c
===================================================================
--- kernel/generic/src/proc/the.c	(revision 9c75782060ff62e5868fdca2b26e311fe5e9be29)
+++ kernel/generic/src/proc/the.c	(revision 473d5d202238ab61558d1695b8e41f478815a862)
@@ -58,4 +58,5 @@
 	the->task = NULL;
 	the->as = NULL;
+	the->magic = MAGIC;
 }
 
@@ -70,4 +71,5 @@
 NO_TRACE void the_copy(the_t *src, the_t *dst)
 {
+	ASSERT(src->magic == MAGIC);
 	*dst = *src;
 }
Index: kernel/generic/src/security/cap.c
===================================================================
--- kernel/generic/src/security/cap.c	(revision 9c75782060ff62e5868fdca2b26e311fe5e9be29)
+++ kernel/generic/src/security/cap.c	(revision 473d5d202238ab61558d1695b8e41f478815a862)
@@ -92,5 +92,5 @@
 	task_t *task = task_find_by_id(taskid);
 	
-	if ((!task) || (!context_check(CONTEXT, task->context))) {
+	if ((!task) || (!container_check(CONTAINER, task->container))) {
 		irq_spinlock_unlock(&tasks_lock, true);
 		return (sysarg_t) ENOENT;
@@ -121,5 +121,5 @@
 	
 	task_t *task = task_find_by_id(taskid);
-	if ((!task) || (!context_check(CONTEXT, task->context))) {
+	if ((!task) || (!container_check(CONTAINER, task->container))) {
 		irq_spinlock_unlock(&tasks_lock, true);
 		return (sysarg_t) ENOENT;
