From 4808ca9eeace798facf7bcdf304518af296ab7c7 Mon Sep 17 00:00:00 2001 From: ivg Date: Mon, 28 Sep 2020 16:00:59 -0400 Subject: [PATCH] adds an llvm decode for x86 --- lib/x86_cpu/x86_target.ml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/x86_cpu/x86_target.ml b/lib/x86_cpu/x86_target.ml index 63f70cbfb..8059cc6f9 100644 --- a/lib/x86_cpu/x86_target.ml +++ b/lib/x86_cpu/x86_target.ml @@ -226,6 +226,23 @@ let enable_arch () = then `x86 else `unknown + +let llvm_x86_encoding = + Theory.Language.declare ~package:"llvm" "x86" +let llvm_x86_64_encoding = + Theory.Language.declare ~package:"llvm" "x86-64" + +let enable_decoder () = + let open KB.Syntax in + KB.promise Theory.Label.encoding @@ fun label -> + Theory.Label.target label >>| fun t -> + if Theory.Target.belongs amd64 t + then llvm_x86_64_encoding else + if Theory.Target.belongs parent t + then llvm_x86_encoding + else Theory.Language.unknown + let load () = enable_loader (); - enable_arch () + enable_arch (); + enable_decoder ()