mirror of https://github.com/xemu-project/xemu.git
pc-bios/s390-ccw: Add fill_hex_val func to provide better msgs
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>
This commit is contained in:
parent
60612d5cbb
commit
058cc1f311
|
@ -86,15 +86,21 @@ static inline void fill_hex(char *out, unsigned char val)
|
||||||
out[1] = hex[val & 0xf];
|
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;
|
unsigned char *value = ptr;
|
||||||
char out[] = ": 0xffffffffffffffff\n";
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(addr); i++) {
|
for (i = 0; i < size; i++) {
|
||||||
fill_hex(&out[4 + (i*2)], addr_c[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(desc);
|
||||||
sclp_print(out);
|
sclp_print(out);
|
||||||
|
|
Loading…
Reference in New Issue