Failed to create a new task

ahmad kamal amadkamal at yahoo.com
Fri Mar 21 10:06:49 CET 2008



Here's a diff of your program against a version that works, with
comments:


--- x.c    2008-03-16 22:30:26.000000000 +0100
+++ x.c    2008-03-16 22:30:26.000000000 +0100
@@ -3,6 +3,7 @@
 #include <l4/sys/ipc.h>
 #include <l4/rmgr/librmgr.h>
 #include <l4/sigma0/sigma0.h>  
+#include <l4/util/util.h>
 
 #include <stdio.h>
 
@@ -41,14 +42,13 @@
     l4_addr_t map_area = 0x60000000;
     l4_addr_t base;
     l4_umword_t rcv_fpage;
-    l4_umword_t snd_fpage;
 
     res = l4_ipc_call(SIGMA0_ID,                    // thread id
                             L4_IPC_SHORT_MSG,         // send descriptor
                             SIGMA0_REQ_FPAGE_ANY,    // snd_dword0
-                            snd_fpage,                    // snd_dword1
+                            l4_fpage(0, L4_LOG2_PAGESIZE, 0, 0).fpage,                    // snd_dword1
                             L4_IPC_MAPMSG(map_area, L4_WHOLE_ADDRESS_SPACE),// rcv_desc
-                            base,                            // *rcv_dword0
+                            &base,                            // *rcv_dword0
                             &rcv_fpage,                    // *rcv_dword1
                             timeout,
                             &result);

Please fix compiler warnings, gcc is not issueing them just for fun.
You've been giving an uninitialized value as an address to l4_ipc_call,
so no wonder strange things happen.


@@ -75,26 +75,17 @@
         enter_kdebug("FAILED in l4_ipc_wait: %d\n");
     }    
 
+    while(1) {
     l4_umword_t fault_addr = rcv_dword0 &~ 0x00000003; //rcv_dword0 & 0xFFFFFFFC
                                                                         // mask lower bits for (write/grant) flags?
     l4_umword_t rw_addr    = fault_addr | 0x00000002;        // mask the 2 nd lower bits to set write flags
 
-    while(1) {
-
-        l4_snd_fpage_t fpage;
-        
-        fpage.snd_base = rw_addr; // do wee need to left shift the address???
-        
-        //we can also use the function l4_fpage(address, size, write, grant)
-        fpage.fpage.fp.grant = 0;
-        fpage.fpage.fp.write = 1;
-        fpage.fpage.fp.page = rw_addr;
-        fpage.fpage.fp.size =  L4_LOG2_PAGESIZE; //12
+        l4_touch_rw((void *)rw_addr, 1);

Just to make sure the memory is really available.
 
         res = l4_ipc_reply_and_wait(src_id,                    //dest_id
                                             L4_IPC_SHORT_FPAGE,    //send descriptor
-                                            fpage.snd_base,        //snd_dword0
-                                            fpage.fpage.fpage,    //snd_dword1 - might change later to .fp
+                                            rw_addr & L4_PAGEMASK,        //snd_dword0
+                                            l4_fpage(rw_addr & L4_PAGEMASK, L4_LOG2_PAGESIZE, L4_FPAGE_RW, L4_FPAGE_MAP).fpage,
                                             &src_id,                    //src_id
                                             L4_IPC_SHORT_MSG,        //rcv descriptor
                                             &rcv_dword0,            //rcv_dword0

I just aggregated the l4_fpage to the one line, more compact.

one more things, after task creation succeed, i'm a bit curious, why it doesn't run the new task, it runs the first thread n pager only.







      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20080321/6a655e89/attachment.htm>


More information about the l4-hackers mailing list