linter: update clang-format installation to version 20 (#5451)
* fix: format with clang-format-20 * fix: fix clang-format linter with rewrite '^#define.*/\*.*\\$' * fix: update clang-format to version 20 in workflows and documentation * fix: add SPDX license information to .git-blame-ignore-revs
This commit is contained in:
parent
4872db027b
commit
7a77b8f7bd
69 changed files with 4827 additions and 1434 deletions
6
.git-blame-ignore-revs
Normal file
6
.git-blame-ignore-revs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2025 Billow <billow.fun@gmail.com>
|
||||
# SPDX-License-Identifier: LGPL-3.0-only
|
||||
|
||||
# Update to clang-format-20
|
||||
2d87400ce332b9d30b4f20ff9c64029350860e28
|
||||
f21940662a90b3e0474f97fd7124a4e2afa87254
|
||||
6
.github/workflows/linter.yml
vendored
6
.github/workflows/linter.yml
vendored
|
|
@ -110,15 +110,15 @@ jobs:
|
|||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install clang-format-16
|
||||
run: sudo apt --assume-yes install clang-format-16
|
||||
- name: Install clang-format-20
|
||||
run: sudo apt --assume-yes install clang-format-20
|
||||
|
||||
- name: Install gitpython
|
||||
run: sudo pip install gitpython
|
||||
|
||||
- name: Run clang-format
|
||||
run: |
|
||||
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-16 160
|
||||
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-20 200
|
||||
clang-format --version
|
||||
python sys/clang-format.py --check --verbose
|
||||
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ E.g.: `Bug fix did not change the general behavior of the function. No documenta
|
|||
In order to contribute with patches or plugins, we encourage you to use the same
|
||||
coding style as the rest of the code base.
|
||||
|
||||
* Use git-clang-format 16 to format your code. If clang-format-16 is not available on
|
||||
* Use git-clang-format-20 to format your code. If clang-format-20 is not available on
|
||||
your Debian-based distribution, you can install it from https://apt.llvm.org/.
|
||||
You should invoke it as below (after making sure that your local copy of `dev`
|
||||
is up-to-date and your branch is up-to-date with `dev`):
|
||||
|
||||
```bash
|
||||
git-clang-format-16 --extensions c,cpp,h,hpp,inc --style file dev
|
||||
git-clang-format-20 --extensions c,cpp,h,hpp,inc --style file dev
|
||||
```
|
||||
|
||||
There is a script available to run on all source files; you will need python and
|
||||
|
|
|
|||
|
|
@ -198,8 +198,8 @@ static RzAnalysisRangedHintRecordBase *ensure_ranged_hint_record(RBTree *tree, u
|
|||
|
||||
RZ_API void rz_analysis_hint_set_offset(RzAnalysis *a, ut64 addr, const char *typeoff) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_TYPE_OFFSET,
|
||||
free(r->type_offset);
|
||||
r->type_offset = rz_str_dup(typeoff););
|
||||
free(r->type_offset);
|
||||
r->type_offset = rz_str_dup(typeoff););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_nword(RzAnalysis *a, ut64 addr, int nword) {
|
||||
|
|
@ -240,20 +240,20 @@ RZ_API void rz_analysis_hint_set_ret(RzAnalysis *a, ut64 addr, ut64 val) {
|
|||
|
||||
RZ_API void rz_analysis_hint_set_syntax(RzAnalysis *a, ut64 addr, const char *syn) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_SYNTAX,
|
||||
free(r->syntax);
|
||||
r->syntax = rz_str_dup(syn););
|
||||
free(r->syntax);
|
||||
r->syntax = rz_str_dup(syn););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_opcode(RzAnalysis *a, ut64 addr, const char *opcode) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_OPCODE,
|
||||
free(r->opcode);
|
||||
r->opcode = rz_str_dup(opcode););
|
||||
free(r->opcode);
|
||||
r->opcode = rz_str_dup(opcode););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_esil(RzAnalysis *a, ut64 addr, const char *esil) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_ESIL,
|
||||
free(r->esil);
|
||||
r->esil = rz_str_dup(esil););
|
||||
free(r->esil);
|
||||
r->esil = rz_str_dup(esil););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_type(RzAnalysis *a, ut64 addr, int type) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
// Local registers
|
||||
#define AMD29K_IS_REG_LR(x) ((x) >= 128 && (x) < 256)
|
||||
#define AMD29K_REGNAME(x) (AMD29K_IS_REG_GR(x) ? "gr" : "lr")
|
||||
#define AMD29K_LR(x) (AMD29K_IS_REG_GR(x) ? (x) : (x)-127)
|
||||
#define AMD29K_LR(x) (AMD29K_IS_REG_GR(x) ? (x) : (x) - 127)
|
||||
|
||||
static void decode_ra_rb_rci(amd29k_instr_t *instruction, const ut8 *buffer) {
|
||||
AMD29K_SET_VALUE(instruction, 0, buffer[1], AMD29K_TYPE_REG);
|
||||
|
|
|
|||
|
|
@ -5813,7 +5813,7 @@ static int arm_assemble(ArmOpcode *ao, ut64 off, const char *str) {
|
|||
}
|
||||
ao->o |= ((ret >> 16) & 0xff) << 8;
|
||||
ao->o |= ((ret >> 8) & 0xff) << 16;
|
||||
ao->o |= ((ret)&0xff) << 24;
|
||||
ao->o |= ((ret) & 0xff) << 24;
|
||||
} else {
|
||||
RZ_LOG_ERROR("assembler: arm: %s: instruction does not accept a register as argument\n", ops[i].name);
|
||||
return 0;
|
||||
|
|
@ -5839,7 +5839,7 @@ static int arm_assemble(ArmOpcode *ao, ut64 off, const char *str) {
|
|||
dst /= 4;
|
||||
ao->o |= ((dst >> 16) & 0xff) << 8;
|
||||
ao->o |= ((dst >> 8) & 0xff) << 16;
|
||||
ao->o |= ((dst)&0xff) << 24;
|
||||
ao->o |= ((dst) & 0xff) << 24;
|
||||
return 4;
|
||||
} else {
|
||||
ao->o |= (getreg(ao->a[0]) << 24);
|
||||
|
|
@ -5850,7 +5850,7 @@ static int arm_assemble(ArmOpcode *ao, ut64 off, const char *str) {
|
|||
o |= ((n >> 12) & 0xf) << 8;
|
||||
o |= ((n >> 8) & 0xf) << 20;
|
||||
o |= ((n >> 4) & 0xf) << 16;
|
||||
o |= ((n)&0xf) << 24;
|
||||
o |= ((n) & 0xf) << 24;
|
||||
ao->o |= o;
|
||||
} break;
|
||||
case TYPE_SWI:
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
(rn) = abs - pc; \
|
||||
} \
|
||||
if ((rn) < 0) { \
|
||||
(rn) = ~(-((rn)-1)); \
|
||||
(rn) = ~(-((rn) - 1)); \
|
||||
} else { \
|
||||
(rn) -= 2; \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ static OPCODE_DESC *avr_op_analyze(RzAnalysis *analysis, RzAnalysisOp *op, ut64
|
|||
#define CPU_MODEL_DECL(model, pc, consts) \
|
||||
{ \
|
||||
model, \
|
||||
pc, \
|
||||
consts \
|
||||
pc, \
|
||||
consts \
|
||||
}
|
||||
#define MASK(bits) ((bits) == 32 ? 0xffffffff : (~((~((ut32)0)) << (bits))))
|
||||
#define CPU_PC_MASK(cpu) MASK((cpu)->pc)
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ enum lh5801_insn_format {
|
|||
LH5801_IFMT_RMODE_MASK = 3 << 10,
|
||||
};
|
||||
|
||||
#define LH5801_IFMT_IMMS(f) ((f)&LH5801_IFMT_IMM_MASK)
|
||||
#define LH5801_IFMT_RMODE(f) ((f)&LH5801_IFMT_RMODE_MASK)
|
||||
#define LH5801_IFMT_IMMS(f) ((f) & LH5801_IFMT_IMM_MASK)
|
||||
#define LH5801_IFMT_RMODE(f) ((f) & LH5801_IFMT_RMODE_MASK)
|
||||
|
||||
static bool lh5801_ifmt_fd_matches(enum lh5801_insn_format fmt, int fd) {
|
||||
switch (fmt & LH5801_IFMT_FD_MASK) {
|
||||
|
|
|
|||
|
|
@ -166,11 +166,11 @@ name args description
|
|||
#define cast(x, y) ((x)(y))
|
||||
|
||||
#define GET_OPCODE(i) (cast(LuaOpCode, ((i) >> POS_OP) & MASK1(SIZE_OP, 0)))
|
||||
#define SET_OPCODE(i, o) ((i) = (((i)&MASK0(SIZE_OP, POS_OP)) | \
|
||||
#define SET_OPCODE(i, o) ((i) = (((i) & MASK0(SIZE_OP, POS_OP)) | \
|
||||
((cast(ut32, o) << POS_OP) & MASK1(SIZE_OP, POS_OP))))
|
||||
|
||||
#define getarg(i, pos, size) (cast(int, ((i) >> (pos)) & MASK1(size, 0)))
|
||||
#define setarg(i, v, pos, size) ((i) = (((i)&MASK0(size, pos)) | \
|
||||
#define setarg(i, v, pos, size) ((i) = (((i) & MASK0(size, pos)) | \
|
||||
((cast(ut32, v) << (pos)) & MASK1(size, pos))))
|
||||
|
||||
#define GETARG_A(i) getarg(i, POS_A, SIZE_A)
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ typedef enum {
|
|||
/* Macros Highlight the cast */
|
||||
#define LUA_CAST(x, y) ((x)y)
|
||||
#define int2sC(i) ((i) + LUAOP_FIX_sC)
|
||||
#define sC2int(i) ((i)-LUAOP_FIX_sC)
|
||||
#define sC2int(i) ((i) - LUAOP_FIX_sC)
|
||||
|
||||
/* creates a mask with 'n' 1/0 bits at position 'p' */
|
||||
#define LUA_MASK1(n, p) ((~((~(LuaInstruction)0) << (n))) << (p))
|
||||
|
|
@ -196,12 +196,12 @@ typedef enum {
|
|||
|
||||
/* OPCODE getter */
|
||||
#define LUA_GET_OPCODE(i) (LUA_CAST(LuaOpCode, ((i) >> LUAOP_OP_OFFSET) & LUA_MASK1(LUAOP_OP_SIZE, 0)))
|
||||
#define LUA_SET_OPCODE(i, o) ((i) = (((i)&LUA_MASK0(LUAOP_OP_SIZE, LUAOP_OP_OFFSET)) | \
|
||||
#define LUA_SET_OPCODE(i, o) ((i) = (((i) & LUA_MASK0(LUAOP_OP_SIZE, LUAOP_OP_OFFSET)) | \
|
||||
((LUA_CAST(LuaInstruction, o) << LUAOP_OP_OFFSET) & LUA_MASK1(LUAOP_OP_SIZE, LUAOP_OP_OFFSET))))
|
||||
|
||||
/* Arguments getter */
|
||||
#define LUA_GETARG(i, offset, size) (LUA_CAST(int, ((i) >> (offset)) & LUA_MASK1(size, 0)))
|
||||
#define LUA_SETARG(i, v, pos, size) ((i) = (((i)&LUA_MASK0(size, pos)) | \
|
||||
#define LUA_SETARG(i, v, pos, size) ((i) = (((i) & LUA_MASK0(size, pos)) | \
|
||||
((LUA_CAST(LuaInstruction, v) << (pos)) & LUA_MASK1(size, pos))))
|
||||
|
||||
#define LUA_GETARG_A(i) LUA_GETARG(i, LUAOP_A_OFFSET, LUAOP_A_SIZE)
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@
|
|||
#define OP_MASK OP(0x3f)
|
||||
|
||||
#define OPS(op, xop) (OP(op) | ((((ut32)(xop)) & 0x1f) << 1))
|
||||
#define OPSC(op, xop, rc) (OPS((op), (xop)) | ((rc)&1))
|
||||
#define OPSC(op, xop, rc) (OPS((op), (xop)) | ((rc) & 1))
|
||||
#define OPS_MASK OPSC(0x3f, 0x1f, 1)
|
||||
#define OPS_MASK_DOT OPSC(0x3f, 0x1f, 1)
|
||||
|
||||
#define OPM(op, xop) (OP(op) | ((((ut32)(xop)) & 0x3f) << 1))
|
||||
#define OPMC(op, xop, rc) (OPM((op), (xop)) | ((rc)&1))
|
||||
#define OPMC(op, xop, rc) (OPM((op), (xop)) | ((rc) & 1))
|
||||
#define OPM_MASK OPMC(0x3f, 0x3f, 0)
|
||||
|
||||
#define OPL(op, xop) (OP(op) | ((((ut32)(xop)) & 0x3ff) << 1))
|
||||
#define OPLC(op, xop, rc) (OPL((op), (xop)) | ((rc)&1))
|
||||
#define OPLC(op, xop, rc) (OPL((op), (xop)) | ((rc) & 1))
|
||||
#define OPL_MASK OPLC(0x3f, 0x3ff, 1)
|
||||
#define OPL_MASK_DOT OPLC(0x3f, 0x3ff, 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@
|
|||
{ .type = RX_TOKEN_CB, .tk.cb.tk_len = (x) }
|
||||
#define RxDspSplit(x, v, it, xx) \
|
||||
{ .type = RX_TOKEN_DSP_SPLIT, \
|
||||
.tk.dsp_sp.tk_len = (x), .tk.dsp_sp.vid = (v), .tk.dsp_sp.tk_len_more = (xx), .tk.dsp_sp.interval = (it) }
|
||||
.tk.dsp_sp.tk_len = (x), \
|
||||
.tk.dsp_sp.vid = (v), \
|
||||
.tk.dsp_sp.tk_len_more = (xx), \
|
||||
.tk.dsp_sp.interval = (it) }
|
||||
#define RxIgnore(x) \
|
||||
{ .type = RX_TOKEN_IGNORE, .tk.reserved.tk_len = (x) }
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ const char *cond_names[RX_COND_RESERVED] = {
|
|||
};
|
||||
|
||||
#define RxNameOp(op) ((op) < _RX_OP_COUNT ? opnames[(op)] : "invalid")
|
||||
#define RxNameExt(ext) ((ext) < _RX_EXT_COUNT ? extmark_names[((ext)-RX_EXT_B)] : "invalid")
|
||||
#define RxNameReg(reg) ((reg) < RX_REG_RESERVED ? reg_names[(reg)-RX_REG_R0] : "invalid")
|
||||
#define RxNameExt(ext) ((ext) < _RX_EXT_COUNT ? extmark_names[((ext) - RX_EXT_B)] : "invalid")
|
||||
#define RxNameReg(reg) ((reg) < RX_REG_RESERVED ? reg_names[(reg) - RX_REG_R0] : "invalid")
|
||||
#define RxNameFlag(flag) ((flag) < 7 ? flag_names[(flag)] : "invalid")
|
||||
#define RxNameCond(cond) ((cond) < RX_COND_RESERVED ? cond_names[(cond)] : "invalid")
|
||||
|
|
@ -7,17 +7,17 @@
|
|||
#define V810_INSTR_MAXLEN 24
|
||||
|
||||
#define OPCODE(instr) (((instr) >> 10) & 0x3F)
|
||||
#define REG1(instr) ((instr)&0x1F)
|
||||
#define REG1(instr) ((instr) & 0x1F)
|
||||
#define REG2(instr) (((instr) >> 5) & 0x1F)
|
||||
#define IMM5(instr) REG1((instr))
|
||||
#define COND(instr) (((instr) >> 9) & 0xF)
|
||||
|
||||
#define SIGN_EXT_T5(imm) (((imm)&0x10) ? (imm) | 0xE0 : (imm))
|
||||
#define SIGN_EXT_T9(imm) (((imm)&0x100) ? (imm) | 0xFFFFFE00 : (imm))
|
||||
#define SIGN_EXT_T26(imm) (((imm)&0x2000000) ? (imm) | 0xFC000000 : (imm))
|
||||
#define SIGN_EXT_T5(imm) (((imm) & 0x10) ? (imm) | 0xE0 : (imm))
|
||||
#define SIGN_EXT_T9(imm) (((imm) & 0x100) ? (imm) | 0xFFFFFE00 : (imm))
|
||||
#define SIGN_EXT_T26(imm) (((imm) & 0x2000000) ? (imm) | 0xFC000000 : (imm))
|
||||
|
||||
#define DISP9(word1) SIGN_EXT_T9((word1)&0x1FE)
|
||||
#define DISP26(word1, word2) SIGN_EXT_T26((((word1)&0x3FF) << 16) | (word2))
|
||||
#define DISP9(word1) SIGN_EXT_T9((word1) & 0x1FE)
|
||||
#define DISP26(word1, word2) SIGN_EXT_T26((((word1) & 0x3FF) << 16) | (word2))
|
||||
|
||||
enum v810_cmd_opcodes {
|
||||
V810_MOV = 0x0,
|
||||
|
|
|
|||
|
|
@ -1485,7 +1485,7 @@ IL_LIFTER(nop) {
|
|||
* One's complement negation
|
||||
* Encoding: M
|
||||
*/
|
||||
IL_LIFTER(not ) {
|
||||
IL_LIFTER(not) {
|
||||
return x86_il_set_op(0, LOGNOT(x86_il_get_op(0)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static RzILOpEffect *x_setg(const char *name, RzILOpPure *x) {
|
|||
#define B2U32(X) BOOL_TO_BV(X, 32)
|
||||
|
||||
typedef RzAnalysisLiftedILOp (*fn_analyze_op_il)(XtensaContext *ctx);
|
||||
typedef RzILOpPure *(fn_op2)(RzILOpBool *x, RzILOpBool *y);
|
||||
typedef RzILOpPure *(fn_op2)(RzILOpBool * x, RzILOpBool *y);
|
||||
|
||||
enum {
|
||||
PS_INTLEVEL, /// Interrupt level mask
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include <rz_analysis.h>
|
||||
#include <i4004/i4004dis.h>
|
||||
|
||||
#define AVR_SOFTCAST(x, y) ((x) + ((y)*0x100))
|
||||
#define AVR_SOFTCAST(x, y) ((x) + ((y) * 0x100))
|
||||
|
||||
static char *get_reg_profile(RzAnalysis *analysis) {
|
||||
const char *p =
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "pyc/pyc_dis.h"
|
||||
|
||||
#define JMP_OFFSET(ops, v) ((ops)->jump_use_instruction_offset ? (v)*2 : (v))
|
||||
#define JMP_OFFSET(ops, v) ((ops)->jump_use_instruction_offset ? (v) * 2 : (v))
|
||||
|
||||
static int archinfo(RzAnalysis *analysis, RzAnalysisInfoType query) {
|
||||
if (!strcmp(analysis->cpu, "x86")) {
|
||||
|
|
|
|||
|
|
@ -38,138 +38,138 @@
|
|||
#define IS_CLRMAC(x) x == 0x0028
|
||||
#define IS_RTE(x) x == 0x002b
|
||||
|
||||
#define IS_STCSR1(x) (((x)&0xF0CF) == 0x0002) // mask stc Rn,{SR,gbr,VBR,SSR}
|
||||
#define IS_BSRF(x) ((x)&0xf0ff) == 0x0003
|
||||
#define IS_BRAF(x) (((x)&0xf0ff) == 0x0023)
|
||||
#define IS_MOVB_REG_TO_R0REL(x) (((x)&0xF00F) == 0x0004)
|
||||
#define IS_MOVW_REG_TO_R0REL(x) (((x)&0xF00F) == 0x0005)
|
||||
#define IS_MOVL_REG_TO_R0REL(x) (((x)&0xF00F) == 0x0006)
|
||||
#define IS_MULL(x) (((x)&0xF00F) == 0x0007)
|
||||
#define IS_MOVB_R0REL_TO_REG(x) (((x)&0xF00F) == 0x000C)
|
||||
#define IS_MOVW_R0REL_TO_REG(x) (((x)&0xF00F) == 0x000D)
|
||||
#define IS_MOVL_R0REL_TO_REG(x) (((x)&0xF00F) == 0x000E)
|
||||
#define IS_MACL(x) (((x)&0xF00F) == 0x000F)
|
||||
#define IS_MOVT(x) (((x)&0xF0FF) == 0x0029)
|
||||
#define IS_STSMACH(x) (((x)&0xF0FF) == 0x000A)
|
||||
#define IS_STSMACL(x) (((x)&0xF0FF) == 0x001A)
|
||||
#define IS_STSPR(x) (((x)&0xF0FF) == 0x002A)
|
||||
#define IS_STCSR1(x) (((x) & 0xF0CF) == 0x0002) // mask stc Rn,{SR,gbr,VBR,SSR}
|
||||
#define IS_BSRF(x) ((x) & 0xf0ff) == 0x0003
|
||||
#define IS_BRAF(x) (((x) & 0xf0ff) == 0x0023)
|
||||
#define IS_MOVB_REG_TO_R0REL(x) (((x) & 0xF00F) == 0x0004)
|
||||
#define IS_MOVW_REG_TO_R0REL(x) (((x) & 0xF00F) == 0x0005)
|
||||
#define IS_MOVL_REG_TO_R0REL(x) (((x) & 0xF00F) == 0x0006)
|
||||
#define IS_MULL(x) (((x) & 0xF00F) == 0x0007)
|
||||
#define IS_MOVB_R0REL_TO_REG(x) (((x) & 0xF00F) == 0x000C)
|
||||
#define IS_MOVW_R0REL_TO_REG(x) (((x) & 0xF00F) == 0x000D)
|
||||
#define IS_MOVL_R0REL_TO_REG(x) (((x) & 0xF00F) == 0x000E)
|
||||
#define IS_MACL(x) (((x) & 0xF00F) == 0x000F)
|
||||
#define IS_MOVT(x) (((x) & 0xF0FF) == 0x0029)
|
||||
#define IS_STSMACH(x) (((x) & 0xF0FF) == 0x000A)
|
||||
#define IS_STSMACL(x) (((x) & 0xF0FF) == 0x001A)
|
||||
#define IS_STSPR(x) (((x) & 0xF0FF) == 0x002A)
|
||||
// #define IS_STSFPUL(x) (((x) & 0xF0FF) == 0x005A) //FP*: todo maybe someday
|
||||
// #define IS_STSFPSCR(x) (((x) & 0xF0FF) == 0x006A)
|
||||
#define IS_MOVB_REG_TO_REGREF(x) (((x)&0xF00F) == 0x2000)
|
||||
#define IS_MOVW_REG_TO_REGREF(x) (((x)&0xF00F) == 0x2001)
|
||||
#define IS_MOVL_REG_TO_REGREF(x) (((x)&0xF00F) == 0x2002)
|
||||
#define IS_MOVB_REG_TO_REGREF(x) (((x) & 0xF00F) == 0x2000)
|
||||
#define IS_MOVW_REG_TO_REGREF(x) (((x) & 0xF00F) == 0x2001)
|
||||
#define IS_MOVL_REG_TO_REGREF(x) (((x) & 0xF00F) == 0x2002)
|
||||
// #define invalid?(x) (((x) & 0xF00F) == 0x2003) //illegal on sh2e
|
||||
#define IS_PUSHB(x) (((x)&0xF00F) == 0x2004)
|
||||
#define IS_PUSHW(x) (((x)&0xF00F) == 0x2005)
|
||||
#define IS_PUSHL(x) (((x)&0xF00F) == 0x2006)
|
||||
#define IS_DIV0S(x) (((x)&0xF00F) == 0x2007)
|
||||
#define IS_TSTRR(x) (((x)&0xF00F) == 0x2008)
|
||||
#define IS_AND_REGS(x) (((x)&0xF00F) == 0x2009)
|
||||
#define IS_XOR_REGS(x) (((x)&0xF00F) == 0x200A)
|
||||
#define IS_OR_REGS(x) (((x)&0xF00F) == 0x200B)
|
||||
#define IS_CMPSTR(x) (((x)&0xF00F) == 0x200C)
|
||||
#define IS_XTRCT(x) (((x)&0xF00F) == 0x200D)
|
||||
#define IS_MULUW(x) (((x)&0xF00F) == 0x200E)
|
||||
#define IS_MULSW(x) (((x)&0xF00F) == 0x200F)
|
||||
#define IS_CMPEQ(x) (((x)&0xF00F) == 0x3000)
|
||||
#define IS_PUSHB(x) (((x) & 0xF00F) == 0x2004)
|
||||
#define IS_PUSHW(x) (((x) & 0xF00F) == 0x2005)
|
||||
#define IS_PUSHL(x) (((x) & 0xF00F) == 0x2006)
|
||||
#define IS_DIV0S(x) (((x) & 0xF00F) == 0x2007)
|
||||
#define IS_TSTRR(x) (((x) & 0xF00F) == 0x2008)
|
||||
#define IS_AND_REGS(x) (((x) & 0xF00F) == 0x2009)
|
||||
#define IS_XOR_REGS(x) (((x) & 0xF00F) == 0x200A)
|
||||
#define IS_OR_REGS(x) (((x) & 0xF00F) == 0x200B)
|
||||
#define IS_CMPSTR(x) (((x) & 0xF00F) == 0x200C)
|
||||
#define IS_XTRCT(x) (((x) & 0xF00F) == 0x200D)
|
||||
#define IS_MULUW(x) (((x) & 0xF00F) == 0x200E)
|
||||
#define IS_MULSW(x) (((x) & 0xF00F) == 0x200F)
|
||||
#define IS_CMPEQ(x) (((x) & 0xF00F) == 0x3000)
|
||||
// #define invalid?(x) (((x) & 0xF00F) == 0x3001)
|
||||
#define IS_CMPHS(x) (((x)&0xF00F) == 0x3002)
|
||||
#define IS_CMPGE(x) (((x)&0xF00F) == 0x3003)
|
||||
#define IS_CMPHI(x) (((x)&0xF00F) == 0x3006)
|
||||
#define IS_CMPGT(x) (((x)&0xF00F) == 0x3007)
|
||||
#define IS_DIV1(x) (((x)&0xF00F) == 0x3004)
|
||||
#define IS_DMULU(x) (((x)&0xF00F) == 0x3005)
|
||||
#define IS_DMULS(x) (((x)&0xF00F) == 0x300D)
|
||||
#define IS_SUB(x) (((x)&0xF00F) == 0x3008)
|
||||
#define IS_CMPHS(x) (((x) & 0xF00F) == 0x3002)
|
||||
#define IS_CMPGE(x) (((x) & 0xF00F) == 0x3003)
|
||||
#define IS_CMPHI(x) (((x) & 0xF00F) == 0x3006)
|
||||
#define IS_CMPGT(x) (((x) & 0xF00F) == 0x3007)
|
||||
#define IS_DIV1(x) (((x) & 0xF00F) == 0x3004)
|
||||
#define IS_DMULU(x) (((x) & 0xF00F) == 0x3005)
|
||||
#define IS_DMULS(x) (((x) & 0xF00F) == 0x300D)
|
||||
#define IS_SUB(x) (((x) & 0xF00F) == 0x3008)
|
||||
// #define invalid?(x) (((x) & 0xF00F) == 0x3009)
|
||||
#define IS_SUBC(x) (((x)&0xF00F) == 0x300A)
|
||||
#define IS_SUBV(x) (((x)&0xF00F) == 0x300B)
|
||||
#define IS_ADD(x) (((x)&0xF00F) == 0x300C)
|
||||
#define IS_ADDC(x) (((x)&0xF00F) == 0x300E)
|
||||
#define IS_ADDV(x) (((x)&0xF00F) == 0x300F)
|
||||
#define IS_MACW(x) (((x)&0xF00F) == 0x400F)
|
||||
#define IS_JSR(x) (((x)&0xf0ff) == 0x400b)
|
||||
#define IS_JMP(x) (((x)&0xf0ff) == 0x402b)
|
||||
#define IS_CMPPL(x) (((x)&0xf0ff) == 0x4015)
|
||||
#define IS_CMPPZ(x) (((x)&0xf0ff) == 0x4011)
|
||||
#define IS_LDCSR(x) (((x)&0xF0FF) == 0x400E)
|
||||
#define IS_LDCGBR(x) (((x)&0xF0FF) == 0x401E)
|
||||
#define IS_LDCVBR(x) (((x)&0xF0FF) == 0x402E)
|
||||
#define IS_LDCLSR(x) (((x)&0xF0FF) == 0x4007)
|
||||
#define IS_LDCLSRGBR(x) (((x)&0xF0FF) == 0x4017)
|
||||
#define IS_LDCLSRVBR(x) (((x)&0xF0FF) == 0x4027)
|
||||
#define IS_LDSMACH(x) (((x)&0xF0FF) == 0x400A)
|
||||
#define IS_LDSMACL(x) (((x)&0xF0FF) == 0x401A)
|
||||
#define IS_LDSLMACH(x) (((x)&0xF0FF) == 0x4006)
|
||||
#define IS_LDSLMACL(x) (((x)&0xF0FF) == 0x4016)
|
||||
#define IS_LDSPR(x) (((x)&0xF0FF) == 0x402A)
|
||||
#define IS_LDSLPR(x) (((x)&0xF0FF) == 0x4026)
|
||||
#define IS_SUBC(x) (((x) & 0xF00F) == 0x300A)
|
||||
#define IS_SUBV(x) (((x) & 0xF00F) == 0x300B)
|
||||
#define IS_ADD(x) (((x) & 0xF00F) == 0x300C)
|
||||
#define IS_ADDC(x) (((x) & 0xF00F) == 0x300E)
|
||||
#define IS_ADDV(x) (((x) & 0xF00F) == 0x300F)
|
||||
#define IS_MACW(x) (((x) & 0xF00F) == 0x400F)
|
||||
#define IS_JSR(x) (((x) & 0xf0ff) == 0x400b)
|
||||
#define IS_JMP(x) (((x) & 0xf0ff) == 0x402b)
|
||||
#define IS_CMPPL(x) (((x) & 0xf0ff) == 0x4015)
|
||||
#define IS_CMPPZ(x) (((x) & 0xf0ff) == 0x4011)
|
||||
#define IS_LDCSR(x) (((x) & 0xF0FF) == 0x400E)
|
||||
#define IS_LDCGBR(x) (((x) & 0xF0FF) == 0x401E)
|
||||
#define IS_LDCVBR(x) (((x) & 0xF0FF) == 0x402E)
|
||||
#define IS_LDCLSR(x) (((x) & 0xF0FF) == 0x4007)
|
||||
#define IS_LDCLSRGBR(x) (((x) & 0xF0FF) == 0x4017)
|
||||
#define IS_LDCLSRVBR(x) (((x) & 0xF0FF) == 0x4027)
|
||||
#define IS_LDSMACH(x) (((x) & 0xF0FF) == 0x400A)
|
||||
#define IS_LDSMACL(x) (((x) & 0xF0FF) == 0x401A)
|
||||
#define IS_LDSLMACH(x) (((x) & 0xF0FF) == 0x4006)
|
||||
#define IS_LDSLMACL(x) (((x) & 0xF0FF) == 0x4016)
|
||||
#define IS_LDSPR(x) (((x) & 0xF0FF) == 0x402A)
|
||||
#define IS_LDSLPR(x) (((x) & 0xF0FF) == 0x4026)
|
||||
// #define IS_LDSFPUL(x) (((x) & 0xF0FF) == 0x405A) //FP*: todo maybe someday
|
||||
// #define IS_LDSFPSCR(x) (((x) & 0xF0FF) == 0x406A)
|
||||
// #define IS_LDSLFPUL(x) (((x) & 0xF0FF) == 0x4066)
|
||||
// #define IS_LDSLFPSCR(x) (((x) & 0xF0FF) == 0x4056)
|
||||
#define IS_ROTCR(x) (((x)&0xF0FF) == 0x4025)
|
||||
#define IS_ROTCL(x) (((x)&0xF0FF) == 0x4024)
|
||||
#define IS_ROTL(x) (((x)&0xF0FF) == 0x4004)
|
||||
#define IS_ROTR(x) (((x)&0xF0FF) == 0x4005)
|
||||
#define IS_ROTCR(x) (((x) & 0xF0FF) == 0x4025)
|
||||
#define IS_ROTCL(x) (((x) & 0xF0FF) == 0x4024)
|
||||
#define IS_ROTL(x) (((x) & 0xF0FF) == 0x4004)
|
||||
#define IS_ROTR(x) (((x) & 0xF0FF) == 0x4005)
|
||||
// not on sh2e : shad, shld
|
||||
|
||||
// #define IS_SHIFT1(x) (((x) & 0xF0DE) == 0x4000) //unused (treated as switch-case)
|
||||
// other shl{l,r}{,2,8,16} in switch case also.
|
||||
|
||||
#define IS_STSLMACL(x) (((x)&0xF0FF) == 0x4012)
|
||||
#define IS_STSLMACH(x) (((x)&0xF0FF) == 0x4002)
|
||||
#define IS_STCLSR(x) (((x)&0xF0FF) == 0x4003)
|
||||
#define IS_STCLGBR(x) (((x)&0xF0FF) == 0x4013)
|
||||
#define IS_STCLVBR(x) (((x)&0xF0FF) == 0x4023)
|
||||
#define IS_STSLMACL(x) (((x) & 0xF0FF) == 0x4012)
|
||||
#define IS_STSLMACH(x) (((x) & 0xF0FF) == 0x4002)
|
||||
#define IS_STCLSR(x) (((x) & 0xF0FF) == 0x4003)
|
||||
#define IS_STCLGBR(x) (((x) & 0xF0FF) == 0x4013)
|
||||
#define IS_STCLVBR(x) (((x) & 0xF0FF) == 0x4023)
|
||||
// todo: other stc.l not on sh2e
|
||||
#define IS_STSLPR(x) (((x)&0xF0FF) == 0x4022)
|
||||
#define IS_STSLPR(x) (((x) & 0xF0FF) == 0x4022)
|
||||
// #define IS_STSLFPUL(x) (((x) & 0xF0FF) == 0x4052)
|
||||
// #define IS_STSLFPSCR(x) (((x) & 0xF0FF) == 0x4062)
|
||||
#define IS_TASB(x) (((x)&0xF0FF) == 0x401B)
|
||||
#define IS_DT(x) (((x)&0xF0FF) == 0x4010)
|
||||
#define IS_TASB(x) (((x) & 0xF0FF) == 0x401B)
|
||||
#define IS_DT(x) (((x) & 0xF0FF) == 0x4010)
|
||||
|
||||
#define IS_MOVB_REGREF_TO_REG(x) (((x)&0xF00F) == 0x6000)
|
||||
#define IS_MOVW_REGREF_TO_REG(x) (((x)&0xF00F) == 0x6001)
|
||||
#define IS_MOVL_REGREF_TO_REG(x) (((x)&0xF00F) == 0x6002)
|
||||
#define IS_MOV_REGS(x) (((x)&0xf00f) == 0x6003)
|
||||
#define IS_MOVB_POP(x) (((x)&0xF00F) == 0x6004)
|
||||
#define IS_MOVW_POP(x) (((x)&0xF00F) == 0x6005)
|
||||
#define IS_MOVL_POP(x) (((x)&0xF00F) == 0x6006)
|
||||
#define IS_NOT(x) (((x)&0xF00F) == 0x6007)
|
||||
#define IS_SWAPB(x) (((x)&0xF00F) == 0x6008)
|
||||
#define IS_SWAPW(x) (((x)&0xF00F) == 0x6009)
|
||||
#define IS_NEG(x) (((x)&0xF00F) == 0x600B)
|
||||
#define IS_NEGC(x) (((x)&0xF00F) == 0x600A)
|
||||
#define IS_EXT(x) (((x)&0xF00C) == 0x600C) // match ext{s,u}.{b,w}
|
||||
#define IS_MOVB_REGREF_TO_REG(x) (((x) & 0xF00F) == 0x6000)
|
||||
#define IS_MOVW_REGREF_TO_REG(x) (((x) & 0xF00F) == 0x6001)
|
||||
#define IS_MOVL_REGREF_TO_REG(x) (((x) & 0xF00F) == 0x6002)
|
||||
#define IS_MOV_REGS(x) (((x) & 0xf00f) == 0x6003)
|
||||
#define IS_MOVB_POP(x) (((x) & 0xF00F) == 0x6004)
|
||||
#define IS_MOVW_POP(x) (((x) & 0xF00F) == 0x6005)
|
||||
#define IS_MOVL_POP(x) (((x) & 0xF00F) == 0x6006)
|
||||
#define IS_NOT(x) (((x) & 0xF00F) == 0x6007)
|
||||
#define IS_SWAPB(x) (((x) & 0xF00F) == 0x6008)
|
||||
#define IS_SWAPW(x) (((x) & 0xF00F) == 0x6009)
|
||||
#define IS_NEG(x) (((x) & 0xF00F) == 0x600B)
|
||||
#define IS_NEGC(x) (((x) & 0xF00F) == 0x600A)
|
||||
#define IS_EXT(x) (((x) & 0xF00C) == 0x600C) // match ext{s,u}.{b,w}
|
||||
|
||||
#define IS_MOVB_R0_REGDISP(x) (((x)&0xFF00) == 0x8000)
|
||||
#define IS_MOVW_R0_REGDISP(x) (((x)&0xFF00) == 0x8100)
|
||||
#define IS_MOVB_R0_REGDISP(x) (((x) & 0xFF00) == 0x8000)
|
||||
#define IS_MOVW_R0_REGDISP(x) (((x) & 0xFF00) == 0x8100)
|
||||
// #define illegal?(x) (((x) & 0xF900) == 0x8000) //match 8{2,3,6,7}00
|
||||
#define IS_MOVB_REGDISP_R0(x) (((x)&0xFF00) == 0x8400)
|
||||
#define IS_MOVW_REGDISP_R0(x) (((x)&0xFF00) == 0x8500)
|
||||
#define IS_CMPIMM(x) (((x)&0xFF00) == 0x8800)
|
||||
#define IS_MOVB_REGDISP_R0(x) (((x) & 0xFF00) == 0x8400)
|
||||
#define IS_MOVW_REGDISP_R0(x) (((x) & 0xFF00) == 0x8500)
|
||||
#define IS_CMPIMM(x) (((x) & 0xFF00) == 0x8800)
|
||||
// #define illegal?(x) (((x) & 0xFB00) == 0x8A00) //match 8{A,E}00
|
||||
#define IS_BT(x) (((x)&0xff00) == 0x8900)
|
||||
#define IS_BF(x) (((x)&0xff00) == 0x8B00)
|
||||
#define IS_BTS(x) (((x)&0xff00) == 0x8D00)
|
||||
#define IS_BFS(x) (((x)&0xff00) == 0x8F00)
|
||||
#define IS_BT(x) (((x) & 0xff00) == 0x8900)
|
||||
#define IS_BF(x) (((x) & 0xff00) == 0x8B00)
|
||||
#define IS_BTS(x) (((x) & 0xff00) == 0x8D00)
|
||||
#define IS_BFS(x) (((x) & 0xff00) == 0x8F00)
|
||||
#define IS_BT_OR_BF(x) IS_BT(x) || IS_BTS(x) || IS_BF(x) || IS_BFS(x)
|
||||
|
||||
#define IS_MOVB_R0_GBRREF(x) (((x)&0xFF00) == 0xC000)
|
||||
#define IS_MOVW_R0_GBRREF(x) (((x)&0xFF00) == 0xC100)
|
||||
#define IS_MOVL_R0_GBRREF(x) (((x)&0xFF00) == 0xC200)
|
||||
#define IS_TRAP(x) (((x)&0xFF00) == 0xC300)
|
||||
#define IS_MOVB_GBRREF_R0(x) (((x)&0xFF00) == 0xC400)
|
||||
#define IS_MOVW_GBRREF_R0(x) (((x)&0xFF00) == 0xC500)
|
||||
#define IS_MOVL_GBRREF_R0(x) (((x)&0xFF00) == 0xC600)
|
||||
#define IS_MOVA_PCREL_R0(x) (((x)&0xFF00) == 0xC700)
|
||||
#define IS_BINLOGIC_IMM_R0(x) (((x)&0xFC00) == 0xC800) // match C{8,9,A,B}00
|
||||
#define IS_BINLOGIC_IMM_GBR(x) (((x)&0xFC00) == 0xCC00) // match C{C,D,E,F}00 : *.b #imm, @(R0,gbr)
|
||||
#define IS_MOVB_R0_GBRREF(x) (((x) & 0xFF00) == 0xC000)
|
||||
#define IS_MOVW_R0_GBRREF(x) (((x) & 0xFF00) == 0xC100)
|
||||
#define IS_MOVL_R0_GBRREF(x) (((x) & 0xFF00) == 0xC200)
|
||||
#define IS_TRAP(x) (((x) & 0xFF00) == 0xC300)
|
||||
#define IS_MOVB_GBRREF_R0(x) (((x) & 0xFF00) == 0xC400)
|
||||
#define IS_MOVW_GBRREF_R0(x) (((x) & 0xFF00) == 0xC500)
|
||||
#define IS_MOVL_GBRREF_R0(x) (((x) & 0xFF00) == 0xC600)
|
||||
#define IS_MOVA_PCREL_R0(x) (((x) & 0xFF00) == 0xC700)
|
||||
#define IS_BINLOGIC_IMM_R0(x) (((x) & 0xFC00) == 0xC800) // match C{8,9,A,B}00
|
||||
#define IS_BINLOGIC_IMM_GBR(x) (((x) & 0xFC00) == 0xCC00) // match C{C,D,E,F}00 : *.b #imm, @(R0,gbr)
|
||||
|
||||
/* Compute PC-relative displacement for branch instructions */
|
||||
#define GET_BRA_OFFSET(x) ((x)&0x0fff)
|
||||
#define GET_BTF_OFFSET(x) ((x)&0x00ff)
|
||||
#define GET_BRA_OFFSET(x) ((x) & 0x0fff)
|
||||
#define GET_BTF_OFFSET(x) ((x) & 0x00ff)
|
||||
|
||||
/* Compute reg nr for BRAF,BSR,BSRF,JMP,JSR */
|
||||
#define GET_TARGET_REG(x) (((x) >> 8) & 0x0f)
|
||||
|
|
|
|||
|
|
@ -1656,16 +1656,16 @@ static void anop_esil(RzAnalysis *a, RzAnalysisOp *op, const ut8 *buf, int len,
|
|||
ut64 xor = 0;
|
||||
switch (bitsize) {
|
||||
case 8:
|
||||
xor = 0xff;
|
||||
xor= 0xff;
|
||||
break;
|
||||
case 16:
|
||||
xor = 0xffff;
|
||||
xor= 0xffff;
|
||||
break;
|
||||
case 32:
|
||||
xor = 0xffffffff;
|
||||
xor= 0xffffffff;
|
||||
break;
|
||||
case 64:
|
||||
xor = 0xffffffffffffffff;
|
||||
xor= 0xffffffffffffffff;
|
||||
break;
|
||||
default:
|
||||
RZ_LOG_ERROR("x86: unhandled neg bitsize %" PFMT32d "\n", bitsize);
|
||||
|
|
|
|||
|
|
@ -134,8 +134,7 @@ typedef struct rz_bin_elf_section_t {
|
|||
typedef struct Elf_(rz_bin_elf_segment_t) {
|
||||
Elf_(Phdr) data;
|
||||
bool is_valid;
|
||||
}
|
||||
RzBinElfSegment;
|
||||
} RzBinElfSegment;
|
||||
|
||||
typedef struct rz_bin_elf_symbol_t {
|
||||
ut64 paddr;
|
||||
|
|
@ -173,8 +172,7 @@ typedef struct Elf_(rz_bin_elf_note_file_t) {
|
|||
Elf_(Addr) end_vaddr;
|
||||
Elf_(Addr) file_off;
|
||||
char *file;
|
||||
}
|
||||
RzBinElfNoteFile;
|
||||
} RzBinElfNoteFile;
|
||||
|
||||
/**
|
||||
* \brief Parsed PT_NOTE of type NT_PRSTATUS.
|
||||
|
|
@ -193,8 +191,7 @@ typedef struct Elf_(rz_bin_elf_note_t) {
|
|||
RzBinElfNoteFile file; //< for type == NT_FILE
|
||||
RzBinElfNotePrStatus prstatus; //< for type = NT_PRSTATUS
|
||||
};
|
||||
}
|
||||
RzBinElfNote;
|
||||
} RzBinElfNote;
|
||||
|
||||
typedef struct rz_bin_elf_strtab RzBinElfStrtab;
|
||||
|
||||
|
|
|
|||
|
|
@ -853,7 +853,7 @@ static RzBinReloc *reloc_convert_ppc64(ELFOBJ *bin, RzBinElfReloc *rel, ut64 GOT
|
|||
// MIPS64 has subtypes for relocs but we do not support it.
|
||||
#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
|
||||
#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
|
||||
#define ELF64_MIPS_R_TYPE(i) ((i)&0xff)
|
||||
#define ELF64_MIPS_R_TYPE(i) ((i) & 0xff)
|
||||
|
||||
static RzBinReloc *reloc_convert_mips(ELFOBJ *bin, RzBinElfReloc *rel, ut64 GOT) {
|
||||
ut64 P = rel->vaddr;
|
||||
|
|
|
|||
|
|
@ -891,7 +891,7 @@ static void patch_reloc_arm64(RZ_INOUT RzBuffer *buf_patched, const ut64 patch_a
|
|||
// AARCH64-specific defines
|
||||
// Take the PAGE component of an address or offset.
|
||||
#define PG(x) ((x) & ~0xFFFULL)
|
||||
#define PG_OFFSET(x) ((x)&0xFFFULL)
|
||||
#define PG_OFFSET(x) ((x) & 0xFFFULL)
|
||||
#define ADR_IMM_MASK1 (((1U << 2) - 1) << 29)
|
||||
#define ADR_IMM_MASK2 (((1U << 19) - 1) << 5)
|
||||
#define ADR_IMM_MASK3 (((1U << 19) - 1) << 2)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -102,7 +102,7 @@ typedef struct java_attribute_module_t {
|
|||
ut16 module_version_index;
|
||||
|
||||
ut16 requires_count;
|
||||
ModuleRequire *requires;
|
||||
ModuleRequire * requires;
|
||||
|
||||
ut16 exports_count;
|
||||
ModuleExport *exports;
|
||||
|
|
|
|||
|
|
@ -1055,7 +1055,7 @@ static inline uint16_t GET_LIBRARY_ORDINAL(uint16_t n_desc) {
|
|||
}
|
||||
|
||||
static inline void SET_LIBRARY_ORDINAL(uint16_t *n_desc, uint8_t ordinal) {
|
||||
*n_desc = (((*n_desc) & 0x00ff) | (((ordinal)&0xff) << 8));
|
||||
*n_desc = (((*n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8));
|
||||
}
|
||||
|
||||
static inline uint8_t GET_COMM_ALIGN(uint16_t n_desc) {
|
||||
|
|
|
|||
|
|
@ -70,8 +70,7 @@ RzPVector /*<RzBinAddr *>*/ *PE_(rz_bin_mdmp_pe_get_entrypoint)(struct PE_(rz_bi
|
|||
rz_pvector_push(ret, ptr);
|
||||
}
|
||||
|
||||
PE_(add_tls_callbacks)
|
||||
(pe_bin->bin, ret);
|
||||
PE_(add_tls_callbacks)(pe_bin->bin, ret);
|
||||
|
||||
free(entry);
|
||||
|
||||
|
|
@ -135,8 +134,7 @@ RzPVector /*<RzBinSection *>*/ *PE_(rz_bin_mdmp_pe_get_sections)(struct PE_(rz_b
|
|||
rz_pvector_free(ret);
|
||||
return NULL;
|
||||
}
|
||||
PE_(rz_bin_pe_check_sections)
|
||||
(pe_bin->bin, §ions);
|
||||
PE_(rz_bin_pe_check_sections)(pe_bin->bin, §ions);
|
||||
for (i = 0; !sections[i].last; i++) {
|
||||
if (!(ptr = RZ_NEW0(RzBinSection))) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#define METHOD_LIST_FLAG_IS_PREOPT 0x3
|
||||
#define METHOD_LIST_ENTSIZE_FLAG_MASK 0xffff0003
|
||||
|
||||
#define RO_DATA_PTR(x) ((x)&FAST_DATA_MASK)
|
||||
#define RO_DATA_PTR(x) ((x) & FAST_DATA_MASK)
|
||||
|
||||
#if RZ_BIN_MACH064
|
||||
#define rz_buf_read_mach0_ut_offset rz_buf_read_ble64_offset
|
||||
|
|
|
|||
|
|
@ -60,29 +60,19 @@ static int bin_pe_init(RzBinPEObj *bin) {
|
|||
return false;
|
||||
}
|
||||
bin->sections = PE_(rz_bin_pe_get_sections)(bin);
|
||||
PE_(bin_pe_init_imports)
|
||||
(bin);
|
||||
PE_(bin_pe_init_exports)
|
||||
(bin);
|
||||
PE_(bin_pe_init_resource)
|
||||
(bin);
|
||||
PE_(bin_pe_init_security)
|
||||
(bin);
|
||||
PE_(bin_pe_init_relocs)
|
||||
(bin);
|
||||
PE_(bin_pe_init_imports)(bin);
|
||||
PE_(bin_pe_init_exports)(bin);
|
||||
PE_(bin_pe_init_resource)(bin);
|
||||
PE_(bin_pe_init_security)(bin);
|
||||
PE_(bin_pe_init_relocs)(bin);
|
||||
|
||||
bin->big_endian = PE_(rz_bin_pe_is_big_endian)(bin);
|
||||
|
||||
PE_(bin_pe_init_rich_info)
|
||||
(bin);
|
||||
PE_(bin_pe_init_tls)
|
||||
(bin);
|
||||
PE_(bin_pe_init_clr)
|
||||
(bin);
|
||||
PE_(bin_pe_init_overlay)
|
||||
(bin);
|
||||
PE_(bin_pe_parse_resource)
|
||||
(bin);
|
||||
PE_(bin_pe_init_rich_info)(bin);
|
||||
PE_(bin_pe_init_tls)(bin);
|
||||
PE_(bin_pe_init_clr)(bin);
|
||||
PE_(bin_pe_init_overlay)(bin);
|
||||
PE_(bin_pe_parse_resource)(bin);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +86,7 @@ void *PE_(rz_bin_pe_free)(RzBinPEObj *bin) {
|
|||
free(bin->export_directory);
|
||||
free(bin->import_directory);
|
||||
free(bin->resource_directory);
|
||||
PE_(free_security_directory)
|
||||
(bin->security_directory);
|
||||
PE_(free_security_directory)(bin->security_directory);
|
||||
free(bin->delay_import_directory);
|
||||
bin_pe_dotnet_destroy_clr(bin->clr);
|
||||
free(bin->tls_directory);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ typedef struct rz_bin_pe_reloc_block_t {
|
|||
|
||||
// encoding is 12 bits for type and 4 bits for offset.
|
||||
#define PE_RELOC_ENT_TYPE(val) ((val) >> 12)
|
||||
#define PE_RELOC_ENT_OFFSET(val) ((val)&0xfff)
|
||||
#define PE_RELOC_ENT_OFFSET(val) ((val) & 0xfff)
|
||||
|
||||
typedef struct rz_bin_pe_reloc_ent_t {
|
||||
ut16 raw_val; ///< Type + Offset of the relocation entry
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ static void free_StringFileInfo(StringFileInfo *stringFileInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
#define align32(x) x = (((x)&0x3) == 0) ? (x) : ((x) & ~0x3) + 0x4;
|
||||
#define align32(x) x = (((x) & 0x3) == 0) ? (x) : ((x) & ~0x3) + 0x4;
|
||||
|
||||
static void free_VS_VERSIONINFO(PE_VS_VERSIONINFO *vs_VersionInfo) {
|
||||
if (vs_VersionInfo) {
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ RzBinPEObj *rz_bin_pemixed_init_dos(RzBinPEObj *pe_bin) {
|
|||
|
||||
RzBinPEObj *sub_bin_dos = RZ_NEW0(RzBinPEObj);
|
||||
if (!(sub_bin_dos->b = rz_buf_new_with_bytes(tmp_buf, pe_hdr_off))) {
|
||||
PE_(rz_bin_pe_free)
|
||||
(sub_bin_dos);
|
||||
PE_(rz_bin_pe_free)(sub_bin_dos);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -141,8 +140,7 @@ void *rz_bin_pemixed_free(struct rz_bin_pemixed_obj_t *bin) {
|
|||
// only one free is nessescary since they all point
|
||||
// to the same original pe struct
|
||||
// possible memleak here
|
||||
PE_(rz_bin_pe_free)
|
||||
(bin->sub_bin_net);
|
||||
PE_(rz_bin_pe_free)(bin->sub_bin_net);
|
||||
if (bin->sub_bin_dos) {
|
||||
rz_buf_free(bin->sub_bin_dos->b); // dos is the only one with its own buf
|
||||
}
|
||||
|
|
@ -169,26 +167,22 @@ struct rz_bin_pemixed_obj_t *rz_bin_pemixed_from_bytes_new(const ut8 *buf, ut64
|
|||
bin->size = size;
|
||||
pe_bin = PE_(rz_bin_pe_new_buf)(bin->b, true);
|
||||
if (!pe_bin) {
|
||||
PE_(rz_bin_pe_free)
|
||||
(pe_bin);
|
||||
PE_(rz_bin_pe_free)(pe_bin);
|
||||
return rz_bin_pemixed_free(bin);
|
||||
}
|
||||
if (!pe_bin->clr || !pe_bin->clr->header) {
|
||||
PE_(rz_bin_pe_free)
|
||||
(pe_bin);
|
||||
PE_(rz_bin_pe_free)(pe_bin);
|
||||
return rz_bin_pemixed_free(bin);
|
||||
}
|
||||
// check if binary only contains managed code
|
||||
// check implemented here cuz we need to intialize
|
||||
// the pe header to access the clr hdr
|
||||
if (check_il_only(pe_bin->clr->header->Flags)) {
|
||||
PE_(rz_bin_pe_free)
|
||||
(pe_bin);
|
||||
PE_(rz_bin_pe_free)(pe_bin);
|
||||
return rz_bin_pemixed_free(bin);
|
||||
}
|
||||
if (!rz_bin_pemixed_init(bin, pe_bin)) {
|
||||
PE_(rz_bin_pe_free)
|
||||
(pe_bin);
|
||||
PE_(rz_bin_pe_free)(pe_bin);
|
||||
return rz_bin_pemixed_free(bin);
|
||||
}
|
||||
return bin;
|
||||
|
|
|
|||
|
|
@ -1176,7 +1176,7 @@ static RzBinInfo *info(RzBinFile *bf) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool add_fields_aux(ELFOBJ *bin, RzPVector /*<RzBinField *>*/ *result, ut64 offset, size_t size, const char *name, char *(get_value)(ELFOBJ *bin), const char *fmt) {
|
||||
static bool add_fields_aux(ELFOBJ *bin, RzPVector /*<RzBinField *>*/ *result, ut64 offset, size_t size, const char *name, char *(get_value)(ELFOBJ * bin), const char *fmt) {
|
||||
char *value = get_value(bin);
|
||||
if (!value) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ static bool pe_load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *
|
|||
}
|
||||
|
||||
static void pe_destroy(RzBinFile *bf) {
|
||||
PE_(rz_bin_pe_free)
|
||||
((struct PE_(rz_bin_pe_obj_t) *)bf->o->bin_obj);
|
||||
PE_(rz_bin_pe_free)((struct PE_(rz_bin_pe_obj_t) *)bf->o->bin_obj);
|
||||
}
|
||||
|
||||
static ut64 pe_baddr(RzBinFile *bf) {
|
||||
|
|
@ -166,8 +165,7 @@ static RzPVector /*<RzBinMap *>*/ *pe_maps(RzBinFile *bf) {
|
|||
map->vsize = RZ_ROUND(map->psize, 4096);
|
||||
map->perm = RZ_PERM_R;
|
||||
rz_pvector_push(ret, map);
|
||||
PE_(rz_bin_pe_check_sections)
|
||||
(bin, §ions);
|
||||
PE_(rz_bin_pe_check_sections)(bin, §ions);
|
||||
for (size_t i = 0; !sections[i].last; i++) {
|
||||
RzBinMap *map = RZ_NEW0(RzBinMap);
|
||||
if (!map) {
|
||||
|
|
@ -210,8 +208,7 @@ static RzPVector /*<RzBinSection *>*/ *pe_sections(RzBinFile *bf) {
|
|||
rz_pvector_free(ret);
|
||||
return NULL;
|
||||
}
|
||||
PE_(rz_bin_pe_check_sections)
|
||||
(bin, §ions);
|
||||
PE_(rz_bin_pe_check_sections)(bin, §ions);
|
||||
for (i = 0; !sections[i].last; i++) {
|
||||
if (!(ptr = RZ_NEW0(RzBinSection))) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -134,8 +134,7 @@ static void print_offset_in_binary_line_bar(RzAnnotatedCode *code, ut64 offset,
|
|||
width--;
|
||||
}
|
||||
} else {
|
||||
PRINT_COLOR(PALETTE(offset)
|
||||
: Color_GREEN);
|
||||
PRINT_COLOR(PALETTE(offset) : Color_GREEN);
|
||||
rz_cons_printf(fmt[width], offset);
|
||||
PRINT_COLOR(Color_RESET);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
#define LOAD_BSS_MALLOC 0
|
||||
|
||||
#define IS_MODE_SET(mode) ((mode)&RZ_MODE_SET)
|
||||
#define IS_MODE_SIMPLE(mode) ((mode)&RZ_MODE_SIMPLE)
|
||||
#define IS_MODE_SIMPLEST(mode) ((mode)&RZ_MODE_SIMPLEST)
|
||||
#define IS_MODE_JSON(mode) ((mode)&RZ_MODE_JSON)
|
||||
#define IS_MODE_RZCMD(mode) ((mode)&RZ_MODE_RIZINCMD)
|
||||
#define IS_MODE_SET(mode) ((mode) & RZ_MODE_SET)
|
||||
#define IS_MODE_SIMPLE(mode) ((mode) & RZ_MODE_SIMPLE)
|
||||
#define IS_MODE_SIMPLEST(mode) ((mode) & RZ_MODE_SIMPLEST)
|
||||
#define IS_MODE_JSON(mode) ((mode) & RZ_MODE_JSON)
|
||||
#define IS_MODE_RZCMD(mode) ((mode) & RZ_MODE_RIZINCMD)
|
||||
#define IS_MODE_NORMAL(mode) (!(mode))
|
||||
|
||||
// dup from cmd_info
|
||||
|
|
|
|||
|
|
@ -280,8 +280,7 @@ static RZ_BORROW RzList /*<RzList *>*/ *GH(fill_tcache_entries)(RzCore *core, GH
|
|||
bin->bin_num = i;
|
||||
bin->chunks = rz_list_newf((RzListFree)GH(rz_heap_chunk_free));
|
||||
if (!bin->chunks) {
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
goto error;
|
||||
}
|
||||
rz_list_append(tcache_bins_list, bin);
|
||||
|
|
@ -292,8 +291,7 @@ static RZ_BORROW RzList /*<RzList *>*/ *GH(fill_tcache_entries)(RzCore *core, GH
|
|||
// get first chunk
|
||||
RzHeapChunkListItem *chunk = RZ_NEW0(RzHeapChunkListItem);
|
||||
if (!chunk) {
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
goto error;
|
||||
}
|
||||
chunk->addr = (ut64)(entry - GH(HDR_SZ));
|
||||
|
|
@ -367,8 +365,7 @@ static void GH(print_tcache)(RzCore *core, RzList /*<RzList *>*/ *bins, PJ *pj,
|
|||
if (!pj) {
|
||||
rz_cons_printf(" -> ");
|
||||
}
|
||||
GH(print_heap_chunk_simple)
|
||||
(core, pos->addr, NULL, pj);
|
||||
GH(print_heap_chunk_simple)(core, pos->addr, NULL, pj);
|
||||
if (!pj) {
|
||||
rz_cons_newline();
|
||||
}
|
||||
|
|
@ -527,8 +524,7 @@ RZ_API bool GH(rz_heap_update_main_arena)(RzCore *core, GHT m_arena, MallocState
|
|||
if (!cmain_arena->next) {
|
||||
return false;
|
||||
}
|
||||
GH(update_arena_with_tc)
|
||||
(cmain_arena, main_arena);
|
||||
GH(update_arena_with_tc)(cmain_arena, main_arena);
|
||||
free(cmain_arena);
|
||||
} else {
|
||||
GH(RzHeap_MallocState) *cmain_arena = RZ_NEW0(GH(RzHeap_MallocState));
|
||||
|
|
@ -536,8 +532,7 @@ RZ_API bool GH(rz_heap_update_main_arena)(RzCore *core, GHT m_arena, MallocState
|
|||
return false;
|
||||
}
|
||||
(void)rz_io_read_at(core->io, m_arena, (ut8 *)cmain_arena, sizeof(GH(RzHeap_MallocState)));
|
||||
GH(update_arena_without_tc)
|
||||
(cmain_arena, main_arena);
|
||||
GH(update_arena_without_tc)(cmain_arena, main_arena);
|
||||
free(cmain_arena);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -783,8 +778,7 @@ RZ_API bool GH(rz_heap_resolve_main_arena)(RzCore *core, GHT *m_arena) {
|
|||
return false;
|
||||
}
|
||||
|
||||
GH(get_brks)
|
||||
(core, &brk_start, &brk_end);
|
||||
GH(get_brks)(core, &brk_start, &brk_end);
|
||||
if (brk_start == GHT_MAX || brk_end == GHT_MAX) {
|
||||
RZ_LOG_ERROR("core: no heap section\n");
|
||||
return false;
|
||||
|
|
@ -798,16 +792,14 @@ RZ_API bool GH(rz_heap_resolve_main_arena)(RzCore *core, GHT *m_arena) {
|
|||
}
|
||||
|
||||
if (main_arena_sym != GHT_MAX) {
|
||||
GH(rz_heap_update_main_arena)
|
||||
(core, main_arena_sym, ta);
|
||||
GH(rz_heap_update_main_arena)(core, main_arena_sym, ta);
|
||||
*m_arena = main_arena_sym;
|
||||
core->dbg->main_arena_resolved = true;
|
||||
free(ta);
|
||||
return true;
|
||||
}
|
||||
while (addr_srch < libc_addr_end) {
|
||||
GH(rz_heap_update_main_arena)
|
||||
(core, addr_srch, ta);
|
||||
GH(rz_heap_update_main_arena)(core, addr_srch, ta);
|
||||
if (ta->top > brk_start && ta->top < brk_end &&
|
||||
ta->system_mem == heap_sz) {
|
||||
|
||||
|
|
@ -866,18 +858,15 @@ static bool GH(parse_tcache_from_addr)(RzCore *core, const GHT tls_addr, const G
|
|||
#endif
|
||||
tcache_heap = GH(tcache_new)(core);
|
||||
if (!GH(tcache_read)(core, tcache_guess, tcache_heap)) {
|
||||
GH(tcache_free)
|
||||
(tcache_heap);
|
||||
GH(tcache_free)(tcache_heap);
|
||||
tcache_heap = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (tcache_heap != NULL) {
|
||||
RzList *bins = GH(fill_tcache_entries)(core, tcache_heap);
|
||||
GH(print_tcache)
|
||||
(core, bins, NULL, tid);
|
||||
GH(tcache_free)
|
||||
(tcache_heap);
|
||||
GH(print_tcache)(core, bins, NULL, tid);
|
||||
GH(tcache_free)(tcache_heap);
|
||||
tcache_heap = NULL;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -954,8 +943,7 @@ static void GH(resolve_tcache_perthread)(RZ_NONNULL RzCore *core) {
|
|||
RzList *thread_list = rz_debug_native_threads(dbg, dbg->pid);
|
||||
RzDebugPid *thread_dbg = rz_debug_get_thread(thread_list, th->pid);
|
||||
if (thread_dbg) {
|
||||
GH(parse_tls_data)
|
||||
(core, thread_dbg, tid);
|
||||
GH(parse_tls_data)(core, thread_dbg, tid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -965,15 +953,13 @@ RZ_API RZ_OWN bool GH(resolve_heap_tcache)(RZ_NONNULL RzCore *core, GHT arena_ba
|
|||
RzDebug *dbg = core->dbg;
|
||||
|
||||
if (dbg->threads) {
|
||||
GH(resolve_tcache_perthread)
|
||||
(core);
|
||||
GH(resolve_tcache_perthread)(core);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only main thread is present
|
||||
RzList *bins = GH(rz_heap_tcache_content)(core, arena_base);
|
||||
GH(print_tcache)
|
||||
(core, bins, NULL, 0);
|
||||
GH(print_tcache)(core, bins, NULL, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1263,8 +1249,7 @@ static int GH(print_double_linked_list_bin)(RzCore *core, MallocState *main_aren
|
|||
return -1;
|
||||
}
|
||||
|
||||
GH(get_brks)
|
||||
(core, &brk_start, &brk_end);
|
||||
GH(get_brks)(core, &brk_start, &brk_end);
|
||||
if (brk_start == GHT_MAX || brk_end == GHT_MAX) {
|
||||
RZ_LOG_ERROR("core: no heap section\n");
|
||||
return -1;
|
||||
|
|
@ -1313,8 +1298,7 @@ static void GH(print_heap_bin)(RzCore *core, GHT m_arena, MallocState *main_aren
|
|||
PRINT_YA("Bins {\n");
|
||||
for (size_t i = 0; i < NBINS - 1; i++) {
|
||||
PRINTF_YA(" Bin %03" PFMTSZu ":\n", i);
|
||||
GH(print_double_linked_list_bin)
|
||||
(core, main_arena, m_arena, offset, i, print_graph);
|
||||
GH(print_double_linked_list_bin)(core, main_arena, m_arena, offset, i, print_graph);
|
||||
}
|
||||
PRINT_YA("\n}\n");
|
||||
} else {
|
||||
|
|
@ -1324,8 +1308,7 @@ static void GH(print_heap_bin)(RzCore *core, GHT m_arena, MallocState *main_aren
|
|||
return;
|
||||
}
|
||||
PRINTF_YA(" Bin %03" PFMT64u ":\n", (ut64)num_bin);
|
||||
GH(print_double_linked_list_bin)
|
||||
(core, main_arena, m_arena, offset, num_bin, print_graph);
|
||||
GH(print_double_linked_list_bin)(core, main_arena, m_arena, offset, num_bin, print_graph);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -1359,8 +1342,7 @@ RZ_API RzHeapBin *GH(rz_heap_fastbin_content)(RzCore *core, MallocState *main_ar
|
|||
free(cnk);
|
||||
return heap_bin;
|
||||
}
|
||||
GH(get_brks)
|
||||
(core, &brk_start, &brk_end);
|
||||
GH(get_brks)(core, &brk_start, &brk_end);
|
||||
heap_bin->fd = next;
|
||||
if (brk_start == GHT_MAX || brk_end == GHT_MAX) {
|
||||
free(cnk);
|
||||
|
|
@ -1468,8 +1450,7 @@ void GH(print_heap_fastbin)(RzCore *core, GHT m_arena, MallocState *main_arena,
|
|||
if (!pj) {
|
||||
rz_cons_printf(" -> ");
|
||||
}
|
||||
GH(print_heap_chunk_simple)
|
||||
(core, pos->addr, NULL, pj);
|
||||
GH(print_heap_chunk_simple)(core, pos->addr, NULL, pj);
|
||||
if (!pj) {
|
||||
rz_cons_newline();
|
||||
}
|
||||
|
|
@ -1482,8 +1463,7 @@ void GH(print_heap_fastbin)(RzCore *core, GHT m_arena, MallocState *main_arena,
|
|||
pj_end(pj);
|
||||
pj_end(pj);
|
||||
}
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1553,8 +1533,7 @@ RZ_API RzList /*<RzHeapBin *>*/ *GH(rz_heap_tcache_content)(RzCore *core, GHT ar
|
|||
}
|
||||
|
||||
GHT brk_start = GHT_MAX, brk_end = GHT_MAX, initial_brk = GHT_MAX;
|
||||
GH(get_brks)
|
||||
(core, &brk_start, &brk_end);
|
||||
GH(get_brks)(core, &brk_start, &brk_end);
|
||||
GHT fc_offset = GH(tcache_chunk_size)(core, brk_start);
|
||||
initial_brk = brk_start + fc_offset;
|
||||
if (brk_start == GHT_MAX || brk_end == GHT_MAX || initial_brk == GHT_MAX) {
|
||||
|
|
@ -1587,8 +1566,7 @@ RZ_API RzList /*<RzHeapBin *>*/ *GH(rz_heap_tcache_content)(RzCore *core, GHT ar
|
|||
// Get rz_tcache struct
|
||||
GH(RTcache) *tcache = GH(tcache_new)(core);
|
||||
if (!GH(tcache_read)(core, tcache_start, tcache)) {
|
||||
GH(tcache_free)
|
||||
(tcache);
|
||||
GH(tcache_free)(tcache);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1608,8 +1586,7 @@ RZ_API RzList /*<RzHeapBin *>*/ *GH(rz_heap_tcache_content)(RzCore *core, GHT ar
|
|||
bin->bin_num = i;
|
||||
bin->chunks = rz_list_newf((RzListFree)GH(rz_heap_chunk_free));
|
||||
if (!bin->chunks) {
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
@ -1673,8 +1650,7 @@ static void GH(print_tcache_content)(RzCore *core, GHT arena_base, GHT main_aren
|
|||
}
|
||||
PRINTF_YA("0x%" PFMT64x "\n", (ut64)arena_base);
|
||||
}
|
||||
GH(print_tcache)
|
||||
(core, bins, pj, 0);
|
||||
GH(print_tcache)(core, bins, pj, 0);
|
||||
}
|
||||
|
||||
void GH(print_malloc_states)(RzCore *core, GHT m_arena, MallocState *main_arena, bool json) {
|
||||
|
|
@ -1792,8 +1768,7 @@ void GH(print_malloc_info)(RzCore *core, GHT m_state, GHT malloc_state) {
|
|||
return;
|
||||
}
|
||||
rz_io_read_at(core->io, h_info, (ut8 *)heap_info, sizeof(GH(RzHeapInfo)));
|
||||
GH(print_inst_minfo)
|
||||
(core, heap_info, h_info);
|
||||
GH(print_inst_minfo)(core, heap_info, h_info);
|
||||
MallocState *ms = RZ_NEW0(MallocState);
|
||||
if (!ms) {
|
||||
free(heap_info);
|
||||
|
|
@ -1809,8 +1784,7 @@ void GH(print_malloc_info)(RzCore *core, GHT m_state, GHT malloc_state) {
|
|||
if ((ms->top >> 16) << 16 != h_info) {
|
||||
h_info = (ms->top >> 16) << 16;
|
||||
rz_io_read_at(core->io, h_info, (ut8 *)heap_info, sizeof(GH(RzHeapInfo)));
|
||||
GH(print_inst_minfo)
|
||||
(core, heap_info, h_info);
|
||||
GH(print_inst_minfo)(core, heap_info, h_info);
|
||||
}
|
||||
}
|
||||
free(heap_info);
|
||||
|
|
@ -1868,8 +1842,7 @@ RZ_API RzHeapBin *GH(rz_heap_bin_content)(RzCore *core, MallocState *main_arena,
|
|||
bin->chunks = rz_list_newf(free);
|
||||
GH(RzHeapChunk) *head = RZ_NEW0(GH(RzHeapChunk));
|
||||
if (!head) {
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1880,13 +1853,11 @@ RZ_API RzHeapBin *GH(rz_heap_bin_content)(RzCore *core, MallocState *main_arena,
|
|||
}
|
||||
GH(RzHeapChunk) *cnk = RZ_NEW0(GH(RzHeapChunk));
|
||||
if (!cnk) {
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
return NULL;
|
||||
}
|
||||
GHT brk_start = GHT_MAX, brk_end = GHT_MAX, initial_brk = GHT_MAX;
|
||||
GH(get_brks)
|
||||
(core, &brk_start, &brk_end);
|
||||
GH(get_brks)(core, &brk_start, &brk_end);
|
||||
if (brk_start == GHT_MAX || brk_end == GHT_MAX) {
|
||||
free(cnk);
|
||||
return bin;
|
||||
|
|
@ -1936,8 +1907,7 @@ static int GH(print_bin_content)(RzCore *core, MallocState *main_arena, int bin_
|
|||
RzHeapBin *bin = GH(rz_heap_bin_content)(core, main_arena, bin_num, m_arena);
|
||||
RzList *chunks = bin->chunks;
|
||||
if (rz_list_length(chunks) == 0) {
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
return 0;
|
||||
}
|
||||
int chunks_cnt = 0;
|
||||
|
|
@ -1967,8 +1937,7 @@ static int GH(print_bin_content)(RzCore *core, MallocState *main_arena, int bin_
|
|||
if (!pj) {
|
||||
rz_cons_printf(" -> ");
|
||||
}
|
||||
GH(print_heap_chunk_simple)
|
||||
(core, pos->addr, NULL, pj);
|
||||
GH(print_heap_chunk_simple)(core, pos->addr, NULL, pj);
|
||||
if (!pj) {
|
||||
rz_cons_newline();
|
||||
}
|
||||
|
|
@ -1977,8 +1946,7 @@ static int GH(print_bin_content)(RzCore *core, MallocState *main_arena, int bin_
|
|||
if (bin->message) {
|
||||
PRINTF_RA("%s\n", bin->message);
|
||||
}
|
||||
GH(rz_heap_bin_free)
|
||||
(bin);
|
||||
GH(rz_heap_bin_free)(bin);
|
||||
if (pj) {
|
||||
pj_end(pj);
|
||||
}
|
||||
|
|
@ -2098,31 +2066,26 @@ static void GH(print_main_arena_bins)(RzCore *core, GHT m_arena, MallocState *ma
|
|||
pj_ka(pj, "bins");
|
||||
}
|
||||
if (format == RZ_HEAP_BIN_ANY || format == RZ_HEAP_BIN_TCACHE) {
|
||||
GH(print_tcache_content)
|
||||
(core, m_arena, main_arena_base, pj);
|
||||
GH(print_tcache_content)(core, m_arena, main_arena_base, pj);
|
||||
rz_cons_newline();
|
||||
}
|
||||
if (format == RZ_HEAP_BIN_ANY || format == RZ_HEAP_BIN_FAST) {
|
||||
char *input = rz_str_newlen("", 1);
|
||||
bool main_arena_only = true;
|
||||
GH(print_heap_fastbin)
|
||||
(core, m_arena, main_arena, global_max_fast, input, main_arena_only, pj);
|
||||
GH(print_heap_fastbin)(core, m_arena, main_arena, global_max_fast, input, main_arena_only, pj);
|
||||
free(input);
|
||||
rz_cons_newline();
|
||||
}
|
||||
if (format == RZ_HEAP_BIN_ANY || format == RZ_HEAP_BIN_UNSORTED) {
|
||||
GH(print_unsortedbin_description)
|
||||
(core, m_arena, main_arena, pj);
|
||||
GH(print_unsortedbin_description)(core, m_arena, main_arena, pj);
|
||||
rz_cons_newline();
|
||||
}
|
||||
if (format == RZ_HEAP_BIN_ANY || format == RZ_HEAP_BIN_SMALL) {
|
||||
GH(print_smallbin_description)
|
||||
(core, m_arena, main_arena, pj);
|
||||
GH(print_smallbin_description)(core, m_arena, main_arena, pj);
|
||||
rz_cons_newline();
|
||||
}
|
||||
if (format == RZ_HEAP_BIN_ANY || format == RZ_HEAP_BIN_LARGE) {
|
||||
GH(print_largebin_description)
|
||||
(core, m_arena, main_arena, pj);
|
||||
GH(print_largebin_description)(core, m_arena, main_arena, pj);
|
||||
rz_cons_newline();
|
||||
}
|
||||
if (json) {
|
||||
|
|
@ -2215,8 +2178,7 @@ RZ_API RzList /*<RzHeapChunkListItem *>*/ *GH(rz_heap_chunks_list)(RzCore *core,
|
|||
int glibc_version = core->dbg->glibc_version;
|
||||
|
||||
if (m_arena == m_state) {
|
||||
GH(get_brks)
|
||||
(core, &brk_start, &brk_end);
|
||||
GH(get_brks)(core, &brk_start, &brk_end);
|
||||
if (tcache) {
|
||||
initial_brk = ((brk_start >> 12) << 12) + GH(HDR_SZ);
|
||||
if (rz_config_get_b(core->config, "cfg.debug")) {
|
||||
|
|
@ -2324,8 +2286,7 @@ RZ_API RzList /*<RzHeapChunkListItem *>*/ *GH(rz_heap_chunks_list)(RzCore *core,
|
|||
free(cnk_next);
|
||||
return chunks;
|
||||
}
|
||||
GH(tcache_read)
|
||||
(core, tcache_initial_brk, tcache_heap);
|
||||
GH(tcache_read)(core, tcache_initial_brk, tcache_heap);
|
||||
size_t i;
|
||||
for (i = 0; i < TCACHE_MAX_BINS; i++) {
|
||||
int count = GH(tcache_get_count)(tcache_heap, i);
|
||||
|
|
@ -2355,8 +2316,7 @@ RZ_API RzList /*<RzHeapChunkListItem *>*/ *GH(rz_heap_chunks_list)(RzCore *core,
|
|||
}
|
||||
}
|
||||
}
|
||||
GH(tcache_free)
|
||||
(tcache_heap);
|
||||
GH(tcache_free)(tcache_heap);
|
||||
}
|
||||
|
||||
next_chunk += size_tmp;
|
||||
|
|
@ -2477,8 +2437,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_chunks_print_handler)(RzCore *core, int argc,
|
|||
}
|
||||
GHT brk_start, brk_end;
|
||||
if (m_arena == m_state) {
|
||||
GH(get_brks)
|
||||
(core, &brk_start, &brk_end);
|
||||
GH(get_brks)(core, &brk_start, &brk_end);
|
||||
|
||||
} else {
|
||||
brk_start = ((m_state >> 16) << 16);
|
||||
|
|
@ -2534,8 +2493,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_chunks_print_handler)(RzCore *core, int argc,
|
|||
}
|
||||
rz_list_foreach (chunks, iter, pos) {
|
||||
if (mode == RZ_OUTPUT_MODE_STANDARD || mode == RZ_OUTPUT_MODE_LONG) {
|
||||
GH(print_heap_chunk_simple)
|
||||
(core, pos->addr, pos->status, NULL);
|
||||
GH(print_heap_chunk_simple)(core, pos->addr, pos->status, NULL);
|
||||
rz_cons_newline();
|
||||
if (mode == RZ_OUTPUT_MODE_LONG) {
|
||||
int size = 0x10;
|
||||
|
|
@ -2577,8 +2535,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_chunks_print_handler)(RzCore *core, int argc,
|
|||
}
|
||||
}
|
||||
if (mode == RZ_OUTPUT_MODE_STANDARD || mode == RZ_OUTPUT_MODE_LONG) {
|
||||
GH(print_heap_chunk_simple)
|
||||
(core, main_arena->top, "free", NULL);
|
||||
GH(print_heap_chunk_simple)(core, main_arena->top, "free", NULL);
|
||||
PRINT_RA("[top]");
|
||||
rz_cons_printf("[brk_start: ");
|
||||
PRINTF_YA("0x%" PFMT64x, (ut64)brk_start);
|
||||
|
|
@ -2644,8 +2601,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_main_arena_print_handler)(RzCore *core, int argc, c
|
|||
free(main_arena);
|
||||
return RZ_CMD_STATUS_ERROR;
|
||||
}
|
||||
GH(print_arena_stats)
|
||||
(core, m_state, main_arena, global_max_fast, mode);
|
||||
GH(print_arena_stats)(core, m_state, main_arena, global_max_fast, mode);
|
||||
free(main_arena);
|
||||
return RZ_CMD_STATUS_OK;
|
||||
}
|
||||
|
|
@ -2661,8 +2617,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_chunk_print_handler)(RzCore *core, int argc, c
|
|||
return RZ_CMD_STATUS_ERROR;
|
||||
}
|
||||
ut64 addr = core->offset;
|
||||
GH(print_heap_chunk)
|
||||
(core, addr);
|
||||
GH(print_heap_chunk)(core, addr);
|
||||
free(main_arena);
|
||||
return RZ_CMD_STATUS_OK;
|
||||
}
|
||||
|
|
@ -2692,8 +2647,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_info_print_handler)(RzCore *core, int argc, co
|
|||
free(main_arena);
|
||||
return RZ_CMD_STATUS_ERROR;
|
||||
}
|
||||
GH(print_malloc_info)
|
||||
(core, m_arena, m_state);
|
||||
GH(print_malloc_info)(core, m_arena, m_state);
|
||||
free(main_arena);
|
||||
return RZ_CMD_STATUS_OK;
|
||||
}
|
||||
|
|
@ -2747,8 +2701,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_bins_list_print_handler)(RzCore *core, const c
|
|||
free(dup);
|
||||
return RZ_CMD_STATUS_ERROR;
|
||||
}
|
||||
GH(print_heap_bin)
|
||||
(core, m_state, main_arena, dup, mode == RZ_OUTPUT_MODE_GRAPH);
|
||||
GH(print_heap_bin)(core, m_state, main_arena, dup, mode == RZ_OUTPUT_MODE_GRAPH);
|
||||
} else {
|
||||
PRINT_RA("This address is not part of the arenas\n");
|
||||
free(main_arena);
|
||||
|
|
@ -2792,8 +2745,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_fastbins_print_handler)(void *data, const char
|
|||
free(main_arena);
|
||||
return RZ_CMD_STATUS_ERROR;
|
||||
}
|
||||
GH(print_heap_fastbin)
|
||||
(core, m_state, main_arena, global_max_fast, dup, main_arena_only, NULL);
|
||||
GH(print_heap_fastbin)(core, m_state, main_arena, global_max_fast, dup, main_arena_only, NULL);
|
||||
} else {
|
||||
PRINT_RA("This address is not part of the arenas\n");
|
||||
free(dup);
|
||||
|
|
@ -2851,8 +2803,7 @@ RZ_IPI RzCmdStatus GH(rz_cmd_heap_arena_bins_print_handler)(RzCore *core, int ar
|
|||
bin_format = RZ_HEAP_BIN_LARGE;
|
||||
}
|
||||
}
|
||||
GH(print_main_arena_bins)
|
||||
(core, m_state, main_arena, m_arena, global_max_fast, bin_format, json);
|
||||
GH(print_main_arena_bins)(core, m_state, main_arena, m_arena, global_max_fast, bin_format, json);
|
||||
free(main_arena);
|
||||
return RZ_CMD_STATUS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,16 +497,13 @@ static void GH(jemalloc_get_runs)(RzCore *core, const char *input) {
|
|||
static void GH(cmd_dbg_map_jemalloc)(RzCore *core, char dmx_variant, const char *arg) {
|
||||
switch (dmx_variant) {
|
||||
case 'a': // dmxa
|
||||
GH(jemalloc_print_narenas)
|
||||
(core, arg);
|
||||
GH(jemalloc_print_narenas)(core, arg);
|
||||
break;
|
||||
case 'b': // dmxb
|
||||
GH(jemalloc_get_bins)
|
||||
(core, arg);
|
||||
GH(jemalloc_get_bins)(core, arg);
|
||||
break;
|
||||
case 'c': // dmxc
|
||||
GH(jemalloc_get_chunks)
|
||||
(core, arg);
|
||||
GH(jemalloc_get_chunks)(core, arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@
|
|||
}
|
||||
|
||||
#define UPDATE_FLAGS(hb, flags) \
|
||||
if (((flags)&0xf1) || ((flags)&0x0200)) { \
|
||||
if (((flags) & 0xf1) || ((flags) & 0x0200)) { \
|
||||
hb->dwFlags = LF32_FIXED; \
|
||||
} else if ((flags)&0x20) { \
|
||||
} else if ((flags) & 0x20) { \
|
||||
hb->dwFlags = LF32_MOVEABLE; \
|
||||
} else if ((flags)&0x0100) { \
|
||||
} else if ((flags) & 0x0100) { \
|
||||
hb->dwFlags = LF32_FREE; \
|
||||
} \
|
||||
hb->dwFlags |= ((flags) >> SHIFT) << SHIFT;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ RZ_API void rz_des_pc2(RZ_OUT ut32 *keylo, RZ_OUT ut32 *keyhi, RZ_IN ut32 deslo,
|
|||
((deslo << 2) & 0x00020000) | ((deslo >> 10) & 0x00010000) |
|
||||
((deshi >> 13) & 0x00002000) | ((deshi >> 4) & 0x00001000) |
|
||||
((deshi << 6) & 0x00000800) | ((deshi >> 1) & 0x00000400) |
|
||||
((deshi >> 14) & 0x00000200) | ((deshi)&0x00000100) |
|
||||
((deshi >> 14) & 0x00000200) | ((deshi) & 0x00000100) |
|
||||
((deshi >> 5) & 0x00000020) | ((deshi >> 10) & 0x00000010) |
|
||||
((deshi >> 3) & 0x00000008) | ((deshi >> 18) & 0x00000004) |
|
||||
((deshi >> 26) & 0x00000002) | ((deshi >> 24) & 0x00000001);
|
||||
|
|
@ -266,7 +266,7 @@ RZ_API void rz_des_pc2(RZ_OUT ut32 *keylo, RZ_OUT ut32 *keyhi, RZ_IN ut32 deslo,
|
|||
((deslo << 15) & 0x00020000) | ((deslo >> 4) & 0x00010000) |
|
||||
((deshi >> 2) & 0x00002000) | ((deshi << 8) & 0x00001000) |
|
||||
((deshi >> 14) & 0x00000808) | ((deshi >> 9) & 0x00000400) |
|
||||
((deshi)&0x00000200) | ((deshi << 7) & 0x00000100) |
|
||||
((deshi) & 0x00000200) | ((deshi << 7) & 0x00000100) |
|
||||
((deshi >> 7) & 0x00000020) | ((deshi >> 3) & 0x00000011) |
|
||||
((deshi << 2) & 0x00000004) | ((deshi >> 21) & 0x00000002);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ static ut32 F(struct blowfish_state *const state, const ut32 inbuf) {
|
|||
ut8 a = (inbuf >> 24) & 0xff;
|
||||
ut8 b = (inbuf >> 16) & 0xff;
|
||||
ut8 c = (inbuf >> 8) & 0xff;
|
||||
ut8 d = (inbuf)&0xff;
|
||||
ut8 d = (inbuf) & 0xff;
|
||||
return ((state->s[0][a] + state->s[1][b]) ^ state->s[2][c]) + state->s[3][d];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,10 +114,8 @@ typedef struct {
|
|||
} LIB_ITEM, *PLIB_ITEM;
|
||||
|
||||
// Vista
|
||||
BOOL(WINAPI *w32_ProcessIdToSessionId)
|
||||
(DWORD, DWORD *);
|
||||
BOOL(WINAPI *w32_QueryFullProcessImageNameW)
|
||||
(HANDLE, DWORD, LPWSTR, PDWORD);
|
||||
BOOL(WINAPI *w32_ProcessIdToSessionId)(DWORD, DWORD *);
|
||||
BOOL(WINAPI *w32_QueryFullProcessImageNameW)(HANDLE, DWORD, LPWSTR, PDWORD);
|
||||
// Internal NT functions (winternl.h)
|
||||
NTSTATUS(WINAPI *w32_NtQuerySystemInformation)
|
||||
(ULONG, PVOID, ULONG, PULONG);
|
||||
|
|
@ -129,14 +127,11 @@ NTSTATUS(WINAPI *w32_NtQueryObject)
|
|||
(HANDLE, ULONG, PVOID, ULONG, PULONG);
|
||||
// fpu access API (Windows 7)
|
||||
ut64(WINAPI *w32_GetEnabledXStateFeatures)();
|
||||
BOOL(WINAPI *w32_InitializeContext)
|
||||
(PVOID, DWORD, PCONTEXT *, PDWORD);
|
||||
BOOL(WINAPI *w32_GetXStateFeaturesMask)
|
||||
(PCONTEXT Context, PDWORD64);
|
||||
BOOL(WINAPI *w32_InitializeContext)(PVOID, DWORD, PCONTEXT *, PDWORD);
|
||||
BOOL(WINAPI *w32_GetXStateFeaturesMask)(PCONTEXT Context, PDWORD64);
|
||||
PVOID(WINAPI *w32_LocateXStateFeature)
|
||||
(PCONTEXT Context, DWORD, PDWORD);
|
||||
BOOL(WINAPI *w32_SetXStateFeaturesMask)
|
||||
(PCONTEXT Context, DWORD64);
|
||||
BOOL(WINAPI *w32_SetXStateFeaturesMask)(PCONTEXT Context, DWORD64);
|
||||
|
||||
// APIs
|
||||
int w32_init(RzDebug *dbg);
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ static void emit_string(RzEgg *egg, const char *dstvar, const char *str, int j)
|
|||
|
||||
/* XXX: Hack: Adjust offset in RZ_BP correctly for 64b addresses */
|
||||
#define BPOFF (RZ_SZ - 4)
|
||||
#define M32(x) (unsigned int)((x)&0xffffffff)
|
||||
#define M32(x) (unsigned int)((x) & 0xffffffff)
|
||||
/* XXX: Assumes sizeof(ut32) == 4 */
|
||||
for (i = 4; i <= oj; i += 4) {
|
||||
/* XXX endian issues (non-portable asm) */
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ static void sm3_process_block(const void *buffer, ut64 len, sm3_ctx_t *ctx) {
|
|||
ctx->total[0] += low_len;
|
||||
ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < low_len);
|
||||
|
||||
#define rol(x, n) (((x) << ((n)&31)) | ((x) >> ((32 - (n)) & 31)))
|
||||
#define rol(x, n) (((x) << ((n) & 31)) | ((x) >> ((32 - (n)) & 31)))
|
||||
#define P0(x) ((x) ^ rol(x, 9) ^ rol(x, 17))
|
||||
#define P1(x) ((x) ^ rol(x, 15) ^ rol(x, 23))
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#define plugin_crca_preset_small_block(crcalgo, preset) \
|
||||
static bool plugin_crca_##crcalgo##_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) { \
|
||||
rz_return_val_if_fail(data &&digest, false); \
|
||||
rz_return_val_if_fail(data && digest, false); \
|
||||
RzCrc ctx; \
|
||||
crc_init_preset(&ctx, preset); \
|
||||
ut8 *dgst = malloc(plugin_crca_digest_size(&ctx)); \
|
||||
|
|
|
|||
|
|
@ -30,21 +30,21 @@
|
|||
|
||||
#define rz_fletcher_common_plugin_update(bits) \
|
||||
static bool plugin_fletcher##bits##_update(void *context, const ut8 *data, ut64 size) { \
|
||||
rz_return_val_if_fail(context &&data, false); \
|
||||
rz_return_val_if_fail(context && data, false); \
|
||||
rz_fletcher##bits##_update((RzFletcher##bits *)context, data, size); \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define rz_fletcher_common_plugin_final(bits) \
|
||||
static bool plugin_fletcher##bits##_final(void *context, ut8 *digest) { \
|
||||
rz_return_val_if_fail(context &&digest, false); \
|
||||
rz_return_val_if_fail(context && digest, false); \
|
||||
rz_fletcher##bits##_final(digest, (RzFletcher##bits *)context); \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define rz_fletcher_common_plugin_small_block(bits) \
|
||||
static bool plugin_fletcher##bits##_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) { \
|
||||
rz_return_val_if_fail(data &&digest, false); \
|
||||
rz_return_val_if_fail(data && digest, false); \
|
||||
ut8 *dgst = malloc(RZ_HASH_FLETCHER##bits##_DIGEST_SIZE); \
|
||||
if (!dgst) { \
|
||||
return false; \
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ typedef enum {
|
|||
} RzBinLanguage;
|
||||
|
||||
#define RZ_BIN_LANGUAGE_MASK(x) ((x) & ~RZ_BIN_LANGUAGE_BLOCKS)
|
||||
#define RZ_BIN_LANGUAGE_HAS_BLOCKS(x) ((x)&RZ_BIN_LANGUAGE_BLOCKS)
|
||||
#define RZ_BIN_LANGUAGE_HAS_BLOCKS(x) ((x) & RZ_BIN_LANGUAGE_BLOCKS)
|
||||
|
||||
enum {
|
||||
RZ_BIN_CLASS_PRIVATE,
|
||||
|
|
|
|||
|
|
@ -764,8 +764,8 @@ typedef struct rz_cons_t {
|
|||
#define Colors_PLAIN \
|
||||
{ \
|
||||
Color_BLACK, Color_RED, Color_WHITE, \
|
||||
Color_GREEN, Color_MAGENTA, Color_YELLOW, \
|
||||
Color_CYAN, Color_BLUE, Color_GRAY \
|
||||
Color_GREEN, Color_MAGENTA, Color_YELLOW, \
|
||||
Color_CYAN, Color_BLUE, Color_GRAY \
|
||||
}
|
||||
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -71,9 +71,8 @@ struct rz_magic {
|
|||
#define INDIROFFADD 0x04 /* if '>&(' appears */
|
||||
#define UNSIGNED 0x08 /* comparison is unsigned */
|
||||
#define NOSPACE 0x10 /* suppress space character before output */
|
||||
#define BINTEST 0x20 /* test is for a binary type (set only \
|
||||
for top-level tests) */
|
||||
#define TEXTTEST 0 /* for passing to file_softmagic */
|
||||
#define BINTEST 0x20 /* test is for a binary type (set only for top-level tests) */
|
||||
#define TEXTTEST 0 /* for passing to file_softmagic */
|
||||
|
||||
ut8 dummy1;
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ extern "C" {
|
|||
typedef int (*PrintfCallback)(const char *str, ...) RZ_PRINTF_CHECK(1, 2);
|
||||
|
||||
/* compile-time introspection helpers */
|
||||
#define CTO(y, z) ((size_t) & ((y *)0)->z)
|
||||
#define CTO(y, z) ((size_t)&((y *)0)->z)
|
||||
#define CTA(x, y, z) (x + CTO(y, z))
|
||||
#define CTI(x, y, z) (*((size_t *)(CTA(x, y, z))))
|
||||
#define CTS(x, y, z, t, v) \
|
||||
|
|
@ -664,7 +664,7 @@ static inline void rz_run_call10(void *fcn, void *arg1, void *arg2, void *arg3,
|
|||
|
||||
#ifndef container_of
|
||||
#ifdef _MSC_VER
|
||||
#define container_of(ptr, type, member) ((type *)((char *)(ptr)-offsetof(type, member)))
|
||||
#define container_of(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member)))
|
||||
#else
|
||||
#define container_of(ptr, type, member) ((type *)((char *)(__typeof__(((type *)0)->member) *){ ptr } - offsetof(type, member)))
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ typedef struct _utX {
|
|||
#define UT32_ALIGN(x) (x + (x - (x % sizeof(ut32))))
|
||||
#define UT16_ALIGN(x) (x + (x - (x % sizeof(ut16))))
|
||||
|
||||
#define UT32_LO(x) ((ut32)((x)&UT32_MAX))
|
||||
#define UT32_LO(x) ((ut32)((x) & UT32_MAX))
|
||||
#define UT32_HI(x) ((ut32)(((ut64)(x)) >> 32) & UT32_MAX)
|
||||
|
||||
#define RZ_BETWEEN(x, y, z) (((y) >= (x)) && ((y) <= (z)))
|
||||
|
|
@ -148,7 +148,7 @@ typedef struct _utX {
|
|||
/* copied from bithacks.h */
|
||||
#define B_IS_SET(x, n) (((x) & (1ULL << (n))) ? 1 : 0)
|
||||
#define B_SET(x, n) ((x) |= (1ULL << (n)))
|
||||
#define B_EVEN(x) (((x)&1) == 0)
|
||||
#define B_EVEN(x) (((x) & 1) == 0)
|
||||
#define B_ODD(x) (!B_EVEN((x)))
|
||||
#define B_UNSET(x, n) ((x) &= ~(1ULL << (n)))
|
||||
#define B_TOGGLE(x, n) ((x) ^= (1ULL << (n)))
|
||||
|
|
|
|||
|
|
@ -113,8 +113,7 @@ typedef struct Ht_(kv) {
|
|||
VALUE_TYPE value;
|
||||
ut32 key_len;
|
||||
ut32 value_len;
|
||||
}
|
||||
HT_(Kv);
|
||||
} HT_(Kv);
|
||||
|
||||
typedef void (*HT_(FiniKv))(HT_(Kv) *kv, void *user);
|
||||
typedef KEY_TYPE (*HT_(DupKey))(const KEY_TYPE);
|
||||
|
|
@ -129,8 +128,7 @@ typedef bool (*HT_(ForeachCallback))(void *user, const KEY_TYPE, const VALUE_TYP
|
|||
typedef struct Ht_(bucket_t) {
|
||||
HT_(Kv) *arr;
|
||||
ut32 count;
|
||||
}
|
||||
HT_(Bucket);
|
||||
} HT_(Bucket);
|
||||
|
||||
/**
|
||||
* Options contain all the settings of the hashtable.
|
||||
|
|
@ -155,8 +153,7 @@ typedef struct Ht_(options_t) {
|
|||
void *finiKV_user; ///< RZ_NULLABLE. User data which is passed into finiKV.
|
||||
size_t elem_size; ///< Size of each HtKv element (useful for subclassing like SdbKv).
|
||||
///< Zero value means to use default size of HtKv.
|
||||
}
|
||||
HT_(Options);
|
||||
} HT_(Options);
|
||||
|
||||
/* Ht is the hashtable structure */
|
||||
typedef struct Ht_(t) {
|
||||
|
|
@ -165,24 +162,21 @@ typedef struct Ht_(t) {
|
|||
HT_(Bucket) *table; ///< Actual table.
|
||||
ut32 prime_idx;
|
||||
HT_(Options) opt;
|
||||
}
|
||||
HtName_(Ht);
|
||||
} HtName_(Ht);
|
||||
|
||||
typedef struct Ht_(iter_mut_t) {
|
||||
HtName_(Ht) *ht; ///< The hash table to iterate over.
|
||||
ut32 ti; ///< Table index
|
||||
ut32 bi; ///< Bucket index
|
||||
HT_(Kv) *kv; ///< Current Key-Value-pair.
|
||||
}
|
||||
HT_(IterMutState);
|
||||
} HT_(IterMutState);
|
||||
|
||||
typedef struct Ht_(iter_t) {
|
||||
const HtName_(Ht) *ht; ///< The hash table to iterate over.
|
||||
ut32 ti; ///< Table index
|
||||
ut32 bi; ///< Bucket index
|
||||
const HT_(Kv) *kv; ///< Current Key-Value-pair.
|
||||
}
|
||||
HT_(IterState);
|
||||
} HT_(IterState);
|
||||
|
||||
// Create a new Ht with the provided Options
|
||||
RZ_API RZ_OWN HtName_(Ht) *Ht_(new_opt)(RZ_NONNULL HT_(Options) *opt);
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ static inline st64 rz_buf_sleb128_at(RzBuffer *b, ut64 addr, st64 *v) {
|
|||
|
||||
#define DEFINE_RZ_BUF_READ_BLE(size) \
|
||||
static inline bool rz_buf_read_ble##size(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_OUT ut##size *result, bool big_endian) { \
|
||||
rz_return_val_if_fail(b &&result, false); \
|
||||
rz_return_val_if_fail(b && result, false); \
|
||||
\
|
||||
ut8 tmp[sizeof(ut##size)]; \
|
||||
if (rz_buf_read(b, tmp, sizeof(tmp)) != sizeof(tmp)) { \
|
||||
|
|
@ -200,7 +200,7 @@ static inline st64 rz_buf_sleb128_at(RzBuffer *b, ut64 addr, st64 *v) {
|
|||
} \
|
||||
\
|
||||
static inline bool rz_buf_read_ble##size##_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut##size *result, bool big_endian) { \
|
||||
rz_return_val_if_fail(b &&result, false); \
|
||||
rz_return_val_if_fail(b && result, false); \
|
||||
\
|
||||
ut8 tmp[sizeof(ut##size)]; \
|
||||
if (rz_buf_read_at(b, addr, tmp, sizeof(tmp)) != sizeof(tmp)) { \
|
||||
|
|
@ -254,7 +254,7 @@ DEFINE_RZ_BUF_WRITE_BLE(128)
|
|||
|
||||
#define DEFINE_RZ_BUF_READ_OFFSET_BLE(size) \
|
||||
static inline bool rz_buf_read_ble##size##_offset(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_INOUT ut64 *offset, RZ_NONNULL RZ_OUT ut##size *result, bool big_endian) { \
|
||||
rz_return_val_if_fail(b &&offset &&result, false); \
|
||||
rz_return_val_if_fail(b && offset && result, false); \
|
||||
if (!rz_buf_read_ble##size##_at(b, *offset, result, big_endian)) { \
|
||||
return false; \
|
||||
} \
|
||||
|
|
@ -273,7 +273,7 @@ static inline bool rz_buf_read_offset(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_INOU
|
|||
|
||||
#define DEFINE_RZ_BUF_WRITE_OFFSET_BLE(size) \
|
||||
static inline bool rz_buf_write_ble##size##_offset(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_INOUT ut64 *offset, ut##size value, bool big_endian) { \
|
||||
rz_return_val_if_fail(b &&offset, false); \
|
||||
rz_return_val_if_fail(b && offset, false); \
|
||||
if (!rz_buf_write_ble##size##_at(b, *offset, value, big_endian)) { \
|
||||
return false; \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -154,7 +154,9 @@ RZ_API void rz_sys_backtrace(void);
|
|||
#ifndef rz_sys_breakpoint
|
||||
#if __WINDOWS__
|
||||
#define rz_sys_breakpoint() \
|
||||
{ __debugbreak(); }
|
||||
{ \
|
||||
__debugbreak(); \
|
||||
}
|
||||
#else
|
||||
#if __GNUC__
|
||||
#define rz_sys_breakpoint() __builtin_trap()
|
||||
|
|
|
|||
|
|
@ -389,14 +389,14 @@ static char *__system(RzIO *io, RzIODesc *fd, const char *cmd) {
|
|||
rz_sys_dlclose(lib);
|
||||
}
|
||||
if (argc == 1) {
|
||||
size_t (*cb)() = (size_t(*)())cbptr;
|
||||
size_t (*cb)() = (size_t (*)())cbptr;
|
||||
if (cb) {
|
||||
result = cb();
|
||||
} else {
|
||||
eprintf("No callback defined\n");
|
||||
}
|
||||
} else if (argc == 2) {
|
||||
size_t (*cb)(size_t a0) = (size_t(*)(size_t))cbptr;
|
||||
size_t (*cb)(size_t a0) = (size_t (*)(size_t))cbptr;
|
||||
if (cb) {
|
||||
ut64 a0 = rz_num_math(NULL, rz_str_word_get0(argv, 1));
|
||||
result = cb(a0);
|
||||
|
|
@ -404,7 +404,7 @@ static char *__system(RzIO *io, RzIODesc *fd, const char *cmd) {
|
|||
eprintf("No callback defined\n");
|
||||
}
|
||||
} else if (argc == 3) {
|
||||
size_t (*cb)(size_t a0, size_t a1) = (size_t(*)(size_t, size_t))cbptr;
|
||||
size_t (*cb)(size_t a0, size_t a1) = (size_t (*)(size_t, size_t))cbptr;
|
||||
ut64 a0 = rz_num_math(NULL, rz_str_word_get0(argv, 1));
|
||||
ut64 a1 = rz_num_math(NULL, rz_str_word_get0(argv, 2));
|
||||
if (cb) {
|
||||
|
|
@ -414,7 +414,7 @@ static char *__system(RzIO *io, RzIODesc *fd, const char *cmd) {
|
|||
}
|
||||
} else if (argc == 4) {
|
||||
size_t (*cb)(size_t a0, size_t a1, size_t a2) =
|
||||
(size_t(*)(size_t, size_t, size_t))cbptr;
|
||||
(size_t (*)(size_t, size_t, size_t))cbptr;
|
||||
ut64 a0 = rz_num_math(NULL, rz_str_word_get0(argv, 1));
|
||||
ut64 a1 = rz_num_math(NULL, rz_str_word_get0(argv, 2));
|
||||
ut64 a2 = rz_num_math(NULL, rz_str_word_get0(argv, 3));
|
||||
|
|
@ -425,7 +425,7 @@ static char *__system(RzIO *io, RzIODesc *fd, const char *cmd) {
|
|||
}
|
||||
} else if (argc == 5) {
|
||||
size_t (*cb)(size_t a0, size_t a1, size_t a2, size_t a3) =
|
||||
(size_t(*)(size_t, size_t, size_t, size_t))cbptr;
|
||||
(size_t (*)(size_t, size_t, size_t, size_t))cbptr;
|
||||
ut64 a0 = rz_num_math(NULL, rz_str_word_get0(argv, 1));
|
||||
ut64 a1 = rz_num_math(NULL, rz_str_word_get0(argv, 2));
|
||||
ut64 a2 = rz_num_math(NULL, rz_str_word_get0(argv, 3));
|
||||
|
|
@ -437,7 +437,7 @@ static char *__system(RzIO *io, RzIODesc *fd, const char *cmd) {
|
|||
}
|
||||
} else if (argc == 6) {
|
||||
size_t (*cb)(size_t a0, size_t a1, size_t a2, size_t a3, size_t a4) =
|
||||
(size_t(*)(size_t, size_t, size_t, size_t, size_t))cbptr;
|
||||
(size_t (*)(size_t, size_t, size_t, size_t, size_t))cbptr;
|
||||
ut64 a0 = rz_num_math(NULL, rz_str_word_get0(argv, 1));
|
||||
ut64 a1 = rz_num_math(NULL, rz_str_word_get0(argv, 2));
|
||||
ut64 a2 = rz_num_math(NULL, rz_str_word_get0(argv, 3));
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ RZ_LIB_VERSION(rz_magic);
|
|||
#ifdef _MSC_VER
|
||||
#include <io.h>
|
||||
#include <sys\stat.h>
|
||||
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#define S_IFIFO (-1)
|
||||
#define S_ISFIFO(m) (((m)&S_IFIFO) == S_IFIFO)
|
||||
#define S_ISFIFO(m) (((m) & S_IFIFO) == S_IFIFO)
|
||||
#define MAXPATHLEN 255
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define NELEM(N, ELEMPER) ((N + (ELEMPER)-1) / (ELEMPER))
|
||||
#define NELEM(N, ELEMPER) ((N + (ELEMPER) - 1) / (ELEMPER))
|
||||
#define BV_ELEM_SIZE 8U
|
||||
|
||||
// optimization for reversing 8 bits which uses 32 bits
|
||||
// https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
|
||||
#define reverse_byte(x) ((((x)*0x0802LU & 0x22110LU) | ((x)*0x8020LU & 0x88440LU)) * 0x10101LU >> 16)
|
||||
#define reverse_byte(x) ((((x) * 0x0802LU & 0x22110LU) | ((x) * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16)
|
||||
|
||||
// https://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious
|
||||
// With changes.
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ RZ_API void rz_mem_memzero(void *dst, size_t l) {
|
|||
#else
|
||||
memset(dst, 0, l);
|
||||
__asm__ volatile("" ::"r"(dst)
|
||||
: "memory");
|
||||
: "memory");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,14 +294,11 @@ static bool isAllZeros(const ut8 *buf, int len) {
|
|||
RZ_API void rz_print_hexii(RzPrint *rp, ut64 addr, const ut8 *buf, int len, int step) {
|
||||
PrintfCallback p = (PrintfCallback)rp->cb_printf;
|
||||
bool c = rp->flags & RZ_PRINT_FLAGS_COLOR;
|
||||
const char *color_0xff = c ? (Pal(rp, b0xff)
|
||||
: Color_RED)
|
||||
const char *color_0xff = c ? (Pal(rp, b0xff) : Color_RED)
|
||||
: "";
|
||||
const char *color_text = c ? (Pal(rp, btext)
|
||||
: Color_MAGENTA)
|
||||
const char *color_text = c ? (Pal(rp, btext) : Color_MAGENTA)
|
||||
: "";
|
||||
const char *color_other = c ? (Pal(rp, other)
|
||||
: Color_WHITE)
|
||||
const char *color_other = c ? (Pal(rp, other) : Color_WHITE)
|
||||
: "";
|
||||
const char *color_reset = c ? Color_RESET : "";
|
||||
int i, j;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ static int pack_kvlen(ut8 *buf, ut32 klen, ut32 vlen) {
|
|||
return 0;
|
||||
}
|
||||
buf[0] = (ut8)klen;
|
||||
buf[1] = (ut8)((vlen)&0xff);
|
||||
buf[1] = (ut8)((vlen) & 0xff);
|
||||
buf[2] = (ut8)((vlen >> 8) & 0xff);
|
||||
buf[3] = (ut8)((vlen >> 16) & 0xff);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -107,10 +107,10 @@ static void write_path(int fd, RzList /*<char *>*/ *path) {
|
|||
write_(fd, "/", 1);
|
||||
}
|
||||
ESCAPE_LOOP(fd, path_token,
|
||||
ESCAPE('\\', "\\", 1);
|
||||
ESCAPE('/', "/", 1);
|
||||
ESCAPE('\n', "n", 1);
|
||||
ESCAPE('\r', "r", 1););
|
||||
ESCAPE('\\', "\\", 1);
|
||||
ESCAPE('/', "/", 1);
|
||||
ESCAPE('\n', "n", 1);
|
||||
ESCAPE('\r', "r", 1););
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,17 +120,17 @@ static void write_key(int fd, const char *k) {
|
|||
write_(fd, "\\", 1);
|
||||
}
|
||||
ESCAPE_LOOP(fd, k,
|
||||
ESCAPE('\\', "\\", 1);
|
||||
ESCAPE('=', "=", 1);
|
||||
ESCAPE('\n', "n", 1);
|
||||
ESCAPE('\r', "r", 1););
|
||||
ESCAPE('\\', "\\", 1);
|
||||
ESCAPE('=', "=", 1);
|
||||
ESCAPE('\n', "n", 1);
|
||||
ESCAPE('\r', "r", 1););
|
||||
}
|
||||
|
||||
static void write_value(int fd, const char *v) {
|
||||
ESCAPE_LOOP(fd, v,
|
||||
ESCAPE('\\', "\\", 1);
|
||||
ESCAPE('\n', "n", 1);
|
||||
ESCAPE('\r', "r", 1););
|
||||
ESCAPE('\\', "\\", 1);
|
||||
ESCAPE('\n', "n", 1);
|
||||
ESCAPE('\r', "r", 1););
|
||||
}
|
||||
#undef FLUSH
|
||||
#undef ESCAPE_LOOP
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ RZ_LIB_VERSION(rz_util);
|
|||
#else
|
||||
#define RZ_SYS_ASM_START_ROP() \
|
||||
__asm__ __volatile__("leaq %0, %%rsp; ret" \
|
||||
: \
|
||||
: "m"(*bufptr));
|
||||
: \
|
||||
: "m"(*bufptr));
|
||||
#endif
|
||||
#elif __i386__
|
||||
#ifdef _MSC_VER
|
||||
|
|
@ -142,8 +142,8 @@ RZ_LIB_VERSION(rz_util);
|
|||
#else
|
||||
#define RZ_SYS_ASM_START_ROP() \
|
||||
__asm__ __volatile__("leal %0, %%esp; ret" \
|
||||
: \
|
||||
: "m"(*bufptr));
|
||||
: \
|
||||
: "m"(*bufptr));
|
||||
#endif
|
||||
#else
|
||||
#define RZ_SYS_ASM_START_ROP() \
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ RZ_API ut64 rz_num_get_input_value(RzNum *num, const char *input_value) {
|
|||
return value;
|
||||
}
|
||||
|
||||
#define NIBBLE_TO_HEX(n) (((n)&0xf) > 9 ? 'a' + ((n)&0xf) - 10 : '0' + ((n)&0xf))
|
||||
#define NIBBLE_TO_HEX(n) (((n) & 0xf) > 9 ? 'a' + ((n) & 0xf) - 10 : '0' + ((n) & 0xf))
|
||||
static int escape_char(char *dst, char byte) {
|
||||
const char escape_map[] = "abtnvfr";
|
||||
if (byte >= 7 && byte <= 13) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "arch.h"
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMBER)
|
||||
#define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
||||
enum Breakpoint {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
#ifndef HAVE_EPRINTF
|
||||
#include <stdio.h>
|
||||
#define eprintf(...) \
|
||||
{ fprintf(stderr, ##__VA_ARGS__); }
|
||||
{ \
|
||||
fprintf(stderr, ##__VA_ARGS__); \
|
||||
}
|
||||
#define HAVE_EPRINTF 1
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ bool test_rz_bv_init_signed(void) {
|
|||
bool test_rz_bv_logic(void) {
|
||||
RzBitVector *x, *y;
|
||||
RzBitVector *result;
|
||||
RzBitVector *and, * or, *xor, *neg, *not, *ls, *rs, *ls_fill, *rs_fill;
|
||||
RzBitVector *and, *or, *xor, *neg, *not, *ls, *rs, *ls_fill, *rs_fill;
|
||||
|
||||
// x : 0101 0101
|
||||
x = rz_bv_new(8);
|
||||
|
|
@ -196,11 +196,11 @@ bool test_rz_bv_logic(void) {
|
|||
rz_bv_set(y, 7, true);
|
||||
|
||||
// and : 0000 0001
|
||||
and = rz_bv_new(8);
|
||||
and= rz_bv_new(8);
|
||||
rz_bv_set(and, 0, true);
|
||||
|
||||
// xor : 1111 1100
|
||||
xor = rz_bv_new(8);
|
||||
xor= rz_bv_new(8);
|
||||
rz_bv_toggle_all(xor);
|
||||
rz_bv_set(xor, 0, false);
|
||||
rz_bv_set(xor, 1, false);
|
||||
|
|
@ -211,7 +211,7 @@ bool test_rz_bv_logic(void) {
|
|||
rz_bv_set(or, 1, false);
|
||||
|
||||
// not of x : 1010 1010
|
||||
not = rz_bv_new(8);
|
||||
not= rz_bv_new(8);
|
||||
rz_bv_set(not, 1, true);
|
||||
rz_bv_set(not, 3, true);
|
||||
rz_bv_set(not, 5, true);
|
||||
|
|
@ -267,9 +267,9 @@ bool test_rz_bv_logic(void) {
|
|||
rz_bv_free(xor);
|
||||
|
||||
result = rz_bv_not(x);
|
||||
mu_assert("not x", is_equal_bv(result, not ));
|
||||
mu_assert("not x", is_equal_bv(result, not));
|
||||
rz_bv_free(result);
|
||||
rz_bv_free(not );
|
||||
rz_bv_free(not);
|
||||
|
||||
result = rz_bv_neg(x);
|
||||
mu_assert("neg x", is_equal_bv(result, neg));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <sys/user.h>
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(type, field) ((size_t) & ((type *)0)->field)
|
||||
#define offsetof(type, field) ((size_t)&((type *)0)->field)
|
||||
#endif
|
||||
|
||||
#endif //__linux__
|
||||
|
|
|
|||
Loading…
Reference in a new issue