Discussion:
Bare bones child process creation.
Daniel Waddington
2016-03-30 17:16:23 UTC
Permalink
Hi,
I'm trying to do bare bones process creation without using the Child or
Process helper classes (I'm toying around with serialization ideas). I
tried to construct something similar to
http://genode.org/documentation/architecture/process
but I can't seem to get it to work (error = exception base not specified on
nova32).

Does anyone have a small code sample in the vain of
http://genode.org/documentation/architecture/process ?

Daniel
Alexander Boettcher
2016-03-30 18:26:05 UTC
Permalink
Hello,
Post by Daniel Waddington
I'm trying to do bare bones process creation without using the Child or
Process helper classes (I'm toying around with serialization ideas). I
tried to construct something similar to
http://genode.org/documentation/architecture/process
but I can't seem to get it to work (error = exception base not specified on
nova32).
Some base-* platforms implement the startup of threads slightly
differently than described, e.g. base-foc [0] and base-nova [1]. If you
really want to have portable code, you should stay with the thread
implementation of the base library as we provide per base-* platform.

Nevertheless - I presume, that you already try to bring up a second
thread (in this case the message can be printed) and that you are
missing a call to cpu_session->state() (see Thread_base::start in [1]).

The state() call tells core some nova specific information (start/base
of exception portal selector for the new thread) in order to
successfully start a new thread. The base exception portal selector
(sel_exc_base) must not be zero (because the main thread already
occupies [0-31]).

Hope it helps,

Alex.

[0] repos/base-nova/src/base/thread/thread_nova.cc
[1] repos/base-foc/src/base/thread/thread_start.cc
Norman Feske
2016-03-31 06:14:29 UTC
Permalink
Hi Daniel,
Post by Daniel Waddington
Does anyone have a small code sample in the vain of
http://genode.org/documentation/architecture/process ?
admittedly, the text on the website is not the most current description.
Please better take Section 3.5. "Component creation" of the book as
reference. It is more elaborate and more precise.

Have you already had a look at the 'Process' constructor? It contains
the steps described in the document in an almost verbatim way:


https://github.com/genodelabs/genode/blob/master/repos/base/src/base/process/process.cc

Note that this code is used on all kernels except for Linux. The
component creation on Linux is special because we have to bootstrap new
components via execve and use the kernel's built-in virtual-memory
management instead of the RM service of core. You can find the
implementation of the 'Process' class for Linux here:


https://github.com/genodelabs/genode/blob/master/repos/base-linux/src/base/process/process.cc

As a heads up warning, we may eventually merge the 'Process' class into
the 'Child' class in the near future. Unless you have a pressing need to
do the low-level creation steps manually (e.g., if you want to load
non-ELF binaries), I recommend you to stay with the 'Child' class.

When it comes to the creation of additional threads within the new
component, please follow Alex' advise as this procedure largely depends
on the underlying kernel.

Cheers
Norman
--
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Daniel Waddington
2016-03-31 15:56:04 UTC
Permalink
Thanks Norman. I have some more to chew on now. ;)
Post by Norman Feske
Hi Daniel,
Post by Daniel Waddington
Does anyone have a small code sample in the vain of
http://genode.org/documentation/architecture/process ?
admittedly, the text on the website is not the most current description.
Please better take Section 3.5. "Component creation" of the book as
reference. It is more elaborate and more precise.
Have you already had a look at the 'Process' constructor? It contains
https://github.com/genodelabs/genode/blob/master/repos/base/src/base/process/process.cc
Note that this code is used on all kernels except for Linux. The
component creation on Linux is special because we have to bootstrap new
components via execve and use the kernel's built-in virtual-memory
management instead of the RM service of core. You can find the
https://github.com/genodelabs/genode/blob/master/repos/base-linux/src/base/process/process.cc
As a heads up warning, we may eventually merge the 'Process' class into
the 'Child' class in the near future. Unless you have a pressing need to
do the low-level creation steps manually (e.g., if you want to load
non-ELF binaries), I recommend you to stay with the 'Child' class.
When it comes to the creation of additional threads within the new
component, please follow Alex' advise as this procedure largely depends
on the underlying kernel.
Cheers
Norman
--
Dr.-Ing. Norman Feske
Genode Labs
http://www.genode-labs.com · http://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
GeschÀftsfÌhrer: Dr.-Ing. Norman Feske, Christian Helmuth
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
Loading...