On Saturday 10 February 2007 15:20, Stefan Richter wrote:
>
> I wrote on 2007-02-03:
> > +#define RAW1394_IOC_GET_CYCLE_TIMER \
> > + _IOR ('#', 0x30, struct raw1394_cycle_timer)
> ...
> > +/* argument to RAW1394_IOC_GET_CYCLE_TIMER ioctl */
> > +struct raw1394_cycle_timer {
> > + /* contents of Isochronous Cycle Timer register,
> > + as in OHCI 1.1 clause 5.13 (also with non-OHCI hosts) */
> > + __u32 cycle_timer;
> > +
> > + /* local time in microseconds since Epoch,
> > + simultaneously read with cycle timer */
> > + __u64 local_time;
> > +};
> > #endif /* IEEE1394_RAW1394_H */
>
> Hmm, is this struct padded on 64bit platforms?
> If so, would
> struct raw1394_cycle_timer {
> __u64 local_time;
> __u32 cycle_timer;
> };
> be padded too?
If one of these two is padded on a given CPU, the other one is as well,
because the structure alignment is defined as the maximum alignment
of one of its members (this is needed so that arrays work).
Both are padded on all 64 bit architectures that Linux runs on, but
on x86, you get the extra twist that the 32 bit version does not
have padding. To express the right structure for compat mode, you
need something like
#ifdef __x86_64__
typedef u64 compat_u64 __attribute__((packed, aligned(4)));
#else
typedef u64 compat_u64;
#endif
struct raw1394_cycle_timer {
compat_u64 local_time;
u32 cycle_timer;
};
Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]