#33 alignment errors when running on armv5te

v1.0_(example)
wont-fix
None
5
2013-07-25
2012-06-12
Anonymous
No

Without this patch I get alignment errors when running on armv5te (after instpecting dmesg)

diff -urN a/dep/msg.c b/dep/msg.c
--- a/dep/msg.c 2012-06-12 09:38:11.759466809 +0200
+++ b/dep/msg.c 2012-06-12 09:38:29.520102246 +0200
@@ -166,7 +166,8 @@
flip16(ptpClock->clockQuality.offsetScaledLogVariance);
*(UInteger8 *) (buf + 52) = ptpClock->grandmasterPriority2;
memcpy((buf + 53), ptpClock->grandmasterIdentity, CLOCK_IDENTITY_LENGTH);
- *(UInteger16 *) (buf + 61) = flip16(ptpClock->stepsRemoved);
+// *(UInteger16 *) (buf + 61) = flip16(ptpClock->stepsRemoved);
+ { UInteger16 j; j = flip16(ptpClock->stepsRemoved); memcpy(buf + 61, &j, sizeof(UInteger16)); }
*(Enumeration8 *) (buf + 63) = ptpClock->timeSource;
}

@@ -191,7 +192,8 @@
announce->grandmasterPriority2 = *(UInteger8 *) (buf + 52);
memcpy(announce->grandmasterIdentity, (buf + 53),
CLOCK_IDENTITY_LENGTH);
- announce->stepsRemoved = flip16(*(UInteger16 *) (buf + 61));
+// announce->stepsRemoved = flip16(*(UInteger16 *) (buf + 61));
+ { UInteger16 j; memcpy(&j, buf + 61, sizeof(UInteger16)); announce->stepsRemoved = flip16(j); }
announce->timeSource = *(Enumeration8 *) (buf + 63);

#ifdef PTPD_DBG

Discussion

  • George Neville-Neil

    • status: open --> wont-fix
    • assigned_to: George Neville-Neil
    • Group: --> v1.0_(example)
     
  • George Neville-Neil

    Duplicates a more general bug to deal with alignment issues on architectures that do not handle unaligned memory accesses.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks