File tree 6 files changed +16
-0
lines changed 6 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,10 @@ let stage2 stage1 = object
182
182
else prog
183
183
end
184
184
185
+ let registry = Hashtbl. create (module String )
186
+ let register name abi = Hashtbl. set registry ~key: name ~data: abi
187
+ let get_processor name = Hashtbl. find registry name
188
+
185
189
let create_api_processor size abi : Bap_api.t =
186
190
let addr_size = size#pointer in
187
191
let stage1 gamma = object (self )
Original file line number Diff line number Diff line change @@ -82,6 +82,14 @@ val data : #Bap_c_size.base -> Bap_c_type.t -> Bap_c_data.t
82
82
*)
83
83
val arg_intent : Bap_c_type .t -> intent
84
84
85
+ (* * [register name t] registers an abi processor [t] named [name] that
86
+ may be used by subroutines in this project.*)
87
+ val register : string -> t -> unit
88
+
89
+ (* * [get_processor name] is used to access an abi processor with its
90
+ name.*)
91
+ val get_processor : string -> t option
92
+
85
93
86
94
(* * An abstraction of a stack, commonly used in C compilers. *)
87
95
module Stack : sig
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ let api arch = C.Abi.create_api_processor arch abi
61
61
let main proj = match Project. arch proj with
62
62
| #Arch. arm ->
63
63
info " using armeabi ABI" ;
64
+ C.Abi. register " eabi" abi;
64
65
Bap_api. process (api size);
65
66
Project. set proj Bap_abi. name " eabi"
66
67
| _ -> proj
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ let set_abi proj m =
105
105
insert_args = dispatch m (Project. arch proj);
106
106
apply_attrs = fun _ -> ident
107
107
} in
108
+ C.Abi. register A. name abi;
108
109
let api = C.Abi. create_api_processor A. size abi in
109
110
Bap_api. process api;
110
111
let prog = Project. program proj in
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ let main proj = match Project.arch proj with
80
80
insert_args = dispatch (module Abi32 );
81
81
apply_attrs = fun _ -> ident
82
82
} in
83
+ C.Abi. register Abi32. name abi;
83
84
let api = C.Abi. create_api_processor Abi32. size abi in
84
85
Bap_api. process api;
85
86
let prog = Project. program proj in
Original file line number Diff line number Diff line change @@ -251,6 +251,7 @@ let setup ?(abi=fun _ -> None) () =
251
251
insert_args = dispatch abi;
252
252
apply_attrs = fun _ -> ident
253
253
} in
254
+ C.Abi. register Abi. name abi;
254
255
let api = C.Abi. create_api_processor Abi. size abi in
255
256
Bap_api. process api;
256
257
let prog = demangle Abi. demangle (Project. program proj) in
You can’t perform that action at this time.
0 commit comments