NetBSD-Bugs archive

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

Re: kern/39897: sizeof(struct gpt_hdr);



The following reply was made to PR kern/39897; it has been noted by GNATS.

From: David Laight <david%l8s.co.uk@localhost>
To: Jason Thorpe <thorpej%shagadelic.org@localhost>
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/39897: sizeof(struct gpt_hdr);
Date: Wed, 12 Nov 2008 22:40:39 +0000

 On Tue, Nov 11, 2008 at 04:56:14PM -0800, Jason Thorpe wrote:
 > 
 > On Nov 11, 2008, at 3:55 PM, David Laight wrote:
 > 
 > >On Tue, Nov 11, 2008 at 07:00:01PM +0000, jakllsch%kollasch.net@localhost 
 > >wrote:
 > >>>Synopsis:       sizeof(struct gpt_hdr); is "wrong" on amd64
 > >
 > >>Perhaps add a '__packed' attribute to the GPT structures.
 > >
 > >There is a typedef for a 64bit int with 32bit alignment somewhere.
 > >That is better than applying packed to the entire structure.
 > 
 > No, there's not.
 > 
 > The problem is likely due to the fact that the struct has 3 uint32_t's  
 > at the end, rather than 2 or 4.
 
 To get the entire structure to have 4-byte alignment, the uint64_t
 fields need to be marked as having 4-byte alignment.
 This is done in some of the compat code for i386.
 
 However I suspect the gpt_hdr never exists as an array, so the
 overall size/padding should be handled differently.
 
 Otherwise you get rather long code sequences if you have to access
 the structure members on systems that can't perform misaligned transfers.
 
        David
 
 -- 
 David Laight: david%l8s.co.uk@localhost
 


Home | Main Index | Thread Index | Old Index