[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tsp-devel] Alignment error on VxWorks

From: Eric Noulard
Subject: Re: [Tsp-devel] Alignment error on VxWorks
Date: Thu, 27 Nov 2008 17:05:57 +0100

2008/11/27 Frédéric Martinsons <address@hidden>:
> OK thanks for answering so fast Stephane and Fred (nice name by the way).
> Stop me if I'm wrong : BB is a big shared malloc and when we call
> bb_publish,data is written "manually" into it and return the address of the
> first byte ?
> I've checked this issue on vxworks and it appears there is a function
> (memalign ) which forces the allocated buffer to starts on a memory adress
> evenly divisible by a parameter ( power of 2 ).I could use it instead of a
> simple malloc.
> If what I said above is what is done in BB (write manually the data in the
> "malloced" shmem), I don't think there is any chance to work, right ?
> I think I will try to modify bb_publish to handle alignment issue but
> everything I see to solve this is "to fill the blank".I mean add an offset
> in order to make the following addresses begin at the right value (e.g
> divisible by 4).Ot course, it leads to a waste of memory.There is an other 
> method ?

I'm afraid this is the only way to go.
You should handle the alignment in bb_publish.
If you do this you  should be careful that ALL process which are accessing the
shared mem do apply the _same_ alignment rule.

For example imagine your BB is a shared mem segment which mapped onto
a VME backplane which is accessed from different machines you should ensure
that the BB lib apply the same alignment constraint on each side.

If you modify the BB this way and you want your modification to go to mainstream
we should use the "BB_VERSION" mechanism in order to ensure backward

We'll talk about that when you're done with a working version for your case
if you want.

Concerning memalign usage, it should be available on other platform as well
but we'll have to check.
Note that we have the same alignment issue for the memory ringbuf used
in tsp core, the alignment issue was solved using a nice macro :=)

The macro is:
#define RINGBUF_SZ(sz)          ((sz) + 1 + (4-(((sz) + 1) % 4)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]