Module: xenomai-2.6
Branch: master
Commit: 8f7d683899055ecae2adc4c0ed19a3f86e404677
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=8f7d683899055ecae2adc4c0ed19a3f86e404677

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Mon Feb 10 19:42:50 2014 +0100

skins/psos+: align message queues buffers

to avoid alignment error on ARM

---

 ksrc/skins/psos+/queue.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ksrc/skins/psos+/queue.c b/ksrc/skins/psos+/queue.c
index b3324b6..2dec0a6 100644
--- a/ksrc/skins/psos+/queue.c
+++ b/ksrc/skins/psos+/queue.c
@@ -161,11 +161,10 @@ static u_long feed_pool(xnqueue_t *chunkq,
        if (mbufcount < PSOS_QUEUE_MIN_ALLOC)
                mbufcount = PSOS_QUEUE_MIN_ALLOC;       /* Minimum allocation */
 
-       datalen = ((datalen + 3) & ~0x3);
-       bufsize = sizeof(*mbuf) + datalen - sizeof(mbuf->data);
-
-       if (bufsize < sizeof(*mbuf))
-               bufsize = sizeof(*mbuf);
+       if (datalen < sizeof(mbuf->data))
+               datalen = sizeof(mbuf->data);
+       datalen = (datalen - sizeof(mbuf->data) + 3) & ~0x3;
+       bufsize = sizeof(*mbuf) + datalen;
 
        /* A chunk starts with a holder */
        bstart = (char *)xnmalloc(sizeof(xnholder_t) + bufsize * mbufcount);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to