File 0176-pc-bios-s390-ccw-Add-fill_hex_val-f.patch of Package qemu.6354
From 4d1b5fb4e4a0878944b95bebc7424fbd50c36d0e Mon Sep 17 00:00:00 2001
From: "Eugene (jno) Dvurechenski" <jno@linux.vnet.ibm.com>
Date: Mon, 19 May 2014 20:11:55 +0200
Subject: [PATCH] pc-bios/s390-ccw: Add fill_hex_val func to provide better
msgs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Factor out helper function for dumping a hex value into a buffer.
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
(cherry picked from commit 058cc1f311b00fe65b7500efefa8f08b2f1c85d9)
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
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 075519b203..2b773deafa 100644
--- a/pc-bios/s390-ccw/s390-ccw.h
+++ b/pc-bios/s390-ccw/s390-ccw.h
@@ -87,15 +87,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);