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:

> Yes be16enc() should work just fine, I think.

Then why don't you guys also complain to fix existing abcksum() function
which is called at the suggested memcpy?

---
	/* 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));
 :

static u_int
abcksum (void *bs)
{
	u_int16_t sum  = 0,
		  *st  = (u_int16_t *)bs,
		  *end = (u_int16_t *)bs + 256;

	while (st < end)
		sum += *st++;
	return(sum);
}
---

I think the "correct" fix is to redefine a boot block structures as
a union of existing struct bootblock and uint16_t array in <sys/bootblock.h>,
but it would be done when we will merge it into MI installboot.

Fixing only a visible part you are shown in a patch to appease compiler
makes no sense even for correctness.

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index