[lkml]   [2000]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] isa_{read,write}{w,l} fixed
> > I'm pretty sure it's a reasonably safe assumption gcc doesn't reorder members
> > of structs as long as they are naturally aligned - otherwise I assume structs
> > used for DMA would need to be fixed, too ?
> gcc doesn't reorder structure members, the relevant standards require them
> to be laid out in the order given. But it may add any padding it wants. And
> that depends on the CPU/architecture, and might even depend on optimization
> level and CPU family.

It might, in theory, add padding. In practice a lot of code assumes that if
if you do all padding yourself so structure members are naturally aligned[*]
gcc will leave them in the order they are in and not add padding.

There is no reason to require readb() to compute offsets by hand while letting
TCP, DMA code aso use structs ( (u32 *)ip_header)[IP_SADDR] = source_address; -
yuck), and what I'm saying there is no reason to "fix" drivers that use structs
for readb() offsets.

Philipp Rumpf

[*] - i.e. a 2^n byte object is aligned to a 2^n byte boundary

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:56    [W:0.134 / U:1.432 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site