summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Norton2016-04-19 15:07:51 +0100
committerRobert Norton2016-04-19 15:10:10 +0100
commit6e53e8ea9e2824b157b2ccbd81a150e59905d788 (patch)
tree043d5552ba105901d9cfcec91ca8ad14f7318205
parenta465bfc4984c035aa4b1a185c1791b1f081e5baa (diff)
cheri: zero all tags when loading memory from elf so that we don't get undefined unless we actually access memory which is uninitialised.
-rw-r--r--src/lem_interp/run_with_elf_cheri.ml4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lem_interp/run_with_elf_cheri.ml b/src/lem_interp/run_with_elf_cheri.ml
index 5e7986c2..ff4e5caa 100644
--- a/src/lem_interp/run_with_elf_cheri.ml
+++ b/src/lem_interp/run_with_elf_cheri.ml
@@ -30,7 +30,9 @@ let add_mem byte addr mem =
assert(byte >= 0 && byte < 256);
(*Printf.printf "add_mem %s: 0x%02x\n" (Uint64.to_string_hex (Uint64.of_string (Nat_big_num.to_string addr))) byte;*)
let mem_byte = memory_byte_of_int byte in
- mem := Mem.add addr mem_byte !mem
+ let zero_byte = memory_byte_of_int 0 in
+ mem := Mem.add addr mem_byte !mem;
+ tag_mem := Mem.add addr zero_byte !tag_mem
let get_reg reg name =
let reg_content = Reg.find name reg in reg_content