From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2hya-0001CJ-68 for qemu-devel@nongnu.org; Wed, 29 Feb 2012 06:45:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2hy6-0002Ia-Dv for qemu-devel@nongnu.org; Wed, 29 Feb 2012 06:45:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2hy6-0002I5-5C for qemu-devel@nongnu.org; Wed, 29 Feb 2012 06:45:14 -0500 From: Gerd Hoffmann Date: Wed, 29 Feb 2012 12:45:05 +0100 Message-Id: <1330515910-725-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1330515910-725-1-git-send-email-kraxel@redhat.com> References: <1330515910-725-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH v2 1/6] output: add 64bit hex print support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: seabios@seabios.org Cc: qemu-devel@nongnu.org, Gerd Hoffmann --- src/output.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/output.c b/src/output.c index bdde7cc..32cbcaa 100644 --- a/src/output.c +++ b/src/output.c @@ -249,6 +249,7 @@ bvprintf(struct putcinfo *action, const char *fmt, va_list args) const char *n = s+1; int field_width = 0; int spacepad = 1; + int is64 = 0; for (;;) { c = GET_GLOBAL(*(u8*)n); if (!isdigit(c)) @@ -264,6 +265,11 @@ bvprintf(struct putcinfo *action, const char *fmt, va_list args) n++; c = GET_GLOBAL(*(u8*)n); } + if (c == 'l') { + is64 = 1; + n++; + c = GET_GLOBAL(*(u8*)n); + } s32 val; const char *sarg; switch (c) { @@ -289,8 +295,21 @@ bvprintf(struct putcinfo *action, const char *fmt, va_list args) field_width = 8; spacepad = 0; case 'x': - val = va_arg(args, s32); - puthex(action, val, field_width, spacepad); + if (is64) { + val = va_arg(args, s32); + u32 upper = va_arg(args, s32); + if (upper) { + if (field_width < 8) + field_width = 8; + puthex(action, upper, field_width - 8, spacepad); + puthex(action, val, 8, 0); + } else { + puthex(action, val, field_width, spacepad); + } + } else { + val = va_arg(args, s32); + puthex(action, val, field_width, spacepad); + } break; case 'c': val = va_arg(args, int); -- 1.7.1