Thread creation

Stefan Kalkowski stefan.kalkowski at ...1...
Thu Jan 28 20:48:26 CET 2010


Hi Peter,

On Thursday, 28. January 2010 13:00:01 Peter Nguyen wrote:
> Hi,
>
> In also trying to create a thread, there are some instances when i would
> like to pass some parameters to a thread to establish a starting state for
> a thread. To do this, the class i write, which inherits from Thread
> contains some instance variables which get initialised in the class's
> constructor. From there, when the thread starts execution, the function
> that executes when the thread starts uses those variables i've declared.

That's perfectly fine.

> However, when I run genode with my app, i keep getting the following
> message, which seems to result in the thread not executing at all:
>
> no RM attachment (READ pf_addr=562ae410 pf_ip=20145c6 from 08).
>

That means one of your threads raised a pagefault. "RM" stands for "region 
map" a datastructure that manages the mapping of virtual memory regions to a 
specific dataspace. If there is no region map, that corresponds to a virtual 
address, the pager is not able to back that virtual address with physical 
memory and you will get above error message.

To determine where in your code the pagefault occurs you might have a look at 
the instruction given by the instruction pointer ("pf_ip"), as well as the 
location in the source code corresponding to that instruction. You can use 
objdump to have a look at the assembler code together with the corresponding 
C++ function and object member names:

objdump -dC <your_binary>

When using objdump with the '-C' flag your binary should not be stripped!

> The code i have for this thread is the following:
>
> class collection1 : public Thread<4096>
> {
>   public:
> 	L4_ThreadId_t tid_block;
> 	void thread_fn();
> 	void entry();
>
> 	collection1(unsigned long value)
> 	{
> 		tid_block.raw = value;
> 	}
> };
>

Well, the most important parts would be the constructor and entry function 
code as well as the caller's context. Probably the pagefault occurs at one of 
these locations.

> Yet when i instantiate this class, I get the "no RM attachment" message,
> which results in this thread not executing at all. Does anyone know what is
> happening? Can parameters be passed to a thread via its constructor?
>

yes, that's the recommended way.

regards stefan

PS: most mail clients and archive software use the "In-Reply-To" mail header 
to structure related mails in "threads". If you start a topic with a 
different subject, it would be nice, if you would not reply to a former mail 
of the list ;-)

> Peter
>
> ---------------------------------------------------------------------------
>--- The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business Choose flexible plans and management services without long-term
> contracts Personal 24x7 support from experience hosting pros just a phone
> call away. http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Genode-main mailing list
> Genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main

-- 
Stefan Kalkowski
Genode Labs Developer
http://genode-labs.com




More information about the users mailing list