Fix: uart_hex wrong offset

This commit is contained in:
2025-04-15 17:44:28 +08:00
parent c4a44542ef
commit 3c03c9d383
2 changed files with 7 additions and 8 deletions

View File

@@ -101,11 +101,11 @@ logger_cur = _Generic((msg), \
// #define DEBUG_DTB(val) DEBUG(val)
#define DEBUG_DTB(val) CLEAN
#define DEBUG_EXCEP(val) DEBUG(val)
// #define DEBUG_EXCEP(val) CLEAN
// #define DEBUG_EXCEP(val) DEBUG(val)
#define DEBUG_EXCEP(val) CLEAN
// #define DEBUG_MEM(val) DEBUG(val)
#define DEBUG_MEM(val) CLEAN
#define DEBUG_MEM(val) DEBUG(val)
// #define DEBUG_MEM(val) CLEAN
// #define DEBUG_INITRD(val) DEBUG(val)
#define DEBUG_INITRD(val) CLEAN

View File

@@ -209,11 +209,10 @@ void uart_puts(const char *s)
void uart_hex(uint64_t d)
{
char buf[0x11], *p = buf;
uint64_t n;
for (int c = 28; c >= 0; c -= 4) {
for (int c = 28, n; c >= 0; c -= 4) {
n = (d >> c) & 0xf;
n += n > 9 ? (char)'A' : (char)'0';
*p++ = n;
n += (n > 9) ? 0x37 : 0x30;
*p++ = (char)n;
}
*p = '\0';
uart_puts(buf);