[ovs-dev] [PATCH v2] ovs-atomics: Add atomic support Windows.
Eitan Eliahu
eliahue at vmware.com
Thu Sep 4 16:28:30 UTC 2014
> However, you should probably keep the version in your patch if you
> know that the alignment check can be computed at compile-time and/or
> there is some documentation that MSVC will not align 64-bit units on
> at 4-byte alignment.
https://urldefense.proofpoint.com/v1/url?u=http://msdn.microsoft.com/en-us/library/ee959491.aspx&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yTvML8OxA42Jb6ViHe7fUXbvPVOYDPVq87w43doxtlY%3D%0A&m=3RH7IR4NQhKAdn6Zo14s1rtKdPcLGe7dRWUZMsx5gmU%3D%0A&s=e0070ced495d9ddd1e0bce3bdb2c52e251b5fdee9332a0efc622bdfda97daeb4 says that MSVC cannot align 64-bit types on 64-bit boundaries, at least on the stack:
Data types that are larger than 4 bytes are not automatically
aligned on the stack when you use the x86 compiler to compile an
application. Because the architecture for the x86 compiler is a 4
byte aligned stack, anything larger than 4 bytes, for example, a
64-bit integer, cannot be automatically aligned to an 8-byte
address.
[EITAN]
To insure that a variable is aligned (rather on the stack or in the data segment) we need to use __declspec(align(8)). This would require a lot of effort for us.
I would consider to add code for the debug build which checks the alignment before calling the actual locking functions.
_______________________________________________
dev mailing list
dev at openvswitch.org
https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yTvML8OxA42Jb6ViHe7fUXbvPVOYDPVq87w43doxtlY%3D%0A&m=3RH7IR4NQhKAdn6Zo14s1rtKdPcLGe7dRWUZMsx5gmU%3D%0A&s=447ae41e430b1587186000fa54a0df20e82fed45c5781cf6b91ca89139c0897b
More information about the dev
mailing list