Re: [git pull] kgdb light, v5
From: Jan Kiszka
Date: Sun Feb 10 2008 - 12:40:04 EST
Ray Lee wrote:
> On Feb 10, 2008 8:36 AM, Ingo Molnar <mingo@xxxxxxx> wrote:
>> +#ifdef CONFIG_64BIT
>> + } else if ((count == 8) && (((long)mem & 7) == 0)) {
>> + u64 tmp_ll;
>> + if (probe_kernel_address(mem, tmp_ll))
>> + return ERR_PTR(-EINVAL);
>> +
>> + mem += 8;
>> +#ifdef __BIG_ENDIAN
>> + *buf++ = hexchars[(tmp_ll >> 60) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 56) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 52) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 48) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 44) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 40) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 36) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 32) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 28) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 24) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 20) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 16) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 12) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 8) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 4) & 0xf];
>> + *buf++ = hexchars[tmp_ll & 0xf];
>> +#else
>> + *buf++ = hexchars[(tmp_ll >> 4) & 0xf];
>> + *buf++ = hexchars[tmp_ll & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 12) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 8) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 20) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 16) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 28) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 24) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 36) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 32) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 44) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 40) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 52) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 48) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 60) & 0xf];
>> + *buf++ = hexchars[(tmp_ll >> 56) & 0xf];
>> +#endif
>
> Am I missing something? (I'm due, so it's not really a rhetorical
> question :-) .) Wouldn't
>
> unsigned int void u64_to_hex(u64 val, unsigned char *buf)
> {
> int i;
> for (i=15; i>=0; i--) {
> buf[i] = hexchars[ val & 0x0f ];
> val >>= 4;
> }
> return 16;
> }
> ...
> buf += u64_to_hex(cpu_to_be64(tmp_ll), buf);
>
> be clearer both visually, and code-as-intent? (And equivalent helpers
> for u32, u16 -- though they could all be rolled into one.)
Yes, will come, I just produced some ETOOMANYCHANGESATONCE issue while
improving this. The code goes down by more than 150 lines!
Jan
Attachment:
signature.asc
Description: OpenPGP digital signature