[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 22:59:15 +0100

2008/11/27 Frederik Deweerdt <address@hidden>:
> On Thu, Nov 27, 2008 at 05:05:57PM +0100, Eric Noulard wrote:
>> 2008/11/27 Frédéric Martinsons <address@hidden>:
>> > OK thanks for answering so fast Stephane and Fred (nice name by the way).
>                                                       ^^^^^^^^^
> I tend to think the same, indeed :-)
>> >
>> > 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 ?
> Yep, exactly
> [...]
>> 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 :=)
>> see
>> http://cvs.savannah.gnu.org/viewvc/tsp/src/core/misc_utils/tsp_ringbuf.h?root=tsp&view=markup
>> The macro is:
>> #define RINGBUF_SZ(sz)                ((sz) + 1 + (4-(((sz) + 1) % 4)))
> I'm not sure I'm following, what do memalign is buying us there? I think
> using this kind of macro in bb_publish if a given flag is present should
> be enough.

I think you are right, moreover I think memalign is not doing what used to need
in BB. memalign is **allocating** memory just like malloc does.
I would be usable on the first call (bb_create) but not for bb_publish which
is doing is own "pseudo allocation" in a pre-allocation memory area.

Moreover, malloc is usable in BB for RTEMS because there is no separate
address space between processes just like in VxWorks.
Other systems uses "true" shared memory IPC (either sysV or mmap
(linux kernel bb)).

Thus you really need:
   1) a properly alligned memory in bb_create
   2) a rounding to nearest 1,2,4,8 byte boundary macro for bb_publish.


reply via email to

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