Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys/arch/atari/stand/installboot
christos@ wrote:
> On Nov 14, 3:00am, tsutsui%ceres.dti.ne.jp@localhost (Izumi Tsutsui) wrote:
> | "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 *)
>
> That does not work.
>
> | - union {uint16_t w[256]; struct bootblock bbp;}
>
> That works...
How about this one? (cksum seems updated properly on the real machine)
--- installboot/installboot.c 2014-11-14 13:21:10.000000000 +0900
+++ installboot/installboot.c 2014-11-14 23:03:28.000000000 +0900
@@ -467,7 +467,10 @@
struct disklabel *label, u_int magic)
{
int fd;
- uint16_t sum;
+ union {
+ struct bootblock *bbp;
+ uint16_t *word; /* to fill cksum word */
+ } bbsec;
memset(bb, 0, sizeof(*bb));
@@ -499,10 +502,9 @@
setIDEpar(bb->bb_xxboot, sizeof(bb->bb_xxboot));
/* set AHDI checksum */
- sum = 0;
- memcpy(bb->bb_xxboot + 255 * sizeof(sum), &sum, sizeof(sum));
- sum = 0x1234 - abcksum(bb->bb_xxboot);
- memcpy(bb->bb_xxboot + 255 * sizeof(sum), &sum, sizeof(sum));
+ bbsec.bbp = bb;
+ bbsec.word[255] = 0;
+ bbsec.word[255] = 0x1234 - abcksum(bb->bb_xxboot);
if (verbose) {
printf("Primary boot loader: %s\n", xxb);
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index