Messages in this thread | | | Date | Sat, 12 Feb 2000 16:38:44 +0100 | From | Philipp Rumpf <> | Subject | Re: [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 majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |