Skip to content

Commit

Permalink
cleaner implementation for arch modularization
Browse files Browse the repository at this point in the history
  • Loading branch information
aquynh committed Dec 21, 2013
1 parent abc0205 commit f185180
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 208 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@ LIBNAME = capstone
LIBOBJ =
LIBOBJ += cs.o utils.o SStream.o MCInstrDesc.o MCRegisterInfo.o
ifneq (,$(filter $(CAPSTONE_ARCH), arm all))
LIBOBJ += arch/ARM/ARMDisassembler.o arch/ARM/ARMInstPrinter.o arch/ARM/mapping.o
LIBOBJ += arch/ARM/ARMDisassembler.o arch/ARM/ARMInstPrinter.o arch/ARM/mapping.o arch/ARM/module.o
CFLAGS += -DCS_SUPPORT_ARM
ifeq ($(CAPSTONE_ARCH), arm)
LIBNAME = capstone-arm
endif
endif
ifneq (, $(filter $(CAPSTONE_ARCH), x86 all))
LIBOBJ += arch/X86/X86DisassemblerDecoder.o arch/X86/X86Disassembler.o arch/X86/X86IntelInstPrinter.o arch/X86/X86ATTInstPrinter.o arch/X86/mapping.o
LIBOBJ += arch/X86/X86DisassemblerDecoder.o arch/X86/X86Disassembler.o arch/X86/X86IntelInstPrinter.o arch/X86/X86ATTInstPrinter.o arch/X86/mapping.o arch/X86/module.o
CFLAGS += -DCS_SUPPORT_X86
ifeq ($(CAPSTONE_ARCH), x86)
LIBNAME = capstone-x86
endif
endif
ifneq (, $(filter $(CAPSTONE_ARCH), mips all))
LIBOBJ += arch/Mips/MipsDisassembler.o arch/Mips/MipsInstPrinter.o arch/Mips/mapping.o
LIBOBJ += arch/Mips/MipsDisassembler.o arch/Mips/MipsInstPrinter.o arch/Mips/mapping.o arch/Mips/module.o
CFLAGS += -DCS_SUPPORT_MIPS
ifeq ($(CAPSTONE_ARCH), mips)
LIBNAME = capstone-mips
endif
endif
ifneq (, $(filter $(CAPSTONE_ARCH), arm64 all))
LIBOBJ += arch/AArch64/AArch64BaseInfo.o arch/AArch64/AArch64Disassembler.o arch/AArch64/AArch64InstPrinter.o arch/AArch64/mapping.o
LIBOBJ += arch/AArch64/AArch64BaseInfo.o arch/AArch64/AArch64Disassembler.o arch/AArch64/AArch64InstPrinter.o arch/AArch64/mapping.o arch/AArch64/module.o
CFLAGS += -DCS_SUPPORT_AARCH64
ifeq ($(CAPSTONE_ARCH), arm64)
LIBNAME = capstone-arm64
Expand Down
31 changes: 0 additions & 31 deletions arch/AArch64/module.h

This file was deleted.

49 changes: 0 additions & 49 deletions arch/ARM/module.h

This file was deleted.

48 changes: 0 additions & 48 deletions arch/Mips/module.h

This file was deleted.

50 changes: 0 additions & 50 deletions arch/X86/module.h

This file was deleted.

5 changes: 4 additions & 1 deletion cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

#include "MCRegisterInfo.h"

#include "module.h"
#include "utils.h"

void (*init_arch[MAX_ARCH]) (cs_struct *);
cs_err (*option_arch[MAX_ARCH]) (cs_struct*, cs_opt_type, size_t value);


void cs_version(int *major, int *minor)
{
*major = CS_API_MAJOR;
Expand Down
6 changes: 6 additions & 0 deletions cs_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ typedef struct cs_struct {
cs_opt_value detail;
} cs_struct;

#define MAX_ARCH 32

extern void (*init_arch[MAX_ARCH]) (cs_struct *);
extern cs_err (*option_arch[MAX_ARCH]) (cs_struct*, cs_opt_type, size_t value);


#endif
1 change: 1 addition & 0 deletions include/capstone.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extern "C" {

#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>

// Capstone API version
#define CS_API_MAJOR 1
Expand Down
25 changes: 0 additions & 25 deletions module.h

This file was deleted.

0 comments on commit f185180

Please sign in to comment.