In message: <499C8396.2020000_at_incunabulum.net> Bruce Simpson <bms_at_incunabulum.net> writes: : M. Warner Losh wrote: : > ... : > : The point being that programmers *do* code with certain : > : assumptions and as soon as those assumptions don't hold on : > : a platform, you end up worse off. My thoughts for MIPS n32 : > : are to make it behave like any "normal" 32-bit strong- : > : alignment platform to avoid 1) a large number of runtime : > : alignment faults -- which are a bigger performance bottleneck : > : than forcing 64-bit integrals to be accessed with 2 32-bit : > : accesses : > : : FWIW, Linux use a type-length-value protocol for the netlink routing : socket, so alignment issues of this kind are shifted around (forgive the : pun). FreeBSD does too for the most part, but it is only at the inter-message level, not intra-message. : > It also turns out that in this case, a simple (void *) is safe and : > causes no issues because that time_t isn't accessed... It does give : > one time to pause and think about it. : > : : Yes, the void * cast works around the issue for now, but doesn't offer : any guarantees that we are doing the right thing on strict alignment : architectures. : If the alignment *is* invalid, then we take the hit. Right. The compiler doesn't check it, but I just did and things are fine given the fields accessed. But its that last bit that's the problem... I also have changed the offending line in my tree to be u_long instead of time_t since that is a better match to the protocol, and also gives us 168 years of uptime before there's an issue. WarnerReceived on Wed Feb 18 2009 - 21:45:59 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:42 UTC