From eae01f8c348235ea552c67ce323a1ada3dbc8b08 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 6 Sep 2018 17:17:23 +0100 Subject: RISCV: Get enough of the RISCV platform into C to run some tests --- lib/sail.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sail.c b/lib/sail.c index 886f6a37..42ee8209 100644 --- a/lib/sail.c +++ b/lib/sail.c @@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include #include #include @@ -1111,9 +1112,13 @@ void string_of_int(sail_string *str, const sail_int i) gmp_asprintf(str, "%Zd", i); } +/* asprinf is a GNU extension, but it should exist on BSD */ void string_of_mach_bits(sail_string *str, const mach_bits op) { - exit(EXIT_FAILURE); + int bytes = asprintf(str, "0x%" PRIx64, op); + if (bytes == -1) { + fprintf(stderr, "Could not print bits 0x%" PRIx64 "\n", op); + } } void string_of_sail_bits(sail_string *str, const sail_bits op) -- cgit v1.2.3