1.1 --- a/libexec/lib/src/process_creating.cc Tue Feb 28 22:40:02 2023 +0100
1.2 +++ b/libexec/lib/src/process_creating.cc Fri Mar 03 18:15:38 2023 +0100
1.3 @@ -97,7 +97,12 @@
1.4
1.5 /* Start the pager in a separate thread. */
1.6
1.7 - return ResourceServer(_exec_pager).start_thread(pager);
1.8 + long err = ResourceServer(_exec_pager).start_thread(pager);
1.9 +
1.10 + if (err)
1.11 + return err;
1.12 +
1.13 + return L4_EOK;
1.14 }
1.15
1.16 /* Configure the environment for the task. */
1.17 @@ -224,7 +229,14 @@
1.18
1.19 /* Start the region mapper thread in the appropriate stack. */
1.20
1.21 - return _process.thread_start(_rm_payload->entry_point(), rm_st);
1.22 + l4_cap_idx_t thread;
1.23 + err = _process.thread_start(_rm_payload->entry_point(), rm_st, &thread);
1.24 +
1.25 + if (err)
1.26 + return err;
1.27 +
1.28 + ipc_cap_free_um(thread);
1.29 + return L4_EOK;
1.30 }
1.31
1.32 /* Configure a thread for a program, populate its stack, and start the
1.33 @@ -254,7 +266,14 @@
1.34
1.35 /* Start the program thread in the appropriate stack. */
1.36
1.37 - return _process.thread_start(_program_payload->entry_point(), program_st);
1.38 + l4_cap_idx_t thread;
1.39 + err = _process.thread_start(_program_payload->entry_point(), program_st, &thread);
1.40 +
1.41 + if (err)
1.42 + return err;
1.43 +
1.44 + ipc_cap_free_um(thread);
1.45 + return L4_EOK;
1.46 }
1.47
1.48 /* Start a new process for the given payload, providing the indicated program
1.49 @@ -293,6 +312,12 @@
1.50 if (err)
1.51 return err;
1.52
1.53 + /* Note the task and IPC gate on the pager object. */
1.54 +
1.55 + _exec_pager->set_server(*process);
1.56 + _exec_pager->set_task(_process.get_task());
1.57 + _exec_pager->set_gate(_ipc_gate);
1.58 +
1.59 /* Discard instances created to initialise the process.
1.60 NOTE: The region mapper payload could be retained instead of being
1.61 reconstructed each time. */