Hi Gilles,

Gilles Chanteperdrix wrote:
[EMAIL PROTECTED] wrote:
 > Dear Gilles,
> > I admit, the mechanism for allocating all memory of the target is not very sophisticated. The idea was, that MAXHEAPBLOCKS*MEMORYCHUNKSIZE is much much more, than memory available (at least with my target (128MB) this is true). I should have mentioned this in the source code, sorry. If your target has more then (MAXHEAPBLOCKS*MEMORYCHUNKSIZE=320MB(approcimate)) memory, you should increase MAXHEAPBLOCKS. > > If this condition is fulfiled, I think, there should be no illegal memory access. Do you agree ? >
A better patch.



------------------------------------------------------------------------

--- heap.c~     2006-09-06 14:27:31.000000000 +0200
+++ heap.c      2006-09-06 14:37:07.000000000 +0200
@@ -101,7 +101,15 @@ void display(void *cookie)
    {
       memsize+=addsize;
       if(!(ret=rt_heap_create(&bigheap[i],nbuf,memsize,H_PRIO|H_MAPPABLE)))
+      {
+        if (i > MAXHEAPBLOCKS - 1)
+        {
+           printf("i= %d is out of bounds, stopping here, avoid later SEGV.\n",
+                  i);
+           exit(EXIT_FAILURE);
+        }
          rt_heap_delete(&bigheap[i]);
+      }
    }while(ret==0);
memsize>>=1;


------------------------------------------------------------------------

I was able to reproduce the problem on my MPC5200 system some time ago
and I have checked the index "i" as well. "i" was not out-of-range, IIRC. The problem only shows up on PowerPC., at least Jan was unable
to reproduce it on a x86 system. How could we debug the seg fault. Do
you have a good idea? Would the IPIPE tracer help?

Wolfgang.


_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to