christos@ wrote: > On Nov 14, 2:43am, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote: > -- Subject: Re: CVS commit: src/sys/arch/atari/stand/installboot > > | christos@ wrote: > | > | > Module Name: src > | > Committed By: christos > | > Date: Thu Nov 13 17:19:29 UTC 2014 > | > > | > Modified Files: > | > src/sys/arch/atari/stand/installboot: installboot.c > | > > | > Log Message: > | > fix strict aliasing violations > | > | > - *((u_int16_t *)bb->bb_xxboot + 255) = 0; > | > - *((u_int16_t *)bb->bb_xxboot + 255) = 0x1234 - abcksum(bb->bb_xxboot); > | > + sum = 0; > | > + memcpy(bb->bb_xxboot + 255, &sum, sizeof(sum)); > | > + sum = 0x1234 - abcksum(bb->bb_xxboot); > | > + memcpy(bb->bb_xxboot + 255, &sum, sizeof(sum)); > | > | I doubt your "bb->bb_xxboot + 255" is the same place > | as the original "(u_int16_t *)bb->bb_xxboot + 255" > | (the cksum word looks at the end of 512 byte sector). > | > | memcpy(9) looks also awful for readers because it hides endianness.. > > Let me fix it,
"Test it (or call for testers) before commit" because installboot could be fatal on install floppy and bootstrap. > but memcpy is the only way. - cast via (void *) - union {uint16_t w[256]; struct bootblock bbp;} - be16enc(9) etc? --- Izumi Tsutsui