qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 06/10] pc-bios/s390-ccw: Add fill_hex_val func to pro


From: Cornelia Huck
Subject: [Qemu-devel] [PULL 06/10] pc-bios/s390-ccw: Add fill_hex_val func to provide better msgs
Date: Fri, 27 Jun 2014 13:25:22 +0200

From: "Eugene (jno) Dvurechenski" <address@hidden>

Factor out helper function for dumping a hex value into a buffer.

Acked-by: Christian Borntraeger <address@hidden>
Signed-off-by: Eugene (jno) Dvurechenski <address@hidden>
Signed-off-by: Jens Freimann <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
 pc-bios/s390-ccw/s390-ccw.h |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
index 29468fb..959aed0 100644
--- a/pc-bios/s390-ccw/s390-ccw.h
+++ b/pc-bios/s390-ccw/s390-ccw.h
@@ -86,15 +86,21 @@ static inline void fill_hex(char *out, unsigned char val)
     out[1] = hex[val & 0xf];
 }
 
-static inline void print_int(const char *desc, u64 addr)
+static inline void fill_hex_val(char *out, void *ptr, unsigned size)
 {
-    unsigned char *addr_c = (unsigned char *)&addr;
-    char out[] = ": 0xffffffffffffffff\n";
+    unsigned char *value = ptr;
     unsigned int i;
 
-    for (i = 0; i < sizeof(addr); i++) {
-        fill_hex(&out[4 + (i*2)], addr_c[i]);
+    for (i = 0; i < size; i++) {
+        fill_hex(&out[i*2], value[i]);
     }
+}
+
+static inline void print_int(const char *desc, u64 addr)
+{
+    char out[] = ": 0xffffffffffffffff\n";
+
+    fill_hex_val(&out[4], &addr, sizeof(addr));
 
     sclp_print(desc);
     sclp_print(out);
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]