From 6e53e8ea9e2824b157b2ccbd81a150e59905d788 Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Tue, 19 Apr 2016 15:07:51 +0100 Subject: cheri: zero all tags when loading memory from elf so that we don't get undefined unless we actually access memory which is uninitialised. --- src/lem_interp/run_with_elf_cheri.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3