tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: compat_netbsd32 swapctl



On Wed, Jan 29, 2014 at 06:38:06PM +0000, Paul_Koning%Dell.com@localhost wrote:
> On Wed, Jan 29, 2014 at 06:26:14PM +0000, David Laight wrote:
> >> There is a 64bit integer type that has an alignment requirement of 8.
> >> If that is used instead of a normal 64bit type then the structure
> >> alignement under amd64 matches that of i386.
> 
> The easiest way to get such alignment is to ask for it explicitly: 
> __attribute__((aligned(8))).
> 
>       paul

That won't ensure the structure has the same aligment, there could
be pad words before 64bit fields on the 64bit architecture.

You could mark all the 64bit fields with aligned(8) so that they have
the same alignement.

But the general problem is that the 64bit system needs to match a 
pre-existing 32bit structure.
Changing the alignment doesn't then help.

It probabli is worth adding an __CTASSERT() for non-trivial structures
that are expected to be a fixed size. Then if anything 'odd' happens
the compler will bleat.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index