sel4utils: put tcb cap in new process cspace
diff --git a/libsel4utils/include/sel4utils/process.h b/libsel4utils/include/sel4utils/process.h
index 72f2734..1186dbf 100644
--- a/libsel4utils/include/sel4utils/process.h
+++ b/libsel4utils/include/sel4utils/process.h
@@ -73,8 +73,11 @@
      * in. 0 if this kernel does not support asid pools */
     SEL4UTILS_ASID_POOL_SLOT = 4,
 
+    /* the slot for this processes tcb */
+    SEL4UTILS_TCB_SLOT = 5,
+
     /* First free slot in the cspace configured by sel4utils */
-    SEL4UTILS_FIRST_FREE = 5
+    SEL4UTILS_FIRST_FREE = 6
 };
 
 typedef struct {
diff --git a/libsel4utils/src/process.c b/libsel4utils/src/process.c
index 90aaf70..173821a 100644
--- a/libsel4utils/src/process.c
+++ b/libsel4utils/src/process.c
@@ -572,6 +572,14 @@
     error = sel4utils_configure_thread(vka, spawner_vspace, &process->vspace, SEL4UTILS_ENDPOINT_SLOT,
                                        config.priority, process->cspace.cptr, cspace_root_data, &process->thread);
 
+    /* copy tcb cap to cspace */
+    if (config.create_cspace) {
+        cspacepath_t src;
+        vka_cspace_make_path(vka, process->thread.tcb.cptr, &src);
+        UNUSED seL4_CPtr slot = sel4utils_copy_cap_to_process(process, src);
+        assert(slot == SEL4UTILS_TCB_SLOT);
+    }
+
     if (error) {
         ZF_LOGE("ERROR: failed to configure thread for new process %d\n", error);
         goto error;