Skip to content

Commit

Permalink
Added support for building binaries for Windows CE 7 on ARMv7 (a.k.a.…
Browse files Browse the repository at this point in the history
…, Windows Embedded Compact 7) and for Windows CE 8 on ARMv7 (a.k.a., Windows Embedded Compact 2013).

Added support for building binaries for Windows CE 7 on ARMv7 (a.k.a., Windows Embedded Compact 7) and for Windows CE 8 on ARMv7 (a.k.a., Windows Embedded Compact 2013).

Added support for building binaries for Windows CE 7 on ARMv7 (a.k.a., Windows Embedded Compact 7) and for Windows CE 8 on ARMv7 (a.k.a., Windows Embedded Compact 2013).

Replaced header inclusions of "stdint.h" and "intrin.h" by selective inclusions to support platforms that do not provide those headers. The header "platform.h" handles the platform test.
Updated the build script for Windows CE 7 on ARMv7.
  • Loading branch information
koutheir committed Apr 7, 2016
1 parent 31b4214 commit b914a1b
Show file tree
Hide file tree
Showing 35 changed files with 539 additions and 39 deletions.
2 changes: 1 addition & 1 deletion LEB128.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef CS_LLVM_SUPPORT_LEB128_H
#define CS_LLVM_SUPPORT_LEB128_H

#include <stdint.h>
#include "include/capstone/capstone.h"

/// Utility function to decode a ULEB128 value.
static inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n)
Expand Down
2 changes: 0 additions & 2 deletions MCInst.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#ifndef CS_MCINST_H
#define CS_MCINST_H

#include <stdint.h>

#include "include/capstone/capstone.h"

typedef struct MCInst MCInst;
Expand Down
1 change: 0 additions & 1 deletion MCInstrDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#ifndef CS_LLVM_MC_MCINSTRDESC_H
#define CS_LLVM_MC_MCINSTRDESC_H

#include <stdint.h>
#include "capstone/platform.h"

//===----------------------------------------------------------------------===//
Expand Down
1 change: 0 additions & 1 deletion MCRegisterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef CS_LLVM_MC_MCREGISTERINFO_H
#define CS_LLVM_MC_MCREGISTERINFO_H

#include <stdint.h>
#include "capstone/platform.h"

/// An unsigned integer type large enough to represent all physical registers,
Expand Down
6 changes: 3 additions & 3 deletions MathExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#ifndef CS_LLVM_SUPPORT_MATHEXTRAS_H
#define CS_LLVM_SUPPORT_MATHEXTRAS_H

#include <stdint.h>

#ifdef _MSC_VER
#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800)
#include "windowsce/intrin.h"
#elif defined(_MSC_VER)
# include <intrin.h>
#endif

Expand Down
1 change: 0 additions & 1 deletion SStream.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Capstone Disassembly Engine */
/* By Nguyen Anh Quynh <[email protected]>, 2013-2015 */

#include <stdint.h>
#include <stdarg.h>
#if defined(CAPSTONE_HAS_OSXKERNEL)
#include <libkern/libkern.h>
Expand Down
2 changes: 2 additions & 0 deletions SStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#ifndef CS_SSTREAM_H_
#define CS_SSTREAM_H_

#include "include/capstone/platform.h"

typedef struct SStream {
char buffer[512];
int index;
Expand Down
1 change: 0 additions & 1 deletion arch/AArch64/AArch64BaseInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#define CS_LLVM_AARCH64_BASEINFO_H

#include <ctype.h>
#include <stdint.h>
#include <string.h>

#ifndef __cplusplus
Expand Down
2 changes: 0 additions & 2 deletions arch/AArch64/AArch64Disassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#ifndef CS_AARCH64_DISASSEMBLER_H
#define CS_AARCH64_DISASSEMBLER_H

#include <stdint.h>

#include "capstone/capstone.h"
#include "../../MCRegisterInfo.h"
#include "../../MCInst.h"
Expand Down
5 changes: 4 additions & 1 deletion arch/AArch64/AArch64InstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,9 +1642,12 @@ static void printSystemPStateField(MCInst *MI, unsigned OpNo, SStream *O)
MI->flat_insn->detail->arm64.op_count++;
}
} else {
#ifndef CAPSTONE_DIET
unsigned char access;
#endif
printInt32Bang(O, Val);
#ifndef CAPSTONE_DIET
unsigned char access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx);
access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx);
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access;
MI->ac_idx++;
#endif
Expand Down
1 change: 0 additions & 1 deletion arch/M68K/M68KDisassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#define CS_M68KDISASSEMBLER_H

#include "../../MCInst.h"
#include <stdint.h>

