[ovs-git] Open vSwitch: Add header for access to potentially unaligned data. (master)

dev at openvswitch.org dev at openvswitch.org
Fri May 7 21:38:57 UTC 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  afa3a93165f1f576d03cbf9fc1a2f8ddc2a64d01 (commit)
      from  a1ae5dc8da2d30704f7654e0d593cf2ca1e088f7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit afa3a93165f1f576d03cbf9fc1a2f8ddc2a64d01
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=afa3a93165f1f576d03cbf9fc1a2f8ddc2a64d01
Author: Ben Pfaff <blp at nicira.com>
		
Add header for access to potentially unaligned data.
		
I had been under the impression that "memcpy" was a valid way to copy
unaligned data into an aligned location for access.  But testing on SPARC
has shown that GCC doesn't always honor that intention.  It seems that, if
GCC can see that there is a pointer of a type that requires alignment to
a given object, then it will access it directly regardless of whether
memcpy() is used to copy it.

This commit adds a new header with functions to access unaligned data.  I
managed to come up with two techniques, one GCC-specific, one generic, that
do avoid the misaligned access in my test case.  The GCC-specific technique
is the same one used by the Linux kernel (although no code has been
literally copied).  The other one seemed obvious but possibly slow
depending on the compiler's ability to optimize.

The following commit adds a user.


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

Summary of changes:
 lib/automake.mk |    1 +
 lib/unaligned.h |  122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 lib/unaligned.h


hooks/post-receive
-- 
Open vSwitch




More information about the git mailing list