summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sail.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/sail.h b/lib/sail.h
index c0f2674b..b5328377 100644
--- a/lib/sail.h
+++ b/lib/sail.h
@@ -42,7 +42,11 @@ unit sail_exit(const unit u) {
}
void elf_entry(mpz_t *rop, const unit u) {
- mpz_set_ui(*rop, 0x400168ul);
+ mpz_set_ui(*rop, 0x400130ul);
+}
+
+void elf_tohost(mpz_t *rop, const unit u) {
+ mpz_set_ui(*rop, 0x0ul);
}
// Sail bits are mapped to uint64_t where bitzero = 0ul and bitone = 1ul
@@ -102,12 +106,17 @@ bool eq_string(const sail_string str1, const sail_string str2) {
return strcmp(str1, str2) == 0;
}
-unit print_endline(sail_string str) {
+unit print_endline(const sail_string str) {
printf("%s\n", str);
return UNIT;
}
-unit prerr_endline(sail_string str) {
+unit print_string(const sail_string str1, const sail_string str2) {
+ printf("%s%s\n", str1, str2);
+ return UNIT;
+}
+
+unit prerr_endline(const sail_string str) {
fprintf(stderr, "%s\n", str);
return UNIT;
}
@@ -170,6 +179,10 @@ int64_t convert_int64_t_of_mpz_t(const mpz_t op) {
return mpz_get_si(op);
}
+void convert_mpz_t_of_int64_t(mpz_t *rop, const int64_t op) {
+ mpz_set_si(*rop, op);
+}
+
// ***** Sail builtins for integers *****
bool eq_int(const mpz_t op1, const mpz_t op2) {
@@ -384,6 +397,12 @@ void zero_extend(bv_t *rop, const bv_t op, const mpz_t len) {
mpz_set(*rop->bits, *op.bits);
}
+/* FIXME */
+void sign_extend(bv_t *rop, const bv_t op, const mpz_t len) {
+ rop->len = mpz_get_ui(len);
+ mpz_set(*rop->bits, *op.bits);
+}
+
void clear_bv_t(bv_t *rop) {
mpz_clear(*rop->bits);
free(rop->bits);