/* Private, For internal use only */
typedef struct m68k_info {
Expand Down
2 changes: 0 additions & 2 deletions arch/M68K/M68KInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#ifndef CS_M68KINSTPRINTER_H
#define CS_M68KINSTPRINTER_H

#include <stdint.h>

#include "capstone/capstone.h"
#include "../../MCRegisterInfo.h"
#include "../../MCInst.h"
Expand Down
2 changes: 0 additions & 2 deletions arch/PowerPC/PPCDisassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#ifndef CS_PPCDISASSEMBLER_H
#define CS_PPCDISASSEMBLER_H

#include <stdint.h>

#include "capstone/capstone.h"
#include "../../MCRegisterInfo.h"
#include "../../MCInst.h"
Expand Down
2 changes: 0 additions & 2 deletions arch/Sparc/SparcDisassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#ifndef CS_SPARCDISASSEMBLER_H
#define CS_SPARCDISASSEMBLER_H

#include <stdint.h>

#include "capstone/capstone.h"
#include "../../MCRegisterInfo.h"
#include "../../MCInst.h"
Expand Down
2 changes: 0 additions & 2 deletions arch/SystemZ/SystemZDisassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#ifndef CS_SYSZDISASSEMBLER_H
#define CS_SYSZDISASSEMBLER_H

#include <stdint.h>

#include "capstone/capstone.h"
#include "../../MCRegisterInfo.h"
#include "../../MCInst.h"
Expand Down
2 changes: 0 additions & 2 deletions arch/X86/X86Disassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
#ifndef CS_X86_DISASSEMBLER_H
#define CS_X86_DISASSEMBLER_H

#include <stdint.h>

#include "capstone/capstone.h"

#include "../../MCInst.h"
Expand Down
1 change: 0 additions & 1 deletion arch/X86/X86DisassemblerDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#else
#include <stdio.h>
#endif
#include <stdint.h>

#include "X86DisassemblerDecoderCommon.h"

Expand Down
2 changes: 0 additions & 2 deletions arch/X86/X86DisassemblerDecoderCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#ifndef CS_X86_DISASSEMBLERDECODERCOMMON_H
#define CS_X86_DISASSEMBLERDECODERCOMMON_H

#include <stdint.h>

#define INSTRUCTIONS_SYM x86DisassemblerInstrSpecifiers
#define CONTEXTS_SYM x86DisassemblerContexts
#define ONEBYTE_SYM x86DisassemblerOneByteOpcodes
Expand Down
2 changes: 0 additions & 2 deletions arch/XCore/XCoreDisassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#ifndef CS_XCOREDISASSEMBLER_H
#define CS_XCOREDISASSEMBLER_H

#include <stdint.h>

#include "capstone/capstone.h"
#include "../../MCRegisterInfo.h"
#include "../../MCInst.h"
Expand Down
1 change: 0 additions & 1 deletion include/capstone/arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

#ifdef _MSC_VER
Expand Down
1 change: 0 additions & 1 deletion include/capstone/arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

#ifdef _MSC_VER
Expand Down
1 change: 0 additions & 1 deletion include/capstone/capstone.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include <stdarg.h>
#if defined(CAPSTONE_HAS_OSXKERNEL)
#include <libkern/libkern.h>
Expand Down
1 change: 0 additions & 1 deletion include/capstone/m68k.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

#ifdef _MSC_VER
Expand Down
1 change: 0 additions & 1 deletion include/capstone/mips.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

// GCC MIPS toolchain has a default macro called "mips" which breaks
Expand Down
6 changes: 6 additions & 0 deletions include/capstone/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
#ifndef CAPSTONE_PLATFORM_H
#define CAPSTONE_PLATFORM_H

#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800)
#include "windowsce/stdint.h"
#else // Platforms where stdint.h is provided
#include <stdint.h>
#endif

#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64))
// MSVC

Expand Down
1 change: 0 additions & 1 deletion include/capstone/ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

#ifdef _MSC_VER
Expand Down
1 change: 0 additions & 1 deletion include/capstone/sparc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

// GCC SPARC toolchain has a default macro called "sparc" which breaks
Expand Down
1 change: 0 additions & 1 deletion include/capstone/systemz.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

#ifdef _MSC_VER
Expand Down
2 changes: 1 addition & 1 deletion include/capstone/x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

// Calculate relative address for X86-64, given cs_insn structure
#define X86_REL_ADDR(insn) (insn.address + insn.size + insn.detail->x86.disp)
Expand Down
1 change: 0 additions & 1 deletion include/capstone/xcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" {
#endif

#include <stdint.h>
#include "platform.h"

#ifdef _MSC_VER
Expand Down
12 changes: 12 additions & 0 deletions include/windowsce/intrin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

#if defined(_MSC_VER) && defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) && !defined(__INTRIN_H_) && !defined(_INTRIN)
#define _STDINT

#ifdef _M_ARM
#include <armintr.h>
#if (_WIN32_WCE >= 0x700) && defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
#include <arm_neon.h>
#endif
#endif // _M_ARM

#endif
Loading

0 comments on commit b914a1b

Please sign in to comment.