qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: seabios@seabios.org
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH v2 1/6] output: add 64bit hex print support
Date: Wed, 29 Feb 2012 12:45:05 +0100	[thread overview]
Message-ID: <1330515910-725-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1330515910-725-1-git-send-email-kraxel@redhat.com>

---
 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

  reply	other threads:[~2012-02-29 11:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 11:45 [Qemu-devel] [PATCH v2 0/6] pci: 64bit support Gerd Hoffmann
2012-02-29 11:45 ` Gerd Hoffmann [this message]
2012-03-05 15:23   ` [Qemu-devel] [SeaBIOS] [PATCH v2 1/6] output: add 64bit hex print support Kevin O'Connor
2012-03-06  7:03     ` Gerd Hoffmann
2012-02-29 11:45 ` [Qemu-devel] [PATCH v2 2/6] pci: split device discovery into multiple steps Gerd Hoffmann
2012-02-29 11:45 ` [Qemu-devel] [PATCH v2 3/6] pci: 64bit support Gerd Hoffmann
2012-02-29 11:45 ` [Qemu-devel] [PATCH v2 4/6] pci: bridges can have two regions too Gerd Hoffmann
2012-02-29 11:45 ` [Qemu-devel] [PATCH v2 5/6] pci: fix bridge ressource allocation Gerd Hoffmann
2012-02-29 11:45 ` [Qemu-devel] [PATCH v2 6/6] pci: add prefmem64 Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330515910-725-2-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).