Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bindings/ocaml: fix ARM64 -> AArch64 #2318

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions bindings/ocaml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ LIB = capstone
FLAGS = '-Wall -Wextra -Wwrite-strings'
PYTHON2 ?= python

all: arm_const.cmxa arm64_const.cmxa m680x_const.cmxa mips_const.cmxa ppc_const.cmxa sparc_const.cmxa sysz_const.cmxa x86_const.cmxa xcore_const.cmxa arm.cmxa arm64.cmxa m680x.cmxa mips.cmxa ppc.cmxa x86.cmxa sparc.cmxa systemz.cmxa xcore.cmxa capstone.cmxa test_basic.cmx test_detail.cmx test_x86.cmx test_arm.cmx test_aarch64.cmx test_mips.cmx test_ppc.cmx test_sparc.cmx test_systemz.cmx test_xcore.cmx test_m680x.cmx ocaml.o
all: arm_const.cmxa aarch64_const.cmxa m680x_const.cmxa mips_const.cmxa ppc_const.cmxa sparc_const.cmxa sysz_const.cmxa x86_const.cmxa xcore_const.cmxa arm.cmxa aarch64.cmxa m680x.cmxa mips.cmxa ppc.cmxa x86.cmxa sparc.cmxa systemz.cmxa xcore.cmxa capstone.cmxa test_basic.cmx test_detail.cmx test_x86.cmx test_arm.cmx test_aarch64.cmx test_mips.cmx test_ppc.cmx test_sparc.cmx test_systemz.cmx test_xcore.cmx test_m680x.cmx ocaml.o
ocamlopt -o test_basic -ccopt $(FLAGS) ocaml.o capstone.cmx test_basic.cmx -cclib -l$(LIB)
ocamlopt -o test_detail -ccopt $(FLAGS) capstone.cmx ocaml.o test_detail.cmx -cclib -l$(LIB)
ocamlopt -o test_x86 -ccopt $(FLAGS) capstone.cmx ocaml.o x86.cmx x86_const.cmx test_x86.cmx -cclib -l$(LIB)
ocamlopt -o test_arm -ccopt $(FLAGS) capstone.cmx ocaml.o arm.cmx arm_const.cmx test_arm.cmx -cclib -l$(LIB)
ocamlopt -o test_aarch64 -ccopt $(FLAGS) capstone.cmx ocaml.o arm64.cmx arm64_const.cmx test_aarch64.cmx -cclib -l$(LIB)
ocamlopt -o test_aarch64 -ccopt $(FLAGS) capstone.cmx ocaml.o aarch64.cmx aarch64_const.cmx test_aarch64.cmx -cclib -l$(LIB)
ocamlopt -o test_mips -ccopt $(FLAGS) capstone.cmx ocaml.o mips.cmx mips_const.cmx test_mips.cmx -cclib -l$(LIB)
ocamlopt -o test_ppc -ccopt $(FLAGS) capstone.cmx ocaml.o ppc.cmx ppc_const.cmx test_ppc.cmx -cclib -l$(LIB)
ocamlopt -o test_sparc -ccopt $(FLAGS) capstone.cmx ocaml.o sparc.cmx sparc_const.cmx test_sparc.cmx -cclib -l$(LIB)
Expand Down Expand Up @@ -115,28 +115,28 @@ arm_const.cmx: arm_const.ml arm_const.cmi
arm_const.cmxa: arm_const.cmx
ocamlopt -ccopt $(FLAGS) -a -o $@ $<

arm64.mli: arm64.ml
aarch64.mli: aarch64.ml
ocamlc -ccopt $(FLAGS) -i $< > $@

arm64.cmi: arm64.mli
aarch64.cmi: aarch64.mli
ocamlc -ccopt $(FLAGS) -c $<

arm64.cmx: arm64.ml arm64.cmi
aarch64.cmx: aarch64.ml aarch64.cmi
ocamlopt -ccopt $(FLAGS) -c $<

arm64.cmxa: arm64.cmx
aarch64.cmxa: aarch64.cmx
ocamlopt -ccopt $(FLAGS) -a -o $@ $<

arm64_const.mli: arm64_const.ml
aarch64_const.mli: aarch64_const.ml
ocamlc -ccopt $(FLAGS) -i $< > $@

arm64_const.cmi: arm64_const.mli
aarch64_const.cmi: aarch64_const.mli
ocamlc -ccopt $(FLAGS) -c $<

arm64_const.cmx: arm64_const.ml arm64_const.cmi
aarch64_const.cmx: aarch64_const.ml aarch64_const.cmi
ocamlopt -ccopt $(FLAGS) -c $<

arm64_const.cmxa: arm64_const.cmx
aarch64_const.cmxa: aarch64_const.cmx
ocamlopt -ccopt $(FLAGS) -a -o $@ $<

m680x.mli: m680x.ml
Expand Down
45 changes: 45 additions & 0 deletions bindings/ocaml/aarch64.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
(* Capstone Disassembly Engine
* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 *)

open Aarch64_const

(* architecture specific info of instruction *)
type aarch64_op_shift = {
shift_type: int;
shift_value: int;
}

type aarch64_op_mem = {
base: int;
index: int;
disp: int
}

type aarch64_op_value =
| AARCH64_OP_INVALID of int
| AARCH64_OP_REG of int
| AARCH64_OP_CIMM of int
| AARCH64_OP_IMM of int
| AARCH64_OP_FP of float
| AARCH64_OP_MEM of aarch64_op_mem
| AARCH64_OP_REG_MRS of int
| AARCH64_OP_REG_MSR of int
| AARCH64_OP_PSTATE of int
| AARCH64_OP_SYS of int
| AARCH64_OP_PREFETCH of int
| AARCH64_OP_BARRIER of int

type aarch64_op = {
vector_index: int;
vas: int;
shift: aarch64_op_shift;
ext: int;
value: aarch64_op_value;
}

type cs_aarch64 = {
cc: int;
update_flags: bool;
writeback: bool;
operands: aarch64_op array;
}