Re: [git pull] kgdb light, v5
- From: "Ray Lee" <ray-lk@xxxxxxxxxxxxx>
- Date: Sun, 10 Feb 2008 09:30:01 -0800
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.)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [git pull] kgdb light, v5
- From: Jan Kiszka
- Re: [git pull] kgdb light, v5
- From: Jan Kiszka
- Re: [git pull] kgdb light, v5
- References:
- [0/6] kgdb light
- From: Ingo Molnar
- Re: [0/6] kgdb light
- From: Sam Ravnborg
- [git pull] kgdb light, v5
- From: Ingo Molnar
- [0/6] kgdb light
- Prev by Date: Re: Kernel Panic in MPT SAS on 2.6.24 (and 2.6.23.14, 2.6.23.9)
- Next by Date: [PATCH] rtc: add support for the S-35390A RTC chip
- Previous by thread: [git pull] kgdb light, v5
- Next by thread: Re: [git pull] kgdb light, v5
- Index(es):