1 /*
2 * \brief Process-creation interface
3 * \author Norman Feske
4 * \date 2006-06-22
5 */
6
7 /*
8 * Copyright (C) 2006-2013 Genode Labs GmbH
9 *
10 * This file is part of the Genode OS framework, which is distributed
11 * under the terms of the GNU General Public License version 2.
12 */
13
14 #ifndef _INCLUDE__BASE__PROCESS_H_
15 #define _INCLUDE__BASE__PROCESS_H_
16
17 #include <ram_session/capability.h>
18 #include <rm_session/client.h>
19 #include <pd_session/client.h>
20 #include <cpu_session/client.h>
21 #include <parent/capability.h>
22
23 namespace Genode { class Process; }
24
25
26 class Genode::Process
27 {
28 private:
29
30 Pd_session_client _pd_session_client;
31 Thread_capability _thread0_cap;
32 Cpu_session_client _cpu_session_client;
33 Rm_session_client _rm_session_client;
34
35 static Dataspace_capability _dynamic_linker_cap;
36
37 public:
38
39 /**
40 * Constructor
41 *
42 * \param elf_data_ds dataspace that contains the elf binary
43 * \param pd_session the new protection domain
44 * \param ram_session RAM session providing the BSS for the
45 * new protection domain
46 * \param cpu_session CPU session for the new protection domain
47 * \param rm_session RM session for the new protection domain
48 * \param parent parent of the new protection domain
49 * \param name name of protection domain (can be used
50 * for debugging)
51 *
52 * The dataspace `elf_data_ds` can be read-only.
53 *
54 * On construction of a protection domain, execution of the initial
55 * thread is started immediately.
56 */
57 Process(Dataspace_capability elf_data_ds,
58 Pd_session_capability pd_session,
59 Ram_session_capability ram_session,
60 Cpu_session_capability cpu_session,
61 Rm_session_capability rm_session,
62 Parent_capability parent,
63 char const *name);
64
65 /**
66 * Destructor
67 *
68 * When called, the protection domain gets killed.
69 */
70 ~Process();
71
72 static void dynamic_linker(Dataspace_capability dynamic_linker_cap)
73 {
74 _dynamic_linker_cap = dynamic_linker_cap;
75 }
76
77 Thread_capability main_thread_cap() const { return _thread0_cap; }
78 };
79
80 #endif /* _INCLUDE__BASE__PROCESS_H_ */