[okl4-developer] eas creation

David Mirabito davidm at ok-labs.com
Thu Jan 10 16:44:41 EST 2008


Hi Jamie,

Your code is correct, and the thread is in fact trying to run, however 
it is immediately page faulting on the first user instruction it tries. 
This causes L4 to generate an IPC to the nominated pager (in this case, 
the thread who creates and populates the EAS).

You can verify in KDB with the 't' command to check the context of the 
new thread. You'll see he is waiting on a reply IPC from the pager thread.

The pagetable for the new EAS is empty at creation time (other than utcb 
and kip areas).

You should have the pager thread waiting for IPCs and make appropriate 
eas_map() calls on each page fault. Alternatively, you could pre-map 
everything in (text, data, stack, heap) before starting the new guy to 
ensure he won't page fault at all.

The pager thread does not have to be the same one who creates the EAS, 
where you currently pass in L4_Myself(), as it may be easier to have a 
simply function whose sole purpose in life is to  handle page faults.
I should note here that the pager thread does need to be a 'normal' 
iguana thread, as EAS threads are somewhat limited and are unable to 
make iguana calls.

Good luck!

 - David

Jamie Lennox wrote:
> Hi,
>
> Are we able to start and boot EASs from within iguana apps. I can't see
> why not however i create an eas and then try to start it with
> thread_start and everything seems to work fine however the threads are
> never started (or appear not to be). There are examples in the
> thread_tests file but none of these actually start a thread in the eas
> and the multithread example uses SConstruct to create the thread, is
> this the correct way?
>
> relevant code: 
>
>     L4_KernelInterfacePage_t *kip = L4_GetKernelInterface(); 
>     kip_area = L4_FpageLog2((uintptr_t) kip, L4_KipAreaSizeLog2(kip)); 
>     utcb_area = L4_FpageLog2(0x0, 16); 
>
>     if (L4_UtcbAreaSizeLog2(kip) != 0)
>         utcb = 0; 
>
> ---
>
> L4_ThreadId_t 
> create_task(void *ip, void *sp)
> {
>     L4_ThreadId_t ret = L4_nilthread; 
>     thread_ref_t tid_ref = 0;
>     eas_ref_t eas; 
>     if ((eas = eas_create(kip_area, utcb_area, NULL)) == 0)
>     {
>         printf("EAS Creation Failure\n"); 
>         return L4_nilthread;
>     }
>
>     printf("utcb = %p\n", utcb); 
>     if (L4_IsThreadEqual((ret = eas_create_thread(eas, L4_Myself(),
> L4_Myself(), utcb)), L4_nilthread))
>     {
>         printf("EAS Thread Creation Failure\n"); 
>         return L4_nilthread; 
>     }
>
>     if ((tid_ref = thread_id(ret)) == 0)
>     {
>         printf("Thread lookup Failure\n"); 
>         return L4_nilthread; 
>     }
>
>     thread_start(tid_ref, (uintptr_t) ip, (uintptr_t) sp);
>     return ret; 
> }
>
> ---
>
> The tasks do a printf as soon as they're started. The threads seem to be
> created and no errors are produced. using kdb and q i get: 
>
> [255]: (roottask) (IRQ 00)
> [240]: (vtimer)
> [239]: (kdb_poll)
> [200]: (ig_namin) (event)
> [100]: (vserial) (deviceco) p_host p_server p_client
> idle : idle
>
> p_server & p_client were create with the above, however i then try to
> IPC to the threads and get nothing.
>
> Any idea whats going on?
>
> Jamie
>
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
>   




More information about the Developer mailing list