mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-06 18:13:46 +00:00
Improved MSVC support (WIP)
This commit is contained in:
parent
c69b39798a
commit
926f024909
8
.gitignore
vendored
8
.gitignore
vendored
@ -9,6 +9,9 @@ clang-log/
|
||||
*.sdb
|
||||
*.dylib
|
||||
*.dll
|
||||
*.lib
|
||||
*.obj
|
||||
*.ilk
|
||||
*.dSYM
|
||||
supported.*
|
||||
config.mk
|
||||
@ -17,6 +20,9 @@ langs.cfg
|
||||
.*.swp
|
||||
.*.swo
|
||||
*.un~
|
||||
*.pdb
|
||||
*.lib
|
||||
*.ilk
|
||||
binr/r2agent/r2agent
|
||||
binr/r2agent/r2agent.exe
|
||||
binr/rabin2/rabin2
|
||||
@ -46,7 +52,6 @@ libr/config.h
|
||||
libr/include/r_userconf.h
|
||||
libr/include/r_version.h
|
||||
libr/include/r_version.h.tmp
|
||||
shlr/grub/libgrubfs.lib
|
||||
shlr/java/out
|
||||
shlr/java/out.exe
|
||||
shlr/sdb/sdb
|
||||
@ -58,7 +63,6 @@ shlr/sdb/src/.sdb.exe
|
||||
shlr/sdb/src/sdb-version.h
|
||||
shlr/sdb/src/sdb_version.h
|
||||
shlr/sdb/src/libsdb.so*
|
||||
shlr/sdb/src/libsdb.lib
|
||||
shlr/spp/config.h
|
||||
shlr/capstone/
|
||||
sys/.mark_python-deps
|
||||
|
@ -23,7 +23,7 @@ BEXE=${BIN}${EXT_EXE}
|
||||
|
||||
ifeq ($(WITHNONPIC),1)
|
||||
## LDFLAGS+=$(addsuffix /lib${BINDEPS}.a,$(addprefix ../../libr/,$(subst r_,,$(BINDEPS))))
|
||||
LDFLAGS+=$(shell for a in ${BINDEPS} ; do b=`echo $$a |sed -e s,r_,,g`; echo ../../libr/$$b/lib$$a.a ; done )
|
||||
LDFLAGS+=$(shell for a in ${BINDEPS} ; do b=`echo $$a |sed -e s,r_,,g`; echo ../../libr/$$b/lib$$a.${EXT_AR} ; done )
|
||||
LDFLAGS+=../../shlr/sdb/src/libsdb.a
|
||||
LDFLAGS+=../../shlr/grub/libgrubfs.a
|
||||
LDFLAGS+=../../shlr/gdb/lib/libgdbr.a
|
||||
@ -33,13 +33,17 @@ LDFLAGS+=../../shlr/java/libr_java.a
|
||||
LDFLAGS+=../../libr/util/libr_util.a
|
||||
ifneq (${ANDROID},1)
|
||||
ifneq (${OSTYPE},linux)
|
||||
ifneq ($(CC),cccl)
|
||||
LDFLAGS+=-lpthread
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifneq (${OSTYPE},haiku)
|
||||
ifneq ($(CC),cccl)
|
||||
LDFLAGS+=-lm
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
LDFLAGS+=${DL_LIBS}
|
||||
LDFLAGS+=${LINK}
|
||||
|
||||
|
1
configure
vendored
1
configure
vendored
@ -434,7 +434,6 @@ if [ $? = 0 ]; then
|
||||
echo yes; HAVE_PKGCFG_CAPSTONE=1;
|
||||
CAPSTONE_LDFLAGS=$tmp; fi; fi
|
||||
if [ 11 = "$WITH_CAPSTONE$HAVE_PKGCFG_CAPSTONE" ]; then
|
||||
|
||||
USE_CAPSTONE="1"
|
||||
else
|
||||
USE_CAPSTONE="0"; fi
|
||||
|
@ -34,7 +34,7 @@ all:
|
||||
${MAKE} $(LIBS6)
|
||||
${MAKE} $(LIBS7)
|
||||
ifeq (${WITHNONPIC},1)
|
||||
${MAKE} libr.a
|
||||
${MAKE} libr.${EXT_AR}
|
||||
endif
|
||||
|
||||
# looks hacky :D
|
||||
@ -42,10 +42,10 @@ endif
|
||||
|
||||
S=$
|
||||
B=`
|
||||
libr.a:
|
||||
libr.${EXT_AR}:
|
||||
rm -rf .libr
|
||||
mkdir .libr
|
||||
for FILE in */libr_*.a ../shlr/*/*.a ; do \
|
||||
for FILE in */libr_*.${EXT_AR} ../shlr/*/*.${EXT_AR} ; do \
|
||||
F=${B}basename $$FILE${B} ; \
|
||||
Q=${B}dirname $$FILE${B} ; \
|
||||
D=${B}basename $$Q${B} ; \
|
||||
@ -55,11 +55,11 @@ libr.a:
|
||||
(cd .libr/$$D && ${AR} x $$F || true ) ; \
|
||||
done
|
||||
echo lets ar
|
||||
cd .libr ; ${AR} qv libr.a `find * -iname *.o 2> /dev/null`
|
||||
cd .libr ; ${AR} qv libr.${EXT_AR} `find * -iname *.${EXT_AR} 2> /dev/null`
|
||||
echo lets m
|
||||
mv .libr/libr.a libr.a
|
||||
mv .libr/libr.${EXT_AR} libr.${EXT_AR}
|
||||
echo ranlibin
|
||||
${RANLIB} libr.a
|
||||
${RANLIB} libr.${EXT_AR}
|
||||
rm -rf .libr
|
||||
|
||||
__AR=xcrun --sdk iphoneos ar
|
||||
@ -67,21 +67,21 @@ __RANLIB=xcrun --sdk iphoneos ranlib
|
||||
a:
|
||||
rm -rf .libr
|
||||
mkdir .libr
|
||||
for FILE in */libr_*.a ; do \
|
||||
for FILE in */libr_*.${EXT_AR} ; do \
|
||||
mkdir -p .libr/$$FILE ; \
|
||||
cp -f $$FILE .libr/$$FILE ; \
|
||||
(cd .libr/$$FILE ; ${__AR} x *.a ; rm -f *.a ) ; \
|
||||
(cd .libr/$$FILE ; ${__AR} x *.${EXT_AR} ; rm -f *.${EXT_AR} ) ; \
|
||||
done
|
||||
cd .libr ; ${__AR} qv libr.a `find * -iname *.o`
|
||||
mv .libr/libr.a libr.a
|
||||
${__RANLIB} libr.a
|
||||
lipo -info libr.a
|
||||
cd .libr ; ${__AR} qv libr.${EXT_AR} `find * -iname *.o`
|
||||
mv .libr/libr.${EXT_AR} libr.${EXT_AR}
|
||||
${__RANLIB} libr.${EXT_AR}
|
||||
lipo -info libr.${EXT_AR}
|
||||
rm -rf .libr
|
||||
|
||||
gnu_libr.a: $(shell ls */libr_*.a 2>/dev/null)
|
||||
rm -f libr.a
|
||||
echo CREATE libr.a > libr.m
|
||||
for FILE in */libr_*.a ; do echo ADDLIB $$FILE >> libr.m ; done
|
||||
gnu_libr.${EXT_AR}: $(shell ls */libr_*.${EXT_AR} 2>/dev/null)
|
||||
rm -f libr.
|
||||
echo CREATE libr.${EXT_AR} > libr.m
|
||||
for FILE in */libr_*.${EXT_AR} ; do echo ADDLIB $$FILE >> libr.m ; done
|
||||
echo SAVE >> libr.m
|
||||
# ar -M is a gnu-ism .. try to find a proper portable way to do that
|
||||
${CC_AR} -M < libr.m
|
||||
@ -158,7 +158,7 @@ install: install-includes install-pkgconfig
|
||||
( cd "${DESTDIR}${LIBDIR}" ; ln -fs "$(call libpath-to-name-version,$(lib),${LIBVERSION})" "$(call libpath-to-name,$(lib))" ) ; \
|
||||
)
|
||||
# object archives
|
||||
@for FILE in `find * -type f -iname "*.a" | grep -v fs/p` ; do \
|
||||
@for FILE in `find * -type f -iname "*.${EXT_AR}" | grep -v fs/p` ; do \
|
||||
echo " ${DESTDIR}${LIBDIR}/$$FILE"; ${INSTALL_DATA} $$FILE "${DESTDIR}${LIBDIR}" ; done || true
|
||||
# plugins
|
||||
@${INSTALL_DIR} "${DESTDIR}${LIBDIR}/radare2/${VERSION}"
|
||||
@ -176,7 +176,7 @@ deinstall uninstall:
|
||||
FILE=`echo $$FILE | awk -F / '{ print $$NF; }'`; \
|
||||
echo "${DESTDIR}${LIBDIR}/$$FILE" ; rm -f "${DESTDIR}${LIBDIR}/$$FILE" ; done
|
||||
# object archives
|
||||
-@for FILE in `find * | grep -e '\.a$$'` ; do \
|
||||
-@for FILE in `find * | grep -e '\.${EXT_AR}$$'` ; do \
|
||||
FILE=`echo $$FILE | awk -F / '{ print $$NF; }'`; \
|
||||
echo "${DESTDIR}${LIBDIR}/$$FILE" ; rm -f "${DESTDIR}${LIBDIR}/$$FILE" ; done
|
||||
# includes
|
||||
@ -203,11 +203,11 @@ deinstall uninstall:
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr_*.so.${LIBVERSION}"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr_*.so.0"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr_*.so"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr_*.a"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr_*.${EXT_AR}"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr2.so"*
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr2.a"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr2.${EXT_AR}"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr.so"*
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr.a"
|
||||
rm -rf "${DESTDIR}${LIBDIR}/libr.${EXT_AR}"
|
||||
rm -rf "${DESTDIR}${DATADIR}/doc/radare2"
|
||||
@echo libr aka radare2 has been uninstalled from PREFIX=${DESTDIR}${PREFIX}
|
||||
|
||||
|
@ -1685,8 +1685,8 @@ static int esil_poke_some(RAnalEsil *esil) {
|
||||
int regsize;
|
||||
ut64 ptr, regs = 0, tmp;
|
||||
char *count, *dst = r_anal_esil_pop (esil);
|
||||
const int bytes = 64;
|
||||
if (dst && r_anal_esil_get_parm_size (esil, dst, &tmp, ®size)) {
|
||||
ut8 bytes = regsize / 8;
|
||||
// reg
|
||||
isregornum (esil, dst, &ptr);
|
||||
count = r_anal_esil_pop (esil);
|
||||
|
@ -29,8 +29,8 @@
|
||||
#define MAX_JMPTBL_JMP 10000
|
||||
|
||||
#define DB a->sdb_fcns
|
||||
#define EXISTS(x, y ...) snprintf (key, sizeof(key) - 1, x, ## y), sdb_exists (DB, key)
|
||||
#define SETKEY(x, y ...) snprintf (key, sizeof (key) - 1, x, ## y);
|
||||
#define EXISTS(x, ...) snprintf (key, sizeof(key) - 1, x, ## __VA_ARGS__), sdb_exists (DB, key)
|
||||
#define SETKEY(x, ...) snprintf (key, sizeof (key) - 1, x, ## __VA_ARGS__);
|
||||
|
||||
#define VERBOSE_DELAY if (0)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <r_anal.h>
|
||||
|
||||
#define DB a->sdb_hints
|
||||
#define setf(x,y...) snprintf(x,sizeof(x)-1,##y)
|
||||
#define setf(x,...) snprintf(x,sizeof(x)-1,##__VA_ARGS__)
|
||||
|
||||
R_API void r_anal_hint_clear(RAnal *a) {
|
||||
sdb_reset (a->sdb_hints);
|
||||
|
@ -1090,8 +1090,14 @@ INST_HANDLER (reti) { // RETI
|
||||
|
||||
INST_HANDLER (rjmp) { // RJMP k
|
||||
op->jump = (op->addr
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("anal_avr.c: WARNING: Probably broken on windows")
|
||||
+ ((((( buf[1] & 0xf) << 9) | (buf[0] << 1)))
|
||||
| (buf[1] & 0x8 ? ~(0x1fff) : 0))
|
||||
#else
|
||||
+ ((((( (typeof (op->jump)) buf[1] & 0xf) << 9) | ((typeof (op->jump)) buf[0] << 1)))
|
||||
| (buf[1] & 0x8 ? ~((typeof (op->jump)) 0x1fff) : 0))
|
||||
#endif
|
||||
+ 2) & CPU_PC_MASK (cpu);
|
||||
ESIL_A ("%"PFMT64d",pc,=,", op->jump);
|
||||
}
|
||||
|
@ -8,8 +8,12 @@
|
||||
#define CAPSTONE_HAS_M68K 1
|
||||
#else
|
||||
#define CAPSTONE_HAS_M68K 0
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("Cannot find capstone-m68k support")
|
||||
#else
|
||||
#warning Cannot find capstone-m68k support
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CAPSTONE_HAS_M68K
|
||||
#include <capstone/m68k.h>
|
||||
|
@ -18,7 +18,7 @@ struct Getarg {
|
||||
int bits;
|
||||
};
|
||||
|
||||
#define esilprintf(op, fmt, arg...) r_strbuf_appendf (&op->esil, fmt, ##arg)
|
||||
#define esilprintf(op, fmt, ...) r_strbuf_appendf (&op->esil, fmt, ##__VA_ARGS__)
|
||||
#define INSOPS insn->detail->ppc.op_count
|
||||
#define INSOP(n) insn->detail->ppc.operands[n]
|
||||
#define IMM(x) (ut64)(insn->detail->ppc.operands[x].imm)
|
||||
|
@ -9,7 +9,7 @@
|
||||
#error Old Capstone not supported
|
||||
#endif
|
||||
|
||||
#define esilprintf(op, fmt, arg...) r_strbuf_setf (&op->esil, fmt, ##arg)
|
||||
#define esilprintf(op, fmt, ...) r_strbuf_setf (&op->esil, fmt, ##__VA_ARGS__)
|
||||
#define INSOP(n) insn->detail->sparc.operands[n]
|
||||
#define INSCC insn->detail->sparc.cc
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#error Old Capstone not supported
|
||||
#endif
|
||||
|
||||
#define esilprintf(op, fmt, arg...) r_strbuf_setf (&op->esil, fmt, ##arg)
|
||||
#define esilprintf(op, fmt, ...) r_strbuf_setf (&op->esil, fmt, ##__VA_ARGS__)
|
||||
#define INSOP(n) insn->detail->sysz.operands[n]
|
||||
|
||||
static void opex(RStrBuf *buf, csh handle, cs_insn *insn) {
|
||||
|
@ -32,8 +32,8 @@ call = 4
|
||||
#error Old Capstone not supported
|
||||
#endif
|
||||
|
||||
#define esilprintf(op, fmt, arg...) r_strbuf_setf (&op->esil, fmt, ##arg)
|
||||
#define opexprintf(op, fmt, arg...) r_strbuf_setf (&op->opex, fmt, ##arg)
|
||||
#define esilprintf(op, fmt, ...) r_strbuf_setf (&op->esil, fmt, ##__VA_ARGS__)
|
||||
#define opexprintf(op, fmt, ...) r_strbuf_setf (&op->opex, fmt, ##__VA_ARGS__)
|
||||
#define INSOP(n) insn->detail->x86.operands[n]
|
||||
#define INSOPS insn->detail->x86.op_count
|
||||
#define ISIMM(x) insn->detail->x86.operands[x].type == X86_OP_IMM
|
||||
|
@ -9,7 +9,7 @@
|
||||
#error Old Capstone not supported
|
||||
#endif
|
||||
|
||||
#define esilprintf(op, fmt, arg...) r_strbuf_setf (&op->esil, fmt, ##arg)
|
||||
#define esilprintf(op, fmt, ...) r_strbuf_setf (&op->esil, fmt, ##__VA_ARGS__)
|
||||
#define INSOP(n) insn->detail->xcore.operands[n]
|
||||
|
||||
static void opex(RStrBuf *buf, csh handle, cs_insn *insn) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "udis86/extern.h"
|
||||
/* This may be useful for other architectures */
|
||||
#define esilprintf(op, fmt, arg...) r_strbuf_setf (&op->esil, fmt, ##arg)
|
||||
#define esilprintf(op, fmt, ...) r_strbuf_setf (&op->esil, fmt, ##__VA_ARGS__)
|
||||
|
||||
#define UDIS86_ESIL_ARGUMENTS const UDis86OPInfo *info, RAnalOp *op, const char *dst, const char *src, const char *src2
|
||||
|
||||
@ -28,7 +28,7 @@ typedef struct udis86_esil_t {
|
||||
|
||||
#define UDIS86_ESIL_HANDLER(name) JOIN (JOIN (__x86_, name), _to_esil)
|
||||
#define UDIS86_ESIL_PROTO(name) void UDIS86_ESIL_HANDLER (name) (UDIS86_ESIL_ARGUMENTS)
|
||||
#define UDIS86_ESIL(name, fmt, arg...) UDIS86_ESIL_PROTO (name) { esilprintf (op, fmt, ##arg); }
|
||||
#define UDIS86_ESIL(name, fmt, ...) UDIS86_ESIL_PROTO (name) { esilprintf (op, fmt, ##__VA_ARGS__); }
|
||||
|
||||
UDis86Esil *udis86_esil_get_handler (enum ud_mnemonic_code);
|
||||
|
||||
|
@ -5,7 +5,7 @@ TARGET_GB=anal_gb.${EXT_SO}
|
||||
|
||||
ALL_TARGETS+=${TARGET_GB}
|
||||
|
||||
CFLAGS += -I arch/gb/
|
||||
CFLAGS += -Iarch/gb/
|
||||
|
||||
${TARGET_GB}: ${OBJ_GB}
|
||||
${CC} $(call libname,anal_gb) ${LDFLAGS} ${CFLAGS} \
|
||||
|
@ -16,10 +16,10 @@ struct VarType {
|
||||
|
||||
#define SDB_VARTYPE_FMT "czdz"
|
||||
|
||||
#define EXISTS(x, y ...) snprintf (key, sizeof (key) - 1, x, ## y), sdb_exists (DB, key)
|
||||
#define SETKEY(x, y ...) snprintf (key, sizeof (key) - 1, x, ## y);
|
||||
#define SETKEY2(x, y ...) snprintf (key2, sizeof (key) - 1, x, ## y);
|
||||
#define SETVAL(x, y ...) snprintf (val, sizeof (val) - 1, x, ## y);
|
||||
#define EXISTS(x, ...) snprintf (key, sizeof (key) - 1, x, ## __VA_ARGS__), sdb_exists (DB, key)
|
||||
#define SETKEY(x, ...) snprintf (key, sizeof (key) - 1, x, ## __VA_ARGS__);
|
||||
#define SETKEY2(x, ...) snprintf (key2, sizeof (key) - 1, x, ## __VA_ARGS__);
|
||||
#define SETVAL(x, ...) snprintf (val, sizeof (val) - 1, x, ## __VA_ARGS__);
|
||||
R_API bool r_anal_var_display(RAnal *anal, int delta, char kind, const char *type) {
|
||||
char *fmt = r_anal_type_format (anal, type);
|
||||
RRegItem *i;
|
||||
|
@ -32,6 +32,8 @@
|
||||
|
||||
#define INSNLEN 4
|
||||
|
||||
#define SIZE 128
|
||||
|
||||
/* Cached mapping symbol state. */
|
||||
enum map_type
|
||||
{
|
||||
@ -726,15 +728,12 @@ aarch64_ext_limm (const aarch64_operand *self ATTRIBUTE_UNUSED,
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (S)
|
||||
{
|
||||
case 0x00 ... 0x1f: /* 0xxxxx */ simd_size = 32; break;
|
||||
case 0x20 ... 0x2f: /* 10xxxx */ simd_size = 16; S &= 0xf; break;
|
||||
case 0x30 ... 0x37: /* 110xxx */ simd_size = 8; S &= 0x7; break;
|
||||
case 0x38 ... 0x3b: /* 1110xx */ simd_size = 4; S &= 0x3; break;
|
||||
case 0x3c ... 0x3d: /* 11110x */ simd_size = 2; S &= 0x1; break;
|
||||
default: return 0;
|
||||
}
|
||||
if (S >= 0x00 && S <= 0x1f) { simd_size = 32; }
|
||||
else if (S >= 0x20 && S <= 0x2f) { simd_size = 16; S &= 0xf; }
|
||||
else if (S >= 0x30 && S <= 0x37) { simd_size = 8; S &= 0x7; }
|
||||
else if (S >= 0x38 && S <= 0x3b) { simd_size = 4; S &= 0x3; }
|
||||
else if (S >= 0x3c && S <= 0x3d) { simd_size = 2; S &= 0x1; }
|
||||
else { return 0; }
|
||||
mask = (1ull << simd_size) - 1;
|
||||
/* Top bits are IGNORED. */
|
||||
R &= simd_size - 1;
|
||||
@ -2052,8 +2051,7 @@ print_operands (bfd_vma pc, const aarch64_opcode *opcode,
|
||||
int i, pcrel_p, num_printed;
|
||||
for (i = 0, num_printed = 0; i < AARCH64_MAX_OPND_NUM; ++i)
|
||||
{
|
||||
const size_t size = 128;
|
||||
char str[size];
|
||||
char str[SIZE];
|
||||
/* We regard the opcode operand info more, however we also look into
|
||||
the inst->operands to support the disassembling of the optional
|
||||
operand.
|
||||
@ -2064,7 +2062,7 @@ print_operands (bfd_vma pc, const aarch64_opcode *opcode,
|
||||
break;
|
||||
|
||||
/* Generate the operand string in STR. */
|
||||
aarch64_print_operand (str, size, pc, opcode, opnds, i, &pcrel_p,
|
||||
aarch64_print_operand (str, SIZE, pc, opcode, opnds, i, &pcrel_p,
|
||||
&info->target);
|
||||
|
||||
/* Print the delimiter (taking account of omitted operand(s)). */
|
||||
|
@ -35,8 +35,8 @@ const struct aarch64_operand aarch64_operands[] =
|
||||
{AARCH64_OPND_CLASS_INT_REG, "Rt_SYS", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rt}, "an integer register"},
|
||||
{AARCH64_OPND_CLASS_INT_REG, "Rd_SP", OPD_F_MAYBE_SP | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rd}, "an integer or stack pointer register"},
|
||||
{AARCH64_OPND_CLASS_INT_REG, "Rn_SP", OPD_F_MAYBE_SP | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rn}, "an integer or stack pointer register"},
|
||||
{AARCH64_OPND_CLASS_MODIFIED_REG, "Rm_EXT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an integer register with optional extension"},
|
||||
{AARCH64_OPND_CLASS_MODIFIED_REG, "Rm_SFT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an integer register with optional shift"},
|
||||
{AARCH64_OPND_CLASS_MODIFIED_REG, "Rm_EXT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an integer register with optional extension"},
|
||||
{AARCH64_OPND_CLASS_MODIFIED_REG, "Rm_SFT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an integer register with optional shift"},
|
||||
{AARCH64_OPND_CLASS_FP_REG, "Fd", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rd}, "a floating-point register"},
|
||||
{AARCH64_OPND_CLASS_FP_REG, "Fn", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rn}, "a floating-point register"},
|
||||
{AARCH64_OPND_CLASS_FP_REG, "Fm", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rm}, "a floating-point register"},
|
||||
@ -55,20 +55,20 @@ const struct aarch64_operand aarch64_operands[] =
|
||||
{AARCH64_OPND_CLASS_SIMD_ELEMENT, "En", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rn}, "a SIMD vector element"},
|
||||
{AARCH64_OPND_CLASS_SIMD_ELEMENT, "Em", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rm}, "a SIMD vector element"},
|
||||
{AARCH64_OPND_CLASS_SIMD_REGLIST, "LVn", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rn}, "a SIMD vector register list"},
|
||||
{AARCH64_OPND_CLASS_SIMD_REGLIST, "LVt", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a SIMD vector register list"},
|
||||
{AARCH64_OPND_CLASS_SIMD_REGLIST, "LVt_AL", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a SIMD vector register list"},
|
||||
{AARCH64_OPND_CLASS_SIMD_REGLIST, "LEt", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a SIMD vector element list"},
|
||||
{AARCH64_OPND_CLASS_SIMD_REGLIST, "LVt", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a SIMD vector register list"},
|
||||
{AARCH64_OPND_CLASS_SIMD_REGLIST, "LVt_AL", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a SIMD vector register list"},
|
||||
{AARCH64_OPND_CLASS_SIMD_REGLIST, "LEt", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a SIMD vector element list"},
|
||||
{AARCH64_OPND_CLASS_CP_REG, "Cn", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_CRn}, "a 4-bit opcode field named for historical reasons C0 - C15"},
|
||||
{AARCH64_OPND_CLASS_CP_REG, "Cm", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_CRm}, "a 4-bit opcode field named for historical reasons C0 - C15"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IDX", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm4}, "an immediate as the index of the least significant byte"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM_VLSL", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a left shift amount for an AdvSIMD register"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM_VLSR", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a right shift amount for an AdvSIMD register"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SIMD_IMM", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an immediate"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SIMD_IMM_SFT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an 8-bit unsigned immediate with optional shift"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SIMD_FPIMM", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an 8-bit floating-point constant"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SHLL_IMM", OPD_F_HAS_EXTRACTOR, {}, "an immediate shift amount of 8, 16 or 32"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM0", 0, {}, "0"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "FPIMM0", 0, {}, "0.0"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM_VLSL", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a left shift amount for an AdvSIMD register"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM_VLSR", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a right shift amount for an AdvSIMD register"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SIMD_IMM", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an immediate"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SIMD_IMM_SFT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an 8-bit unsigned immediate with optional shift"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SIMD_FPIMM", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an 8-bit floating-point constant"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "SHLL_IMM", OPD_F_HAS_EXTRACTOR, {0}, "an immediate shift amount of 8, 16 or 32"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM0", 0, {0}, "0"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "FPIMM0", 0, {0}, "0.0"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "FPIMM", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm8}, "an 8-bit floating-point constant"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMMR", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_immr}, "the right rotate amount"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMMS", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm6}, "the leftmost bit number to be moved from the source"},
|
||||
@ -86,30 +86,30 @@ const struct aarch64_operand aarch64_operands[] =
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "AIMM", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_shift,FLD_imm12}, "a 12-bit unsigned immediate with optional left shift of 12 bits"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "HALF", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm16}, "a 16-bit immediate with optional left shift"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "FBITS", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_scale}, "the number of bits after the binary point in the fixed-point value"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM_MOV", 0, {}, "an immediate"},
|
||||
{AARCH64_OPND_CLASS_NIL, "COND", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a condition"},
|
||||
{AARCH64_OPND_CLASS_IMMEDIATE, "IMM_MOV", 0, {0}, "an immediate"},
|
||||
{AARCH64_OPND_CLASS_NIL, "COND", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a condition"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_ADRP", OPD_F_SEXT | OPD_F_HAS_EXTRACTOR, {FLD_immhi, FLD_immlo}, "21-bit PC-relative address of a 4KB page"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_PCREL14", OPD_F_SEXT | OPD_F_SHIFT_BY_2 | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm14}, "14-bit PC-relative address"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_PCREL19", OPD_F_SEXT | OPD_F_SHIFT_BY_2 | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm19}, "19-bit PC-relative address"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_PCREL21", OPD_F_SEXT | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_immhi,FLD_immlo}, "21-bit PC-relative address"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_PCREL26", OPD_F_SEXT | OPD_F_SHIFT_BY_2 | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm26}, "26-bit PC-relative address"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_SIMPLE", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an address with base register (no offset)"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_REGOFF", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an address with register offset"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_SIMPLE", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an address with base register (no offset)"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_REGOFF", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an address with register offset"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_SIMM7", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm7,FLD_index2}, "an address with 7-bit signed immediate offset"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_SIMM9", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm9,FLD_index}, "an address with 9-bit signed immediate offset"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_SIMM9_2", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm9,FLD_index}, "an address with 9-bit negative or unaligned immediate offset"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "ADDR_UIMM12", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_Rn,FLD_imm12}, "an address with scaled, unsigned immediate offset"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "SIMD_ADDR_SIMPLE", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an address with base register (no offset)"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "SIMD_ADDR_POST", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a post-indexed address with immediate or register increment"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a system register"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "PSTATEFIELD", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a PSTATE field name"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_AT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an address translation operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_DC", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a data cache maintenance operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_IC", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an instructin cache maintenance operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_TLBI", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a TBL invalidation operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "BARRIER", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "a barrier option name"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "BARRIER_ISB", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "the ISB option name SY or an optional 4-bit unsigned immediate"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "PRFOP", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an prefetch operation specifier"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "SIMD_ADDR_SIMPLE", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an address with base register (no offset)"},
|
||||
{AARCH64_OPND_CLASS_ADDRESS, "SIMD_ADDR_POST", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a post-indexed address with immediate or register increment"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a system register"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "PSTATEFIELD", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a PSTATE field name"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_AT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an address translation operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_DC", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a data cache maintenance operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_IC", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an instructin cache maintenance operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "SYSREG_TLBI", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a TBL invalidation operation specifier"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "BARRIER", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "a barrier option name"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "BARRIER_ISB", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "the ISB option name SY or an optional 4-bit unsigned immediate"},
|
||||
{AARCH64_OPND_CLASS_SYSTEM, "PRFOP", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {0}, "an prefetch operation specifier"},
|
||||
{AARCH64_OPND_CLASS_NIL, "", 0, {0}, "DUMMY"},
|
||||
};
|
||||
|
||||
|
@ -2223,7 +2223,7 @@ static void
|
||||
print_register_offset_address (char *buf, size_t size,
|
||||
const aarch64_opnd_info *opnd)
|
||||
{
|
||||
const size_t tblen = 16;
|
||||
#define tblen 16
|
||||
char tb[tblen]; /* Temporary buffer. */
|
||||
bfd_boolean lsl_p = FALSE; /* Is LSL shift operator? */
|
||||
bfd_boolean wm_p = FALSE; /* Should Rm be Wm? */
|
||||
@ -2266,6 +2266,7 @@ print_register_offset_address (char *buf, size_t size,
|
||||
snprintf (buf, size, "[%s,%c%d%s]",
|
||||
get_64bit_int_reg_name (opnd->addr.base_regno, 1),
|
||||
wm_p ? 'w' : 'x', opnd->addr.offset.regno, tb);
|
||||
#undef tblen
|
||||
}
|
||||
|
||||
/* Generate the string representation of the operand OPNDS[IDX] for OPCODE
|
||||
|
@ -24,7 +24,7 @@
|
||||
/* Operand type. */
|
||||
|
||||
#define OPND(x) AARCH64_OPND_##x
|
||||
#define OP0() {}
|
||||
#define OP0() { 0 }
|
||||
#define OP1(a) {OPND(a)}
|
||||
#define OP2(a,b) {OPND(a), OPND(b)}
|
||||
#define OP3(a,b,c) {OPND(a), OPND(b), OPND(c)}
|
||||
@ -1766,8 +1766,8 @@ struct aarch64_opcode aarch64_opcode_table[] =
|
||||
{"br", 0xd61f0000, 0xfffffc1f, branch_reg, 0, CORE, OP1 (Rn), QL_I1X, 0},
|
||||
{"blr", 0xd63f0000, 0xfffffc1f, branch_reg, 0, CORE, OP1 (Rn), QL_I1X, 0},
|
||||
{"ret", 0xd65f0000, 0xfffffc1f, branch_reg, 0, CORE, OP1 (Rn), QL_I1X, F_OPD0_OPT | F_DEFAULT (30)},
|
||||
{"eret", 0xd69f03e0, 0xffffffff, branch_reg, 0, CORE, OP0 (), {}, 0},
|
||||
{"drps", 0xd6bf03e0, 0xffffffff, branch_reg, 0, CORE, OP0 (), {}, 0},
|
||||
{"eret", 0xd69f03e0, 0xffffffff, branch_reg, 0, CORE, OP0 (), { 0 }, 0},
|
||||
{"drps", 0xd6bf03e0, 0xffffffff, branch_reg, 0, CORE, OP0 (), { 0 }, 0},
|
||||
/* Compare & branch (immediate). */
|
||||
{"cbz", 0x34000000, 0x7f000000, compbranch, 0, CORE, OP2 (Rt, ADDR_PCREL19), QL_R_PCREL, F_SF},
|
||||
{"cbnz", 0x35000000, 0x7f000000, compbranch, 0, CORE, OP2 (Rt, ADDR_PCREL19), QL_R_PCREL, F_SF},
|
||||
@ -1850,14 +1850,14 @@ struct aarch64_opcode aarch64_opcode_table[] =
|
||||
{"umnegl", 0x9ba0fc00, 0xffe0fc00, dp_3src, 0, CORE, OP3 (Rd, Rn, Rm), QL_I3SAMEL, F_ALIAS},
|
||||
{"umulh", 0x9bc07c00, 0xffe08000, dp_3src, 0, CORE, OP3 (Rd, Rn, Rm), QL_I3SAMEX, 0},
|
||||
/* Excep'n generation. */
|
||||
{"svc", 0xd4000001, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, 0},
|
||||
{"hvc", 0xd4000002, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, 0},
|
||||
{"smc", 0xd4000003, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, 0},
|
||||
{"brk", 0xd4200000, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, 0},
|
||||
{"hlt", 0xd4400000, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, 0},
|
||||
{"dcps1", 0xd4a00001, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, F_OPD0_OPT | F_DEFAULT (0)},
|
||||
{"dcps2", 0xd4a00002, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, F_OPD0_OPT | F_DEFAULT (0)},
|
||||
{"dcps3", 0xd4a00003, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), {}, F_OPD0_OPT | F_DEFAULT (0)},
|
||||
{"svc", 0xd4000001, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, 0},
|
||||
{"hvc", 0xd4000002, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, 0},
|
||||
{"smc", 0xd4000003, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, 0},
|
||||
{"brk", 0xd4200000, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, 0},
|
||||
{"hlt", 0xd4400000, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, 0},
|
||||
{"dcps1", 0xd4a00001, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, F_OPD0_OPT | F_DEFAULT (0)},
|
||||
{"dcps2", 0xd4a00002, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, F_OPD0_OPT | F_DEFAULT (0)},
|
||||
{"dcps3", 0xd4a00003, 0xffe0001f, exception, 0, CORE, OP1 (EXCEPTION), { 0 }, F_OPD0_OPT | F_DEFAULT (0)},
|
||||
/* Extract. */
|
||||
{"extr", 0x13800000, 0x7fa00000, extract, 0, CORE, OP4 (Rd, Rn, Rm, IMMS), QL_EXTR, F_HAS_ALIAS | F_SF | F_N},
|
||||
{"ror", 0x13800000, 0x7fa00000, extract, OP_ROR_IMM, CORE, OP3 (Rd, Rm, IMMS), QL_SHIFT, F_ALIAS | F_CONV},
|
||||
@ -2072,18 +2072,18 @@ struct aarch64_opcode aarch64_opcode_table[] =
|
||||
{"adr", 0x10000000, 0x9f000000, pcreladdr, 0, CORE, OP2 (Rd, ADDR_PCREL21), QL_ADRP, 0},
|
||||
{"adrp", 0x90000000, 0x9f000000, pcreladdr, 0, CORE, OP2 (Rd, ADDR_ADRP), QL_ADRP, 0},
|
||||
/* System. */
|
||||
{"msr", 0xd500401f, 0xfff8f01f, ic_system, 0, CORE, OP2 (PSTATEFIELD, UIMM4), {}, 0},
|
||||
{"hint", 0xd503201f, 0xfffff01f, ic_system, 0, CORE, OP1 (UIMM7), {}, F_HAS_ALIAS},
|
||||
{"nop", 0xd503201f, 0xffffffff, ic_system, 0, CORE, OP0 (), {}, F_ALIAS},
|
||||
{"yield", 0xd503203f, 0xffffffff, ic_system, 0, CORE, OP0 (), {}, F_ALIAS},
|
||||
{"wfe", 0xd503205f, 0xffffffff, ic_system, 0, CORE, OP0 (), {}, F_ALIAS},
|
||||
{"wfi", 0xd503207f, 0xffffffff, ic_system, 0, CORE, OP0 (), {}, F_ALIAS},
|
||||
{"sev", 0xd503209f, 0xffffffff, ic_system, 0, CORE, OP0 (), {}, F_ALIAS},
|
||||
{"sevl", 0xd50320bf, 0xffffffff, ic_system, 0, CORE, OP0 (), {}, F_ALIAS},
|
||||
{"clrex", 0xd503305f, 0xfffff0ff, ic_system, 0, CORE, OP1 (UIMM4), {}, F_OPD0_OPT | F_DEFAULT (0xF)},
|
||||
{"dsb", 0xd503309f, 0xfffff0ff, ic_system, 0, CORE, OP1 (BARRIER), {}, 0},
|
||||
{"dmb", 0xd50330bf, 0xfffff0ff, ic_system, 0, CORE, OP1 (BARRIER), {}, 0},
|
||||
{"isb", 0xd50330df, 0xfffff0ff, ic_system, 0, CORE, OP1 (BARRIER_ISB), {}, F_OPD0_OPT | F_DEFAULT (0xF)},
|
||||
{"msr", 0xd500401f, 0xfff8f01f, ic_system, 0, CORE, OP2 (PSTATEFIELD, UIMM4), { 0 }, 0},
|
||||
{"hint", 0xd503201f, 0xfffff01f, ic_system, 0, CORE, OP1 (UIMM7), { 0 }, F_HAS_ALIAS},
|
||||
{"nop", 0xd503201f, 0xffffffff, ic_system, 0, CORE, OP0 (), { 0 }, F_ALIAS},
|
||||
{"yield", 0xd503203f, 0xffffffff, ic_system, 0, CORE, OP0 (), { 0 }, F_ALIAS},
|
||||
{"wfe", 0xd503205f, 0xffffffff, ic_system, 0, CORE, OP0 (), { 0 }, F_ALIAS},
|
||||
{"wfi", 0xd503207f, 0xffffffff, ic_system, 0, CORE, OP0 (), { 0 }, F_ALIAS},
|
||||
{"sev", 0xd503209f, 0xffffffff, ic_system, 0, CORE, OP0 (), { 0 }, F_ALIAS},
|
||||
{"sevl", 0xd50320bf, 0xffffffff, ic_system, 0, CORE, OP0 (), { 0 }, F_ALIAS},
|
||||
{"clrex", 0xd503305f, 0xfffff0ff, ic_system, 0, CORE, OP1 (UIMM4), { 0 }, F_OPD0_OPT | F_DEFAULT (0xF)},
|
||||
{"dsb", 0xd503309f, 0xfffff0ff, ic_system, 0, CORE, OP1 (BARRIER), { 0 }, 0},
|
||||
{"dmb", 0xd50330bf, 0xfffff0ff, ic_system, 0, CORE, OP1 (BARRIER), { 0 }, 0},
|
||||
{"isb", 0xd50330df, 0xfffff0ff, ic_system, 0, CORE, OP1 (BARRIER_ISB), { 0 }, F_OPD0_OPT | F_DEFAULT (0xF)},
|
||||
{"sys", 0xd5080000, 0xfff80000, ic_system, 0, CORE, OP5 (UIMM3_OP1, Cn, Cm, UIMM3_OP2, Rt), QL_SYS, F_HAS_ALIAS | F_OPD4_OPT | F_DEFAULT (0x1F)},
|
||||
{"at", 0xd5080000, 0xfff80000, ic_system, 0, CORE, OP2 (SYSREG_AT, Rt), QL_SRC_X, F_ALIAS},
|
||||
{"dc", 0xd5080000, 0xfff80000, ic_system, 0, CORE, OP2 (SYSREG_DC, Rt), QL_SRC_X, F_ALIAS},
|
||||
@ -2113,7 +2113,7 @@ struct aarch64_opcode aarch64_opcode_table[] =
|
||||
{"bgt", 0x5400000c, 0xff00001f, condbranch, 0, CORE, OP1 (ADDR_PCREL19), QL_PCREL_NIL, F_ALIAS | F_PSEUDO},
|
||||
{"ble", 0x5400000d, 0xff00001f, condbranch, 0, CORE, OP1 (ADDR_PCREL19), QL_PCREL_NIL, F_ALIAS | F_PSEUDO},
|
||||
|
||||
{0, 0, 0, 0, 0, 0, {}, {}, 0},
|
||||
{0, 0, 0, 0, 0, 0, { 0 }, { 0 }, 0},
|
||||
};
|
||||
|
||||
#ifdef AARCH64_OPERANDS
|
||||
|
@ -436,4 +436,8 @@ extern int print_insn_tricore (bfd_vma memaddr, struct disassemble_info *info);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#undef xmalloc
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (DIS_ASM_H) */
|
||||
|
@ -1022,3 +1022,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
|
||||
(*info->fprintf_func) (stream, _("unknown"));
|
||||
return sizeof (buffer);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#undef xmalloc
|
||||
#endif
|
||||
|
@ -217,17 +217,25 @@ typedef struct {
|
||||
#define field_value(d, name) \
|
||||
(d)->f.bf_##name##_value
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define set_field_value(d, name, value) \
|
||||
{ \
|
||||
field_valid(d, name) = 1; \
|
||||
field_value(d, name) = value; \
|
||||
}
|
||||
#else
|
||||
#define set_field_value(d, name, value) \
|
||||
({ \
|
||||
field_valid(d, name) = 1; \
|
||||
field_value(d, name) = value; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define LIST_END { 0 }
|
||||
|
||||
#define INSN_MASK(af, an, av) { .f = af, .n = an, .v = av }
|
||||
#define INSN_FLAG(af, av) { .f = af, .v = TMS320_FLAG_##av }
|
||||
#define INSN_SYNTAX(arg...) (char *)#arg
|
||||
#define INSN_SYNTAX(...) (char *)#__VA_ARGS__
|
||||
|
||||
extern int tms320_dasm(tms320_dasm_t *, const ut8 *, int);
|
||||
|
||||
|
@ -10,8 +10,10 @@ struct instruction {
|
||||
in_reg:2,
|
||||
in_opcode:4,
|
||||
in_operand:8;
|
||||
#if __sun
|
||||
#if __sun || defined(_MSC_VER)
|
||||
#ifndef _MSC_VER
|
||||
#warning XXX related to sunstudio :O
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
} __packed;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "dis-asm.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bfdlink.h"
|
||||
|
@ -3824,7 +3824,7 @@ static xtensa_regfile_internal regfiles[] = {
|
||||
/* Interfaces. */
|
||||
|
||||
static xtensa_interface_internal interfaces[] = {
|
||||
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
||||
|
@ -4,7 +4,11 @@ include ../../../mk/platform.mk
|
||||
CFLAGS+=-I$(TOP)/shlr -I../../include -I../arch/ -I../arch/include
|
||||
CFLAGS+=-Wall -shared ${PIC_CFLAGS} ${LDFLAGS_LIB} ${LDFLAGS_LINKPATH}..
|
||||
LDFLAGS+=-L../../util -L../../lib -L../../flag
|
||||
ifeq ($(CC),cccl)
|
||||
LDFLAGS+=${LINK} -llibr_flag -llibr_util
|
||||
else
|
||||
LDFLAGS+=${LINK} -lr_flag -lr_util
|
||||
endif
|
||||
|
||||
CURDIR=
|
||||
|
||||
|
@ -8,8 +8,12 @@
|
||||
#define CAPSTONE_HAS_M68K 1
|
||||
#else
|
||||
#define CAPSTONE_HAS_M68K 0
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("Cannot find capstone-m68k support")
|
||||
#else
|
||||
#warning Cannot find capstone-m68k support
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CAPSTONE_HAS_M68K
|
||||
|
||||
|
@ -71,7 +71,7 @@ static int tms320c64x_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len)
|
||||
|
||||
#include "../arch/tms320/tms320_dasm.h"
|
||||
|
||||
static tms320_dasm_t engine = { };
|
||||
static tms320_dasm_t engine = { 0 };
|
||||
|
||||
static int tms320_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
if (a->cpu && strcasecmp (a->cpu, "c54x") == 0) {
|
||||
|
@ -172,7 +172,6 @@ struct coff_symbol {
|
||||
ut8 n_numaux; /* Auxiliary Count */
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
struct coff_reloc {
|
||||
ut32 r_vaddr; /* Reference Address */
|
||||
ut32 r_symndx; /* Symbol index */
|
||||
|
@ -345,7 +345,7 @@ static int init_strtab(ELFOBJ *bin) {
|
||||
|
||||
static int init_dynamic_section(struct Elf_(r_bin_elf_obj_t) *bin) {
|
||||
Elf_(Dyn) *dyn = NULL;
|
||||
Elf_(Dyn) d = {};
|
||||
Elf_(Dyn) d = {0};
|
||||
Elf_(Addr) strtabaddr = 0;
|
||||
ut64 offset = 0;
|
||||
char *strtab = NULL;
|
||||
@ -731,7 +731,7 @@ static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
||||
char *vstart = ((char*)defs) + i;
|
||||
char key[32] = {0};
|
||||
Elf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;
|
||||
Elf_(Verdaux) aux = {};
|
||||
Elf_(Verdaux) aux = {0};
|
||||
int j = 0;
|
||||
int isum = 0;
|
||||
|
||||
@ -863,7 +863,7 @@ static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
||||
for (i = 0, cnt = 0; cnt < shdr->sh_info; ++cnt) {
|
||||
int j, isum;
|
||||
ut8 *vstart = need + i;
|
||||
Elf_(Verneed) vvn = {};
|
||||
Elf_(Verneed) vvn = {0};
|
||||
if (vstart + sizeof (Elf_(Verneed)) > end) {
|
||||
goto beach;
|
||||
}
|
||||
@ -895,7 +895,7 @@ static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
|
||||
for (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) {
|
||||
int k;
|
||||
Elf_(Vernaux) * aux = NULL;
|
||||
Elf_(Vernaux) vaux = {};
|
||||
Elf_(Vernaux) vaux = {0};
|
||||
sdb_vernaux = sdb_new0 ();
|
||||
if (!sdb_vernaux) {
|
||||
goto beach;
|
||||
|
@ -541,10 +541,10 @@ static bool parse_signature(struct MACH0_(obj_t) *bin, ut64 off) {
|
||||
int i,len;
|
||||
ut32 data;
|
||||
bin->signature = NULL;
|
||||
struct linkedit_data_command link = {};
|
||||
struct linkedit_data_command link = {0};
|
||||
ut8 lit[sizeof (struct linkedit_data_command)] = {0};
|
||||
struct blob_index_t idx = {};
|
||||
struct super_blob_t super = {};
|
||||
struct blob_index_t idx = {0};
|
||||
struct super_blob_t super = {0};
|
||||
|
||||
if (off > bin->size || off + sizeof (struct linkedit_data_command) > bin->size) {
|
||||
return false;
|
||||
@ -585,7 +585,7 @@ static bool parse_signature(struct MACH0_(obj_t) *bin, ut64 off) {
|
||||
bin->signature = (ut8 *)strdup ("Malformed entitlement");
|
||||
break;
|
||||
}
|
||||
struct blob_t entitlements = {};
|
||||
struct blob_t entitlements = {0};
|
||||
entitlements.magic = r_read_ble32 (bin->b->buf + off, little_);
|
||||
entitlements.length = r_read_ble32 (bin->b->buf + off + 4, little_);
|
||||
len = entitlements.length - sizeof(struct blob_t);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <r_types.h>
|
||||
#include <r_util.h>
|
||||
#include "pe.h"
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#define PE_IMAGE_FILE_MACHINE_RPI2 452
|
||||
|
@ -645,7 +645,9 @@ extern void setproctitle (const char *name, ...);
|
||||
USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is
|
||||
also set/unset as it is often used to indicate whether code needs
|
||||
to call alloca(0). */
|
||||
#ifndef _MSC_VER
|
||||
extern void *C_alloca (size_t) ATTRIBUTE_MALLOC;
|
||||
#endif
|
||||
#undef alloca
|
||||
#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
|
||||
# define alloca(x) __builtin_alloca(x)
|
||||
@ -656,7 +658,11 @@ extern void *C_alloca (size_t) ATTRIBUTE_MALLOC;
|
||||
char *const libiberty_nptr = (char *const) alloca (libiberty_len); \
|
||||
(char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); }))
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
# define alloca(x) _alloca(x)
|
||||
#else
|
||||
# define alloca(x) C_alloca(x)
|
||||
#endif
|
||||
# undef USE_C_ALLOCA
|
||||
# define USE_C_ALLOCA 1
|
||||
# undef C_ALLOCA
|
||||
|
@ -2,9 +2,15 @@ include ../../config.mk
|
||||
include ../../../mk/platform.mk
|
||||
|
||||
CFLAGS+=-I$(LTOP)/include -I$(LTOP)/bin/format/ -Wall $(PIC_CFLAGS)
|
||||
ifeq ($(CC),cccl)
|
||||
LDFLAGS+=-L$(LTOP)/util -llibr_util
|
||||
LDFLAGS+=-L$(LTOP)/bin -llibr_bin
|
||||
LDFLAGS+=-L$(LTOP)/io -llibr_io
|
||||
else
|
||||
LDFLAGS+=-L$(LTOP)/util -lr_util
|
||||
LDFLAGS+=-L$(LTOP)/bin -lr_bin
|
||||
LDFLAGS+=-L$(LTOP)/io -lr_io
|
||||
endif
|
||||
SHLR=$(LTOP)/../shlr
|
||||
|
||||
foo: all
|
||||
|
@ -8,6 +8,12 @@ ALL_TARGETS+=${TARGET_ANY}
|
||||
include $(SHLR)/zip/deps.mk
|
||||
|
||||
${TARGET_ANY}: ${OBJ_ANY}
|
||||
ifeq ($(CC),cccl)
|
||||
${CC} $(call libname,bin_any) $(DL_LIBS) ${CFLAGS} $(OBJ_ANY) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -llibr_magic \
|
||||
-L../../util -llibr_util
|
||||
else
|
||||
${CC} $(call libname,bin_any) $(DL_LIBS) ${CFLAGS} $(OBJ_ANY) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -lr_magic \
|
||||
-L../../util -lr_util
|
||||
endif
|
||||
|
@ -7,15 +7,15 @@ TARGET_BFLT=bin_bflt.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_BFLT}
|
||||
|
||||
ifeq ($(WITHNONPIC),1)
|
||||
LINK+=../../io/libr_io.a
|
||||
LINK+=../../util/libr_util.a
|
||||
LINK+=../../magic/libr_magic.a
|
||||
LINK+=../../socket/libr_socket.a
|
||||
LINK+=../../../shlr/gdb/lib/libgdbr.a
|
||||
LINK+=../../../shlr/wind/libr_wind.a
|
||||
LINK+=../../../shlr/qnx/lib/libqnxr.a
|
||||
LINK+=../../../shlr/bochs/lib/libbochs.a
|
||||
LINK+=../../../shlr/java/libr_java.a
|
||||
LINK+=../../io/libr_io.${EXT_AR}
|
||||
LINK+=../../util/libr_util.${EXT_AR}
|
||||
LINK+=../../magic/libr_magic.${EXT_AR}
|
||||
LINK+=../../socket/libr_socket.${EXT_AR}
|
||||
LINK+=../../../shlr/gdb/lib/libgdbr.${EXT_AR}
|
||||
LINK+=../../../shlr/wind/libr_wind.${EXT_AR}
|
||||
LINK+=../../../shlr/qnx/lib/libqnxr.${EXT_AR}
|
||||
LINK+=../../../shlr/bochs/lib/libbochs.${EXT_AR}
|
||||
LINK+=../../../shlr/java/libr_java.${EXT_AR}
|
||||
endif
|
||||
|
||||
${TARGET_BFLT}: ${OBJ_BFLT}
|
||||
|
@ -5,7 +5,11 @@
|
||||
#include <r_lib.h>
|
||||
#include <r_bin.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef struct art_header_t {
|
||||
#else
|
||||
typedef struct __packed art_header_t {
|
||||
#endif
|
||||
ut8 magic[4];
|
||||
ut8 version[4];
|
||||
ut32 image_base;
|
||||
|
@ -428,6 +428,7 @@ static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,
|
||||
if (register_num >= regsz) {
|
||||
r_list_free (debug_positions);
|
||||
free (params);
|
||||
free (debug_locals);
|
||||
return;
|
||||
}
|
||||
// Emit what was previously there, if anything
|
||||
@ -469,6 +470,7 @@ static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,
|
||||
if (register_num >= regsz) {
|
||||
r_list_free (debug_positions);
|
||||
free (params);
|
||||
free (debug_locals);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -506,6 +508,7 @@ static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,
|
||||
if (register_num >= regsz) {
|
||||
r_list_free (debug_positions);
|
||||
free (params);
|
||||
free (debug_locals);
|
||||
return;
|
||||
}
|
||||
if (debug_locals[register_num].live) {
|
||||
@ -534,6 +537,7 @@ static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,
|
||||
if (register_num >= regsz) {
|
||||
r_list_free (debug_positions);
|
||||
free (params);
|
||||
free (debug_locals);
|
||||
return;
|
||||
}
|
||||
if (!debug_locals[register_num].live) {
|
||||
@ -593,6 +597,7 @@ static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,
|
||||
if (!dexdump) {
|
||||
free (debug_positions);
|
||||
free (emitted_debug_locals);
|
||||
free (debug_locals);
|
||||
free (params);
|
||||
return;
|
||||
}
|
||||
|
@ -86,10 +86,17 @@ static RList* sections(RBinFile *arch){
|
||||
|
||||
r_buf_read_at (arch->buf, 0x148, &bank, 1);
|
||||
bank = gb_get_rombanks(bank);
|
||||
#ifdef _MSC_VER
|
||||
RBinSection **rombank = (RBinSection**) malloc (sizeof (RBinSection*) * bank);
|
||||
#else
|
||||
RBinSection *rombank[bank];
|
||||
#endif
|
||||
|
||||
if (!arch->buf) {
|
||||
free (ret);
|
||||
#ifdef _MSC_VER
|
||||
free (rombank);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -116,6 +123,9 @@ static RList* sections(RBinFile *arch){
|
||||
rombank[i]->add = true;
|
||||
r_list_append (ret,rombank[i]);
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
free (rombank);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,10 @@ static RList *mem(RBinFile *arch) {
|
||||
}
|
||||
|
||||
static RList* sections(RBinFile* arch) {
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("Windows: WARNING: vsf_sections bypassed !")
|
||||
return NULL;
|
||||
#else
|
||||
struct r_bin_vsf_obj* vsf_obj = (struct r_bin_vsf_obj*) arch->o->bin_obj;
|
||||
if (!vsf_obj) {
|
||||
return NULL;
|
||||
@ -292,6 +296,7 @@ static RList* sections(RBinFile* arch) {
|
||||
}
|
||||
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
static RBinInfo* info(RBinFile *arch) {
|
||||
@ -494,8 +499,12 @@ static RList* symbols(RBinFile *arch) {
|
||||
strncpy (ptr->name, _symbols[i].symbol_name, R_BIN_SIZEOF_STRINGS);
|
||||
ptr->vaddr = _symbols[i].address;
|
||||
ptr->size = 2;
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("Windows: WARNING (TODO): vsf symbols bypassed")
|
||||
#else
|
||||
ptr->paddr = (vsf_obj->mem + offset) - (void *)arch->buf->buf +
|
||||
_symbols[i].address;
|
||||
#endif
|
||||
ptr->ordinal = i;
|
||||
r_list_append (ret, ptr);
|
||||
}
|
||||
@ -523,7 +532,11 @@ static RList* entries(RBinFile *arch) {
|
||||
if (!(ptr = R_NEW0 (RBinAddr))) {
|
||||
return ret;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("Windows: WARNING (TODO): vsf entries bypassed")
|
||||
#else
|
||||
ptr->paddr = (vsf_obj->mem + offset) - (void*) arch->buf->buf;
|
||||
#endif
|
||||
ptr->vaddr = vsf_obj->maincpu ? vsf_obj->maincpu->pc : 0;
|
||||
r_list_append (ret, ptr);
|
||||
|
||||
|
@ -6,5 +6,10 @@ TARGET_DOLPHIN=bin_dol.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_DOLPHIN}
|
||||
|
||||
${TARGET_DOLPHIN}: ${OBJ_DOLPHIN}
|
||||
ifeq ($(CC),cccl)
|
||||
${CC} $(call libname,bin_dol) ${CFLAGS} $(OBJ_DOLPHIN) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -llibr_magic
|
||||
else
|
||||
${CC} $(call libname,bin_dol) ${CFLAGS} $(OBJ_DOLPHIN) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -lr_magic
|
||||
endif
|
||||
|
@ -6,5 +6,10 @@ TARGET_NIN3DS=bin_nin3ds.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_NIN3DS}
|
||||
|
||||
${TARGET_NIN3DS}: ${OBJ_NIN3DS}
|
||||
ifeq ($(CC),cccl)
|
||||
${CC} $(call libname,bin_nin3ds) ${CFLAGS} $(OBJ_NIN3DS) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -llibr_magic
|
||||
else
|
||||
${CC} $(call libname,bin_nin3ds) ${CFLAGS} $(OBJ_NIN3DS) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -lr_magic
|
||||
endif
|
||||
|
@ -6,5 +6,10 @@ TARGET_NINDS=bin_ninds.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_NINDS}
|
||||
|
||||
${TARGET_NINDS}: ${OBJ_NINDS}
|
||||
ifeq ($(CC),cccl)
|
||||
${CC} $(call libname,bin_ninds) ${CFLAGS} $(OBJ_NINDS) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -llibr_magic
|
||||
else
|
||||
${CC} $(call libname,bin_ninds) ${CFLAGS} $(OBJ_NINDS) $(LINK) $(LDFLAGS) \
|
||||
-L../../magic -lr_magic
|
||||
endif
|
||||
|
@ -6,5 +6,6 @@ TARGET_VSF=bin_vsf.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_VSF}
|
||||
|
||||
${TARGET_VSF}: ${OBJ_VSF}
|
||||
echo "FUCKOFF"
|
||||
${CC} $(call libname,bin_vsf) -shared ${CFLAGS} \
|
||||
-o ${TARGET_VSF} ${OBJ_VSF} $(LINK) $(LDFLAGS)
|
||||
|
@ -6,6 +6,7 @@ ifeq ($(R2DIR),)
|
||||
$(error ERROR: Cannot find R2DIR. Please define this variable)
|
||||
else
|
||||
LIBR=$(R2DIR)/libr
|
||||
MSVC=$(R2DIR)/msvc
|
||||
endif
|
||||
endif
|
||||
SHLR:=$(LIBR)/../shlr
|
||||
|
@ -275,7 +275,7 @@ static int cmp(const void *a, const void *b) {
|
||||
const char *ca = r_str_chop_ro (a);
|
||||
const char *cb = r_str_chop_ro (b);
|
||||
if (!a || !b) {
|
||||
return (int) (size_t) (a - b);
|
||||
return (int) (size_t) ((char*) a - (char*) b);
|
||||
}
|
||||
if (sorted_column > 0) {
|
||||
da = strdup (ca);
|
||||
|
@ -98,7 +98,11 @@ static bool strmatch(char *entry, char *filter, char* mask, const int mask_size)
|
||||
R_API char *r_cons_hud(RList *list, const char *prompt) {
|
||||
const int buf_size = 128;
|
||||
int ch, nch, first_line, current_entry_n, j, i = 0;
|
||||
char *p, *x, user_input[buf_size], mask[buf_size];
|
||||
char *p, *x;
|
||||
#ifdef _MSC_VER
|
||||
#define buf_size 128
|
||||
#endif
|
||||
char user_input[buf_size], mask[buf_size];
|
||||
int last_color_change, top_entry_n = 0;
|
||||
char *selected_entry = NULL;
|
||||
char tmp, last_mask = 0;
|
||||
|
@ -172,7 +172,11 @@ R_API char *r_cons_rgb_str (char *outstr, ut8 r, ut8 g, ut8 b, int is_bg) {
|
||||
|
||||
R_API void r_cons_rgb (ut8 r, ut8 g, ut8 b, int is_bg) {
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
#ifdef _MSC_VER
|
||||
#pragma message "r_cons_rgb not yet supported on windows"
|
||||
#else
|
||||
#warning r_cons_rgb not yet supported on windows
|
||||
#endif
|
||||
#else
|
||||
char outstr[64];
|
||||
r_cons_strcat (r_cons_rgb_str (outstr, r, g, b, is_bg));
|
||||
|
@ -850,7 +850,11 @@ R_API void r_core_anal_hint_print(RAnal* a, ut64 addr, int mode) {
|
||||
}
|
||||
|
||||
R_API void r_core_anal_hint_list(RAnal *a, int mode) {
|
||||
#ifdef _MSC_VER
|
||||
HintListState hls = {0};
|
||||
#else
|
||||
HintListState hls = {};
|
||||
#endif
|
||||
hls.mode = mode;
|
||||
hls.count = 0;
|
||||
hls.a = a;
|
||||
|
@ -637,12 +637,11 @@ static int cmd_interpret(void *data, const char *input) {
|
||||
r_core_cmd_help (core, help_msg);
|
||||
}
|
||||
break;
|
||||
#if 1
|
||||
case '0'...'9':
|
||||
default:
|
||||
if (*input >= 0 && *input <= 9) {
|
||||
eprintf ("|ERROR| No .[0..9] to avoid infinite loops\n");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
}
|
||||
inp = strdup (input);
|
||||
filter = strchr (inp, '~');
|
||||
if (filter) {
|
||||
@ -1255,7 +1254,11 @@ R_API int r_core_cmd_pipe(RCore *core, char *radare_cmd, char *shell_cmd) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("r_core_cmd_pipe UNIMPLEMENTED FOR THIS PLATFORM")
|
||||
#else
|
||||
#warning r_core_cmd_pipe UNIMPLEMENTED FOR THIS PLATFORM
|
||||
#endif
|
||||
eprintf ("r_core_cmd_pipe: unimplemented for this platform\n");
|
||||
#endif
|
||||
if (pipecolor != -1)
|
||||
|
@ -3251,7 +3251,7 @@ beach:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *get_corefile_name (const char *raw_name, pid_t pid) {
|
||||
static char *get_corefile_name (const char *raw_name, int pid) {
|
||||
return (!*raw_name)?
|
||||
r_str_newf ("core.%u", pid) :
|
||||
r_str_chop (strdup (raw_name));
|
||||
|
@ -1829,8 +1829,7 @@ static void chop_prompt (const char *filename, char *tmp, size_t max_tmp_size) {
|
||||
}
|
||||
|
||||
static void set_prompt (RCore *r) {
|
||||
size_t max_tmp_size = 128;
|
||||
char tmp[max_tmp_size];
|
||||
char tmp[128];
|
||||
char *prompt = NULL;
|
||||
char *filename = strdup ("");
|
||||
const char *cmdprompt = r_config_get (r->config, "cmd.prompt");
|
||||
@ -1864,7 +1863,7 @@ static void set_prompt (RCore *r) {
|
||||
|
||||
a = ((r->offset >> 16) << 12);
|
||||
b = (r->offset & 0xffff);
|
||||
snprintf (tmp, max_tmp_size, "%04x:%04x", a, b);
|
||||
snprintf (tmp, 128, "%04x:%04x", a, b);
|
||||
} else {
|
||||
char p[64], sec[32];
|
||||
int promptset = false;
|
||||
@ -1883,7 +1882,7 @@ static void set_prompt (RCore *r) {
|
||||
snprintf (tmp, sizeof (tmp), "%s%s", sec, p);
|
||||
}
|
||||
|
||||
chop_prompt (filename, tmp, max_tmp_size);
|
||||
chop_prompt (filename, tmp, 128);
|
||||
prompt = r_str_newf ("%s%s[%s%s]>%s ", filename, BEGIN, remote,
|
||||
tmp, END);
|
||||
r_line_set_prompt (prompt ? prompt : "");
|
||||
|
@ -927,7 +927,7 @@ R_API int r_core_visual_xrefs_X(RCore *core) {
|
||||
int skip = 0;
|
||||
int idx = 0;
|
||||
char cstr[32];
|
||||
const int maxcount = 9;
|
||||
#define maxcount 9
|
||||
ut64 references[maxcount];
|
||||
ut64 addr = core->offset;
|
||||
if (core->print->cur_enabled) {
|
||||
@ -1056,6 +1056,7 @@ repeat:
|
||||
eprintf ("TODO: sdbize xrefs here\n");
|
||||
#endif
|
||||
return ret;
|
||||
#undef maxcount
|
||||
}
|
||||
|
||||
#if __WINDOWS__ && !__CYGWIN__
|
||||
|
@ -30,7 +30,11 @@ static const ut8 Rcon[30] = {
|
||||
void aes_expkey (const struct aes_state *st, ut32 expkey[2][st->rounds + 1][Nb])
|
||||
#else
|
||||
// XXX this is wrong, but at least it compiles
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("AES broken for non-gcc compilers")
|
||||
#else
|
||||
#warning AES broken for non-gcc compilers
|
||||
#endif
|
||||
void aes_expkey (const struct aes_state *st, ut32 ***expkey)
|
||||
#endif
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ static bool rc6_init(struct rc6_state *const state, const ut8 *key, int keylen,
|
||||
int u = w / 8;
|
||||
int c = keylen / u;
|
||||
int t = 2 * r + 4;
|
||||
ut32 L[c];
|
||||
ut32 *L = (ut32*) calloc (c, sizeof (ut32));
|
||||
ut32 A = 0, B = 0, k = 0, j = 0;
|
||||
ut32 v = 3 * t; //originally v = 2 * ((c > t) ? c : t);
|
||||
|
||||
@ -55,13 +55,14 @@ static bool rc6_init(struct rc6_state *const state, const ut8 *key, int keylen,
|
||||
}
|
||||
|
||||
state->key_size = keylen/8;
|
||||
free (L);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void rc6_encrypt(struct rc6_state *const state, const ut8 *inbuf, ut8 *outbuf) {
|
||||
ut32 t, u;
|
||||
ut32 aux;
|
||||
ut32 data[BLOCK_SIZE/4];
|
||||
ut32 data[BLOCK_SIZE / 4];
|
||||
int i;
|
||||
int off = 0;
|
||||
for (i = 0; i < BLOCK_SIZE / 4; i++) {
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <r_anal.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#if DEBUGGER
|
||||
|
||||
@ -1589,7 +1588,11 @@ RDebugPlugin r_debug_plugin_native = {
|
||||
.bits = 0,
|
||||
.arch = 0,
|
||||
.canstep = 0,
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("Unsupported architecture")
|
||||
#else
|
||||
#warning Unsupported architecture
|
||||
#endif
|
||||
#endif
|
||||
.init = &r_debug_native_init,
|
||||
.step = &r_debug_native_step,
|
||||
|
@ -11,6 +11,11 @@
|
||||
#ifndef WINAPI
|
||||
#define WINAPI
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("WARNING: WINAPI: Temporary hack for windows...")
|
||||
#undef WINAPI
|
||||
#define WINAPI
|
||||
#endif
|
||||
|
||||
// XXX remove
|
||||
#define WIN32_PI(x) x
|
||||
@ -98,10 +103,12 @@ return (0);
|
||||
|
||||
//BOOL WINAPI DebugActiveProcessStop(DWORD dwProcessId);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
BOOL WINAPI DebugBreakProcess(
|
||||
HANDLE Process
|
||||
//_In_ HANDLE Process
|
||||
);
|
||||
#endif
|
||||
typedef struct _SYSTEM_HANDLE
|
||||
{
|
||||
ULONG ProcessId;
|
||||
@ -483,11 +490,10 @@ static char *get_file_name_from_handle (HANDLE handle_file) {
|
||||
}
|
||||
|
||||
/* Translate path with device name to drive letters. */
|
||||
int temp_size = 512;
|
||||
TCHAR temp_buffer[temp_size];
|
||||
TCHAR temp_buffer[512];
|
||||
temp_buffer[0] = '\0';
|
||||
|
||||
if (!GetLogicalDriveStrings (temp_size-1, temp_buffer)) {
|
||||
if (!GetLogicalDriveStrings (511, temp_buffer)) {
|
||||
free (filename);
|
||||
UnmapViewOfFile (map);
|
||||
CloseHandle (handle_file_map);
|
||||
@ -586,7 +592,7 @@ typedef struct {
|
||||
LPVOID lpThreadLocalBase;
|
||||
LPVOID lpStartAddress;
|
||||
PVOID lpThreadEntryPoint;
|
||||
DWORD dwExitCode
|
||||
DWORD dwExitCode;
|
||||
} THREAD_ITEM, *PTHREAD_ITEM;
|
||||
LPVOID lstThread = 0;
|
||||
PTHREAD_ITEM lstThreadPtr = 0;
|
||||
@ -1062,7 +1068,7 @@ static void printwincontext(HANDLE hThread, CONTEXT * ctx) {
|
||||
}
|
||||
}
|
||||
for (x = 0; x < 8; x++) {
|
||||
xmm[x] = (ut128)*((ut128 *)&ctx->ExtendedRegisters[(10 + x) * 16]);
|
||||
xmm[x] = *((ut128 *)&ctx->ExtendedRegisters[(10 + x) * 16]);
|
||||
}
|
||||
nxmm = 8;
|
||||
#endif
|
||||
|
0
libr/include/msvc/sys/time.h
Normal file
0
libr/include/msvc/sys/time.h
Normal file
2
libr/include/msvc/unistd.h
Normal file
2
libr/include/msvc/unistd.h
Normal file
@ -0,0 +1,2 @@
|
||||
/* This file is only included with mscv build */
|
||||
#include <io.h>
|
@ -12,7 +12,6 @@ extern "C" {
|
||||
#include <sdb.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@ -26,6 +25,7 @@ extern "C" {
|
||||
#include <windows.h>
|
||||
#include <wincon.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
/* constants */
|
||||
#define CONS_MAX_USER 102400
|
||||
|
@ -1,6 +1,11 @@
|
||||
#ifndef R2_SOCKET_H
|
||||
#define R2_SOCKET_H
|
||||
|
||||
/* Must be included before windows.h (r_types) */
|
||||
#if defined(__WINDOWS__) && !defined(__CYGWIN__) && !defined(MINGW32) && !defined(__MINGW64__)
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#include "r_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -24,10 +29,6 @@ R_LIB_VERSION_HEADER(r_socket);
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
#if defined(__WINDOWS__) && !defined(__CYGWIN__) && !defined(MINGW32) && !defined(__MINGW64__)
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#if __UNIX__ || defined(__CYGWIN__)
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
@ -54,7 +55,11 @@ typedef struct {
|
||||
} R2Pipe;
|
||||
|
||||
typedef struct r_socket_t {
|
||||
#ifdef _MSC_VER
|
||||
SOCKET fd;
|
||||
#else
|
||||
int fd;
|
||||
#endif
|
||||
int is_ssl;
|
||||
int local; // TODO: merge ssl with local -> flags/options
|
||||
int port;
|
||||
|
@ -81,6 +81,11 @@
|
||||
#define MINGW32 1
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* Useful for windows _CONTEXT structure declaration */
|
||||
#define _X86_
|
||||
#endif
|
||||
|
||||
#if defined(EMSCRIPTEN) || defined(__linux__) || defined(__APPLE__) || defined(__GNU__) || defined(__ANDROID__) || defined(__QNX__) || defined(__sun)
|
||||
#define __BSD__ 0
|
||||
#define __UNIX__ 1
|
||||
@ -89,18 +94,25 @@
|
||||
#define __BSD__ 1
|
||||
#define __UNIX__ 1
|
||||
#endif
|
||||
#if __WINDOWS__ || _WIN32 || __CYGWIN__ || MINGW32
|
||||
#define __addr_t_defined
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if __WINDOWS__ || _WIN32 || MINGW32 && !(__MINGW64__ || __CYGWIN__)
|
||||
#ifdef _MSC_VER
|
||||
/* Must be included before windows.h */
|
||||
#include <winsock2.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#else
|
||||
/* Deprecated */
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
typedef int socklen_t;
|
||||
#undef USE_SOCKETS
|
||||
#define __WINDOWS__ 1
|
||||
#undef __UNIX__
|
||||
#undef __BSD__
|
||||
#endif
|
||||
#if __WINDOWS__ || _WIN32 || __CYGWIN__ || MINGW32
|
||||
#define __addr_t_defined
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && (__arm__ || __arm64__ || __aarch64__)
|
||||
#define TARGET_OS_IPHONE 1
|
||||
@ -148,7 +160,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h> /* for O_RDONLY */
|
||||
#include <r_endian.h> /* needs size_t */
|
||||
|
||||
@ -288,11 +299,12 @@ static inline void *r_new_copy(int size, void *data) {
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_EPRINTF
|
||||
#define eprintf(x,y...) fprintf(stderr,x,##y)
|
||||
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
|
||||
#define eprint(x) fprintf(stderr,"%s\n",x)
|
||||
#define HAVE_EPRINTF 1
|
||||
#endif
|
||||
|
@ -14,6 +14,10 @@
|
||||
#define st8 signed char
|
||||
#define boolt int
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
typedef struct _ut80 {
|
||||
ut64 Low;
|
||||
ut16 High;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef SDB_H
|
||||
#define SDB_H
|
||||
|
||||
#ifndef O_BINARY
|
||||
#if !defined(O_BINARY) && !defined(_MSC_VER)
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
@ -29,7 +29,7 @@ extern "C" {
|
||||
#define SZT_ADD_OVFCHK(x, y) ((SIZE_MAX - (x)) <= (y))
|
||||
#endif
|
||||
|
||||
#if __SDB_WINDOWS__ && !__CYGWIN__
|
||||
#if __SDB_WINDOWS__ && !__CYGWIN__ && !_MSC_VER
|
||||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -6,9 +6,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef eprintf
|
||||
#define eprintf(x,y...) fprintf(stderr,x,##y)
|
||||
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
|
||||
|
||||
#ifndef SDB_API
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
@ -30,7 +31,7 @@
|
||||
#define __MINGW__ 1
|
||||
#endif
|
||||
|
||||
#if __WIN32__ || __MINGW__ || __WINDOWS__
|
||||
#if __WIN32__ || __MINGW__ || __WINDOWS__ || defined(_MSC_VER)
|
||||
#define __SDB_WINDOWS__ 1
|
||||
#include <windows.h>
|
||||
#define DIRSEP '\\'
|
||||
@ -40,8 +41,10 @@
|
||||
#define DIRSEP '/'
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#define ULLFMT "ll"
|
||||
|
||||
#if __SDB_WINDOWS__ && !__CYGWIN__
|
||||
#define HAVE_MMAN 0
|
||||
#else
|
||||
@ -52,7 +55,6 @@
|
||||
#define USE_MMAN HAVE_MMAN
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef UNUSED
|
||||
# define UNUSED
|
||||
|
@ -6,7 +6,6 @@ DEPS+=r_socket
|
||||
STATIC_OBJS=$(subst ..,p/..,$(subst io_,p/io_,$(STATIC_OBJ)))
|
||||
OBJS=${STATIC_OBJS}
|
||||
OBJS+=io.o plugin.o map.o section.o desc.o cache.o undo.o buffer.o
|
||||
|
||||
CFLAGS+=-Wall -DCORELIB
|
||||
|
||||
include ../socket/deps.mk
|
||||
|
@ -4,6 +4,10 @@
|
||||
#include "r_util.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "advapi32.lib")
|
||||
#endif
|
||||
|
||||
R_LIB_VERSION (r_io);
|
||||
|
||||
/* allocate 128 MB */
|
||||
|
@ -6,7 +6,7 @@ ALL_TARGETS+=${TARGET_BOCHS}
|
||||
|
||||
LIB_PATH=$(SHLR)/bochs/
|
||||
CFLAGS+=-I$(SHLR)/bochs/include/
|
||||
LDFLAGS+=$(SHLR)/bochs/lib/libbochs.a
|
||||
LDFLAGS+=$(SHLR)/bochs/lib/libbochs.$(EXT_AR)
|
||||
|
||||
include $(LIBR)/socket/deps.mk
|
||||
|
||||
|
@ -6,7 +6,7 @@ ALL_TARGETS+=${TARGET_GDB}
|
||||
|
||||
LIB_PATH=$(SHLR)/gdb/
|
||||
CFLAGS+=-I$(SHLR)/gdb/include/
|
||||
LDFLAGS+=$(SHLR)/gdb/lib/libgdbr.a
|
||||
LDFLAGS+=$(SHLR)/gdb/lib/libgdbr.$(EXT_AR)
|
||||
|
||||
include $(LIBR)/socket/deps.mk
|
||||
|
||||
|
@ -3,6 +3,9 @@
|
||||
#include <r_userconf.h>
|
||||
#include <r_io.h>
|
||||
#include <r_lib.h>
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned int ssize_t;
|
||||
#endif
|
||||
|
||||
typedef struct r_io_mmo_t {
|
||||
char * filename;
|
||||
|
@ -79,7 +79,20 @@ static int __read(RIO *io, RIODesc *fd, ut8 *buf, int count) {
|
||||
arr += 2;
|
||||
for (num[0] = numi = bufi = 0; bufi < count && *arr; arr++) {
|
||||
switch (*arr) {
|
||||
#ifdef _MSC_VER
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
#else
|
||||
case '0'...'9':
|
||||
#endif
|
||||
num[numi++] = *arr;
|
||||
num[numi] = 0;
|
||||
break;
|
||||
|
@ -110,8 +110,12 @@ static int update_self_regions(RIO *io, int pid) {
|
||||
fclose (fd);
|
||||
|
||||
return true;
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("Not yet implemented for this platform")
|
||||
#else
|
||||
#warning not yet implemented for this platform
|
||||
#endif
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@ -291,8 +295,12 @@ static int __system(RIO *io, RIODesc *fd, const char *cmd) {
|
||||
signal (SIGALRM, got_alarm);
|
||||
// TODO: use setitimer
|
||||
alarm (atoi (cmd + 6));
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("self:// alarm is not implemented for this platform yet")
|
||||
#else
|
||||
#warning "self:// alarm is not implemented for this platform yet"
|
||||
#endif
|
||||
#endif
|
||||
} else if (!strncmp (cmd, "dlsym ", 6)) {
|
||||
const char *symbol = cmd + 6;
|
||||
|
@ -6,7 +6,7 @@ ALL_TARGETS+=${TARGET_QNX}
|
||||
|
||||
LIB_PATH=$(SHLR)/qnx/
|
||||
CFLAGS+=-I$(SHLR)/qnx/include/
|
||||
LDFLAGS+=$(SHLR)/qnx/lib/libqnxr.a
|
||||
LDFLAGS+=$(SHLR)/qnx/lib/libqnxr.$(EXT_AR)
|
||||
|
||||
include $(LIBR)/socket/deps.mk
|
||||
|
||||
|
@ -6,7 +6,7 @@ ALL_TARGETS+=${TARGET_WINDBG}
|
||||
|
||||
LIB_PATH=$(SHLR)/wind
|
||||
CFLAGS+=-I$(SHLR)/wind
|
||||
LDFLAGS+=$(SHLR)/wind/libr_wind.a
|
||||
LDFLAGS+=$(SHLR)/wind/libr_wind.$(EXT_AR)
|
||||
|
||||
ifeq (${WITHPIC},0)
|
||||
LINKFLAGS+=../../util/libr_util.a
|
||||
|
@ -34,7 +34,11 @@
|
||||
#if !USE_LIB_MAGIC
|
||||
|
||||
#include <r_util.h>
|
||||
#ifdef _MSC_VER
|
||||
#define MAXPATHLEN 255
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#if __UNIX__
|
||||
#define QUICK 1
|
||||
@ -501,6 +505,10 @@ static void load_1(RMagic *ms, int action, const char *file, int *errs, struct r
|
||||
* const char *fn: name of magic file or directory
|
||||
*/
|
||||
static int apprentice_load(RMagic *ms, struct r_magic **magicp, ut32 *nmagicp, const char *fn, int action) {
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("WARNING: magic/apprentice.c:apprentice_load bypassed !")
|
||||
return 0;
|
||||
#else
|
||||
ut32 marraycount, i, mentrycount = 0, starttest;
|
||||
struct r_magic_entry *marray;
|
||||
struct stat st;
|
||||
@ -654,6 +662,7 @@ out:
|
||||
}
|
||||
*nmagicp = mentrycount;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -20,6 +20,10 @@
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#undef HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
// TODO: add dependency for zlib?
|
||||
/* #define HAVE_ZLIB_H 1 DO NOT ENABLE YET -- chl */
|
||||
/* #define HAVE_LIBZ 1 DO NOT ENABLE YET -- ian */
|
||||
|
@ -48,6 +48,9 @@
|
||||
/* Do this here and now, because struct stat gets re-defined on solaris */
|
||||
#include <sys/stat.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned int ssize_t;
|
||||
#endif
|
||||
|
||||
/* Type for Unicode characters */
|
||||
typedef unsigned long unichar;
|
||||
|
@ -90,10 +90,11 @@ R_API int r_magic_errno(RMagic* m) {
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/param.h> /* for MAXPATHLEN */
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <r_magic.h>
|
||||
|
||||
@ -139,6 +140,10 @@ static void free_mlist(struct mlist *mlist) {
|
||||
free (ml);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
static int info_from_stat(RMagic *ms, short int md) {
|
||||
#pragma message("TODO Windows: info_from_stat not supported.")
|
||||
#else
|
||||
static int info_from_stat(RMagic *ms, mode_t md) {
|
||||
/* We cannot open it, but we were able to stat it. */
|
||||
if (md & 0222)
|
||||
@ -152,6 +157,7 @@ static int info_from_stat(RMagic *ms, mode_t md) {
|
||||
return -1;
|
||||
if (file_printf (ms, "no read permission") == -1)
|
||||
return -1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -161,6 +167,10 @@ static void close_and_restore (const RMagic *ms, const char *name, int fd, const
|
||||
}
|
||||
|
||||
static const char *file_or_fd(RMagic *ms, const char *inname, int fd) {
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("WARNING: magic/magic.c: file_or_fd bypassed !")
|
||||
return 0;
|
||||
#else
|
||||
int ispipe = 0, rv = -1;
|
||||
unsigned char *buf;
|
||||
struct stat sb;
|
||||
@ -250,6 +260,7 @@ done:
|
||||
free (buf);
|
||||
close_and_restore (ms, inname, fd, &sb);
|
||||
return rv == 0 ? file_getbuffer(ms) : NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* API */
|
||||
|
@ -2,8 +2,13 @@ OBJ_6502PSEUDO+=parse_6502_pseudo.o
|
||||
|
||||
TARGET_6502PSEUDO=parse_6502_pseudo.${EXT_SO}
|
||||
STATIC_OBJ+=${OBJ_6502PSEUDO}
|
||||
ifeq ($(CC),cccl)
|
||||
LIBDEPS=-L../../util -llibr_util
|
||||
LIBDEPS+=-L../../flag -llibr_flag
|
||||
else
|
||||
LIBDEPS=-L../../util -lr_util
|
||||
LIBDEPS+=-L../../flag -lr_flag
|
||||
endif
|
||||
|
||||
ifeq ($(WITHPIC),1)
|
||||
ALL_TARGETS+=${TARGET_6502PSEUDO}
|
||||
|
@ -2,8 +2,13 @@ OBJ_ARMPSEUDO+=parse_arm_pseudo.o
|
||||
|
||||
TARGET_ARMPSEUDO=parse_arm_pseudo.${EXT_SO}
|
||||
STATIC_OBJ+=${OBJ_ARMPSEUDO}
|
||||
ifeq ($(CC),cccl)
|
||||
LIBDEPS=-L../../util -llibr_util
|
||||
LIBDEPS+=-L../../flag -llibr_flag
|
||||
else
|
||||
LIBDEPS=-L../../util -lr_util
|
||||
LIBDEPS+=-L../../flag -lr_flag
|
||||
endif
|
||||
|
||||
ifeq ($(WITHPIC),1)
|
||||
ALL_TARGETS+=${TARGET_ARMPSEUDO}
|
||||
|
@ -3,9 +3,15 @@ OBJ_M68KPSEUDO+=parse_m68k_pseudo.o
|
||||
TARGET_M68KPSEUDO=parse_m68k_pseudo.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_M68KPSEUDO}
|
||||
STATIC_OBJ+=${OBJ_M68KPSEUDO}
|
||||
ifeq ($(CC),cccl)
|
||||
LIBDEPS=-L../../util -llibr_util
|
||||
LIBDEPS+=-L../../flag -llibr_flag
|
||||
LIBDEPS+=$(STOP)/zip/librz.lib
|
||||
else
|
||||
LIBDEPS=-L../../util -lr_util
|
||||
LIBDEPS+=-L../../flag -lr_flag
|
||||
LIBDEPS+=$(STOP)/zip/librz.a
|
||||
endif
|
||||
|
||||
${TARGET_M68KPSEUDO}: ${OBJ_M68KPSEUDO}
|
||||
${CC} $(call libname,parse_m68k_pseudo) ${LIBDEPS} \
|
||||
|
@ -5,5 +5,10 @@ ALL_TARGETS+=${TARGET_MIPSPSEUDO}
|
||||
STATIC_OBJ+=${OBJ_MIPSPSEUDO}
|
||||
|
||||
${TARGET_MIPSPSEUDO}: ${OBJ_MIPSPSEUDO}
|
||||
ifeq ($(CC),cccl)
|
||||
${CC} $(call libname,parse_mips_pseudo) -L../../util -llibr_util \
|
||||
$(LDFLAGS_SHARED) ${CFLAGS} -o ${TARGET_MIPSPSEUDO} ${OBJ_MIPSPSEUDO}
|
||||
else
|
||||
${CC} $(call libname,parse_mips_pseudo) -L../../util -lr_util \
|
||||
$(LDFLAGS_SHARED) ${CFLAGS} -o ${TARGET_MIPSPSEUDO} ${OBJ_MIPSPSEUDO}
|
||||
endif
|
||||
|
@ -5,6 +5,12 @@ ALL_TARGETS+=${TARGET_MREPLACE}
|
||||
STATIC_OBJ+=${OBJ_MREPLACE}
|
||||
|
||||
${TARGET_MREPLACE}: ${OBJ_MREPLACE}
|
||||
ifeq ($(CC),cccl)
|
||||
${CC} $(call libname,parse_mreplace) ${CFLAGS} $(LDFLAGS) \
|
||||
${OBJ_MREPLACE} \
|
||||
-L ../util -L ../../util -lr_util
|
||||
-L../util -L../../util -llibr_util
|
||||
else
|
||||
${CC} $(call libname,parse_mreplace) ${CFLAGS} $(LDFLAGS) \
|
||||
${OBJ_MREPLACE} \
|
||||
-L../util -L../../util -lr_util
|
||||
endif
|
||||
|
@ -61,7 +61,11 @@ void sreplace(char *s,char *orig,char *rep,char multi,long dsize){
|
||||
}
|
||||
|
||||
char *mreplace(char *string, char *se,char *rep) {
|
||||
#ifdef _MSC_VER
|
||||
#define nmatch 16
|
||||
#else
|
||||
const size_t nmatch = 16;
|
||||
#endif
|
||||
memChunk *search,*temp,*found,*ffound;
|
||||
unsigned long offset = 0;
|
||||
RRegexMatch pm[nmatch];
|
||||
@ -145,6 +149,9 @@ char *mreplace(char *string, char *se,char *rep) {
|
||||
memFree (ffound);
|
||||
r_regex_free (re);
|
||||
return res;
|
||||
#ifdef _MSC_VER
|
||||
#undef nmatch
|
||||
#endif
|
||||
}
|
||||
|
||||
char *treplace(char *data,char *search,char *replace){
|
||||
|
@ -5,5 +5,10 @@ ALL_TARGETS+=${TARGET_PPCPSEUDO}
|
||||
STATIC_OBJ+=${OBJ_PPCPSEUDO}
|
||||
|
||||
${TARGET_PPCPSEUDO}: ${OBJ_PPCPSEUDO}
|
||||
ifeq ($(CC),cccl)
|
||||
${CC} $(call libname,parse_ppc_pseudo) -L../../util -llibr_util \
|
||||
${LDFLAGS_SHARED} ${CFLAGS} ${LDFLAGS} -o ${TARGET_PPCPSEUDO} ${OBJ_PPCPSEUDO}
|
||||
else
|
||||
${CC} $(call libname,parse_ppc_pseudo) -L../../util -lr_util \
|
||||
${LDFLAGS_SHARED} ${CFLAGS} ${LDFLAGS} -o ${TARGET_PPCPSEUDO} ${OBJ_PPCPSEUDO}
|
||||
endif
|
||||
|
@ -2,11 +2,17 @@ OBJ_X86PSEUDO+=parse_x86_pseudo.o
|
||||
|
||||
TARGET_X86PSEUDO=parse_x86_pseudo.${EXT_SO}
|
||||
STATIC_OBJ+=${OBJ_X86PSEUDO}
|
||||
ifeq ($(CC),cccl)
|
||||
LIBDEPS=-L../../util -llibr_util
|
||||
LIBDEPS+=-L../../flag -llibr_flag
|
||||
LDFLAGS+=-L../../reg -llibr_reg
|
||||
LDFLAGS+=-L../../cons -llibr_cons
|
||||
else
|
||||
LIBDEPS=-L../../util -lr_util
|
||||
LIBDEPS+=-L../../flag -lr_flag
|
||||
LDFLAGS+=-L../../reg -lr_reg
|
||||
LDFLAGS+=-L../../cons -lr_cons
|
||||
LDFLAGS+=-L../../cons
|
||||
endif
|
||||
|
||||
ifeq ($(WITHPIC),1)
|
||||
ALL_TARGETS+=${TARGET_X86PSEUDO}
|
||||
|
@ -3,8 +3,13 @@ OBJ_z80PSEUDO+=parse_z80_pseudo.o
|
||||
TARGET_z80PSEUDO=parse_z80_pseudo.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_z80PSEUDO}
|
||||
STATIC_OBJ+=${OBJ_z80PSEUDO}
|
||||
ifeq ($(CC),cccl)
|
||||
LIBDEPS=-L../../util -llibr_util
|
||||
LIBDEPS+=-L../../flag -llibr_flag
|
||||
else
|
||||
LIBDEPS=-L../../util -lr_util
|
||||
LIBDEPS+=-L../../flag -lr_flag
|
||||
endif
|
||||
|
||||
${TARGET_z80PSEUDO}: ${OBJ_z80PSEUDO}
|
||||
${CC} $(call libname,parse_z80_pseudo) ${LIBDEPS} $(LDFLAGS_SHARED) \
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <r_util.h>
|
||||
#include <r_socket.h>
|
||||
#include <r_util.h>
|
||||
#include <r_lib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@ -295,7 +295,11 @@ static int handle_redirection_proc (const char *cmd, bool in, bool out, bool err
|
||||
close (saved_stdout);
|
||||
return 0;
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("TODO: handle_redirection_proc: Not implemented for this platform")
|
||||
#else
|
||||
#warning handle_redirection_proc : unimplemented for this platform
|
||||
#endif
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
@ -325,7 +329,11 @@ static int handle_redirection(const char *cmd, bool in, bool out, bool err) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("string redirection handle not yet done")
|
||||
#else
|
||||
#warning quoted string redirection handle not yet done
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
} else if (cmd[0] == '!') {
|
||||
@ -711,7 +719,11 @@ R_API int r_run_config_env(RRunProfile *p) {
|
||||
is_child = true;
|
||||
|
||||
if (p->_dofork && !p->_dodebug) {
|
||||
#ifdef _MSC_VER
|
||||
int child_pid = r_sys_fork ();
|
||||
#else
|
||||
pid_t child_pid = r_sys_fork ();
|
||||
#endif
|
||||
if (child_pid == -1) {
|
||||
eprintf("rarun2: cannot fork\n");
|
||||
r_socket_free (child);
|
||||
|
@ -1,9 +1,10 @@
|
||||
/* radare - LGPL - Copyright 2006-2015 - pancake */
|
||||
|
||||
#include <errno.h>
|
||||
/* must be included first because of winsock2.h and windows.h */
|
||||
#include <r_socket.h>
|
||||
#include <r_types.h>
|
||||
#include <r_util.h>
|
||||
#include <r_socket.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
@ -11,7 +12,9 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#endif
|
||||
|
||||
#if EMSCRIPTEN
|
||||
#define NETWORK_DISABLED 1
|
||||
@ -107,7 +110,11 @@ R_API bool r_socket_is_connected (RSocket *s) {
|
||||
#if __WINDOWS__ && !defined(__CYGWIN__) //&& !defined(__MINGW64__)
|
||||
char buf[2];
|
||||
r_socket_block_time (s, 0, 0);
|
||||
#ifdef _MSC_VER
|
||||
int ret = recv (s->fd, (char*)&buf, 1, MSG_PEEK);
|
||||
#else
|
||||
ssize_t ret = recv (s->fd, (char*)&buf, 1, MSG_PEEK);
|
||||
#endif
|
||||
r_socket_block_time (s, 1, 0);
|
||||
return ret? true: false;
|
||||
#else
|
||||
@ -181,7 +188,11 @@ R_API RSocket *r_socket_new (int is_ssl) {
|
||||
signal (SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
s->local = 0;
|
||||
#ifdef _MSC_VER
|
||||
s->fd = INVALID_SOCKET;
|
||||
#else
|
||||
s->fd = -1;
|
||||
#endif
|
||||
#if HAVE_LIB_SSL
|
||||
if (is_ssl) {
|
||||
s->sfd = NULL;
|
||||
@ -213,7 +224,11 @@ R_API bool r_socket_connect (RSocket *s, const char *host, const char *port, int
|
||||
return false;
|
||||
}
|
||||
s->fd = socket (AF_INET, SOCK_STREAM, 0);
|
||||
#ifdef _MSC_VER
|
||||
if (s->fd == INVALID_SOCKET)
|
||||
#else
|
||||
if (s->fd == -1)
|
||||
#endif
|
||||
return false;
|
||||
|
||||
unsigned long iMode = 1;
|
||||
@ -225,14 +240,22 @@ R_API bool r_socket_connect (RSocket *s, const char *host, const char *port, int
|
||||
sa.sin_family = AF_INET;
|
||||
he = (struct hostent *)gethostbyname (host);
|
||||
if (he == (struct hostent*)0) {
|
||||
#ifdef _MSC_VER
|
||||
closesocket (s->fd);
|
||||
#else
|
||||
close (s->fd);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
sa.sin_addr = *((struct in_addr *)he->h_addr);
|
||||
s->port = r_socket_port_by_name (port);
|
||||
sa.sin_port = htons (s->port);
|
||||
if (!connect (s->fd, (const struct sockaddr*)&sa, sizeof (struct sockaddr))) {
|
||||
#ifdef _MSC_VER
|
||||
closesocket (s->fd);
|
||||
#else
|
||||
close (s->fd);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
iMode = 0;
|
||||
@ -351,7 +374,11 @@ R_API bool r_socket_connect (RSocket *s, const char *host, const char *port, int
|
||||
|
||||
/* close the file descriptor associated with the RSocket s */
|
||||
R_API int r_socket_close_fd (RSocket *s) {
|
||||
#ifdef _MSC_VER
|
||||
return s->fd != INVALID_SOCKET ? closesocket (s->fd) : false;
|
||||
#else
|
||||
return s->fd != -1 ? close (s->fd) : false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* shutdown the socket and close the file descriptor */
|
||||
@ -450,14 +477,22 @@ R_API bool r_socket_listen (RSocket *s, const char *port, const char *certfile)
|
||||
s->sa.sin_port = htons (s->port); // TODO honor etc/services
|
||||
if (bind (s->fd, (struct sockaddr *)&s->sa, sizeof (s->sa)) < 0) {
|
||||
r_sys_perror ("bind");
|
||||
#ifdef _MSC_VER
|
||||
closesocket (s->fd);
|
||||
#else
|
||||
close (s->fd);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#if __UNIX__ || defined(__CYGWIN__)
|
||||
signal (SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
if (listen (s->fd, 32) < 0) {
|
||||
#ifdef _MSC_VER
|
||||
closesocket (s->fd);
|
||||
#else
|
||||
close (s->fd);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#if HAVE_LIB_SSL
|
||||
@ -636,7 +671,12 @@ R_API int r_socket_write(RSocket *s, void *buf, int len) {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
char* winbuf = (char*) buf + len;
|
||||
ret = send (s->fd, winbuf, b, 0);
|
||||
#else
|
||||
ret = send (s->fd, buf+delta, b, 0);
|
||||
#endif
|
||||
}
|
||||
//if (ret == 0) return -1;
|
||||
if (ret<1) break;
|
||||
|
@ -25,7 +25,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
@ -501,7 +501,11 @@ static int r_buf_fcpy_at (RBuffer *b, ut64 addr, ut8 *buf, const char *fmt, int
|
||||
for (i = len = 0; i < n; i++)
|
||||
for (j = 0; fmt[j]; j++) {
|
||||
switch (fmt[j]) {
|
||||
#ifdef _MSC_VER
|
||||
case'0':case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':
|
||||
#else
|
||||
case '0'...'9':
|
||||
#endif
|
||||
if (m == 1)
|
||||
m = r_num_get (NULL, &fmt[j]);
|
||||
continue;
|
||||
@ -652,7 +656,11 @@ R_API int r_buf_write_at(RBuffer *b, ut64 addr, const ut8 *buf, int len) {
|
||||
}
|
||||
if (newlen > b->length) {
|
||||
b->length = newlen;
|
||||
#ifdef _MSC_VER
|
||||
_chsize (b->fd, newlen);
|
||||
#else
|
||||
ftruncate (b->fd, newlen);
|
||||
#endif
|
||||
}
|
||||
return r_sandbox_write (b->fd, buf, len);
|
||||
}
|
||||
|
@ -3,11 +3,9 @@
|
||||
#include "r_types.h"
|
||||
#include "r_util.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#if __UNIX__
|
||||
#include <sys/mman.h>
|
||||
@ -15,6 +13,8 @@
|
||||
#if __APPLE__
|
||||
#include <copyfile.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
R_API bool r_file_truncate (const char *filename, ut64 newsize) {
|
||||
int fd;
|
||||
@ -32,7 +32,11 @@ R_API bool r_file_truncate (const char *filename, ut64 newsize) {
|
||||
if (fd == -1) {
|
||||
return false;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
_chsize (fd, newsize);
|
||||
#else
|
||||
ftruncate (fd, newsize);
|
||||
#endif
|
||||
close (fd);
|
||||
return true;
|
||||
}
|
||||
@ -91,9 +95,11 @@ R_API bool r_file_is_directory(const char *str) {
|
||||
if (stat (str, &buf) == -1) {
|
||||
return false;
|
||||
}
|
||||
#ifdef S_IFBLK
|
||||
if ((S_IFBLK & buf.st_mode) == S_IFBLK) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return (S_IFDIR == (S_IFDIR & buf.st_mode))? true: false;
|
||||
}
|
||||
|
||||
@ -113,10 +119,20 @@ R_API bool r_file_exists(const char *str) {
|
||||
if (!str || !*str) {
|
||||
return false;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
HANDLE handle = FindFirstFile (str, &FindFileData);
|
||||
int found = handle != INVALID_HANDLE_VALUE;
|
||||
if (found) {
|
||||
FindClose (handle);
|
||||
}
|
||||
return found > 0;
|
||||
#else
|
||||
if (stat (str, &buf) == -1) {
|
||||
return false;
|
||||
}
|
||||
return (S_ISREG (buf.st_mode))? true: false;
|
||||
#endif
|
||||
}
|
||||
|
||||
R_API long r_file_proc_size(FILE *fd) {
|
||||
@ -250,7 +266,9 @@ R_API char *r_stdin_slurp (int *sz) {
|
||||
}
|
||||
return buf;
|
||||
#else
|
||||
#ifndef _MSC_VER
|
||||
#warning TODO r_stdin_slurp
|
||||
#endif
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
@ -2,13 +2,6 @@
|
||||
|
||||
#include "r_print.h"
|
||||
#include "r_util.h"
|
||||
#if 1
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
R_API int r_print_date_dos(RPrint *p, ut8 *buf, int len) {
|
||||
ut8 _time[2] = { buf[0], buf[1] };
|
||||
@ -108,7 +101,11 @@ R_API int r_print_date_get_now(RPrint *p, char *str) {
|
||||
}
|
||||
#else
|
||||
*str = 0;
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("r_print_date_now NOT IMPLEMENTED FOR THIS PLATFORM")
|
||||
#else
|
||||
#warning r_print_date_now NOT IMPLEMENTED FOR THIS PLATFORM
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
@ -306,7 +306,6 @@ R_API DIR* r_sandbox_opendir (const char *path) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return opendir (path);
|
||||
}
|
||||
#endif
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef _MSC_VER
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
/* stable code */
|
||||
static const char *nullstr = "";
|
||||
|
@ -42,7 +42,7 @@ extern char **environ;
|
||||
# define Sleep sleep
|
||||
#endif
|
||||
#endif
|
||||
#if __WINDOWS__ && !defined(__CYGWIN__)
|
||||
#if __WINDOWS__ && (defined(_MSC_VER) || !defined(__CYGWIN__))
|
||||
# include <io.h>
|
||||
# include <winbase.h>
|
||||
typedef BOOL WINAPI (*QueryFullProcessImageNameA_t) (HANDLE, DWORD, LPTSTR, PDWORD);
|
||||
@ -202,8 +202,12 @@ R_API void r_sys_backtrace(void) {
|
||||
printf ("[%d] pc == %p fp == %p\n", depth++, saved_pc, saved_fp);
|
||||
}
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("TODO: r_sys_bt : unimplemented")
|
||||
#else
|
||||
#warning TODO: r_sys_bt : unimplemented
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
R_API int r_sys_sleep(int secs) {
|
||||
@ -241,7 +245,11 @@ R_API int r_sys_clearenv(void) {
|
||||
#endif
|
||||
return 0;
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("r_sys_clearenv : unimplemented for this platform")
|
||||
#else
|
||||
#warning r_sys_clearenv : unimplemented for this platform
|
||||
#endif
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@ -561,7 +569,11 @@ R_API int r_sys_cmdbg (const char *str) {
|
||||
exit (0);
|
||||
return -1;
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("r_sys_cmdbg is not implemented for this platform")
|
||||
#else
|
||||
#warning r_sys_cmdbg is not implemented for this platform
|
||||
#endif
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
@ -280,9 +280,14 @@ R_API ut64 r_num_math(RNum *num, const char *str) {
|
||||
num->dbz = 0;
|
||||
}
|
||||
ret = r_num_calc (num, str, &err);
|
||||
if (err) eprintf ("r_num_calc error: (%s) in (%s)\n", err, str);
|
||||
else if (num) num->value = ret;
|
||||
if (num) num->value = ret;
|
||||
if (err) {
|
||||
eprintf ("r_num_calc error: (%s) in (%s)\n", err, str);
|
||||
} else if (num) {
|
||||
num->value = ret;
|
||||
}
|
||||
if (num) {
|
||||
num->value = ret;
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
ut64 ret = 0LL;
|
||||
|
@ -42,6 +42,9 @@ R_API ut8 *r_inflate(const ut8 *src, int srcLen, int *srcConsumed, int *dstLen)
|
||||
stream.opaque = Z_NULL;
|
||||
|
||||
// + 32 tells zlib not to care whether the stream is a zlib or gzip stream
|
||||
#ifdef _MSC_VER
|
||||
#pragma message ("TODO: Windows support here. Check dirent.h PR")
|
||||
#else
|
||||
if (inflateInit2 (&stream, MAX_WBITS + 32) != Z_OK) {
|
||||
return NULL;
|
||||
}
|
||||
@ -77,5 +80,6 @@ R_API ut8 *r_inflate(const ut8 *src, int srcLen, int *srcConsumed, int *dstLen)
|
||||
err_exit:
|
||||
inflateEnd (&stream);
|
||||
free (dst);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user