summaryrefslogtreecommitdiff
path: root/test/c/sail.h
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-02-23 19:32:02 +0000
committerAlasdair Armstrong2018-02-23 20:03:21 +0000
commite5996d307ca0a7a75431b194b3b04c2aa9008473 (patch)
tree709751de402b0809f72970c6317337ee6862ac75 /test/c/sail.h
parent60abec7cf41b95a5e7aeabd129444a1eb30ed9c1 (diff)
Fix some bugs in C compilation
Fixed an issue with pattern matching on enums Fixed an issue whereby fix_early_returns would cause memory leaks Added optimizations for some of the builtins used in the decode function. Optimizations are turned on with the -O flag.
Diffstat (limited to 'test/c/sail.h')
-rw-r--r--test/c/sail.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/c/sail.h b/test/c/sail.h
index 92127a1b..abd86a71 100644
--- a/test/c/sail.h
+++ b/test/c/sail.h
@@ -21,8 +21,8 @@ typedef char *sail_string;
// This function should be called whenever a pattern match failure
// occurs. Pattern match failures are always fatal.
-void sail_match_failure(void) {
- fprintf(stderr, "Pattern match failure\n");
+void sail_match_failure(sail_string msg) {
+ fprintf(stderr, "Pattern match failure in %s\n", msg);
exit(1);
}
@@ -41,12 +41,12 @@ void elf_entry(mpz_t *rop, const unit u) {
mpz_set_ui(*rop, 0x400130ul);
}
-// Sail bits are mapped to ints where bitzero = 0 and bitone = 1
-bool eq_bit(const int a, const int b) {
+// Sail bits are mapped to uint64_t where bitzero = 0ul and bitone = 1ul
+bool eq_bit(const uint64_t a, const uint64_t b) {
return a == b;
}
-int undefined_bit(unit u) { return 0; }
+uint64_t undefined_bit(unit u) { return 0; }
// ***** Sail booleans *****
@@ -683,7 +683,7 @@ void read_ram(bv_t *data, const mpz_t m, const mpz_t n, const bv_t x, const bv_t
mpz_set_ui(*data->bits, instr);
data->len = 32;
- print_bits("instruction = ", *data);
+ // print_bits("instruction = ", *data);
}
// ***** Setup and cleanup functions for library code *****