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
|
||||
|
|
|
|||
|
|
@ -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; \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -516,10 +516,8 @@ typedef struct
|
|||
#define SHN_UNDEF 0 /* Undefined section */
|
||||
#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
|
||||
#define SHN_LOPROC 0xff00 /* Start of processor-specific */
|
||||
#define SHN_BEFORE 0xff00 /* Order section before all others \
|
||||
(Solaris). */
|
||||
#define SHN_AFTER 0xff01 /* Order section after all others \
|
||||
(Solaris). */
|
||||
#define SHN_BEFORE 0xff00 /* Order section before all others (Solaris). */
|
||||
#define SHN_AFTER 0xff01 /* Order section after all others (Solaris). */
|
||||
#define SHN_HIPROC 0xff1f /* End of processor-specific */
|
||||
#define SHN_LOOS 0xff20 /* Start of OS-specific */
|
||||
#define SHN_HIOS 0xff3f /* End of OS-specific */
|
||||
|
|
@ -576,17 +574,14 @@ typedef struct
|
|||
#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
|
||||
#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
|
||||
#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
|
||||
#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling \
|
||||
required */
|
||||
#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling required */
|
||||
#define SHF_GROUP (1 << 9) /* Section is member of a group. */
|
||||
#define SHF_TLS (1 << 10) /* Section hold thread-local data. */
|
||||
#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
|
||||
#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
|
||||
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
|
||||
#define SHF_ORDERED (1 << 30) /* Special ordering requirement \
|
||||
(Solaris). */
|
||||
#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless \
|
||||
referenced or allocated (Solaris).*/
|
||||
#define SHF_ORDERED (1 << 30) /* Special ordering requirement (Solaris). */
|
||||
#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless referenced or allocated (Solaris).*/
|
||||
|
||||
/* Section compression header. Used when SHF_COMPRESSED is set. */
|
||||
|
||||
|
|
@ -662,8 +657,7 @@ typedef struct
|
|||
#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
|
||||
#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
|
||||
#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
|
||||
#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy \
|
||||
loaded */
|
||||
#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy loaded */
|
||||
/* Syminfo version values. */
|
||||
#define SYMINFO_NONE 0
|
||||
#define SYMINFO_CURRENT 1
|
||||
|
|
@ -672,8 +666,8 @@ typedef struct
|
|||
/* How to extract and insert information held in the st_info field. */
|
||||
|
||||
#define ELF32_ST_BIND(val) (((unsigned char)(val)) >> 4)
|
||||
#define ELF32_ST_TYPE(val) ((val)&0xf)
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type)&0xf))
|
||||
#define ELF32_ST_TYPE(val) ((val) & 0xf)
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
|
||||
#define ELF64_ST_BIND(val) ELF32_ST_BIND(val)
|
||||
|
|
@ -716,7 +710,7 @@ typedef struct
|
|||
|
||||
/* How to extract and insert information held in the st_other field. */
|
||||
|
||||
#define ELF32_ST_VISIBILITY(o) ((o)&0x03)
|
||||
#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
|
||||
|
||||
/* For ELF64 the definitions are the same. */
|
||||
#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY(o)
|
||||
|
|
@ -765,11 +759,11 @@ typedef struct
|
|||
/* How to extract and insert information held in the r_info field. */
|
||||
|
||||
#define ELF32_R_SYM(val) ((val) >> 8)
|
||||
#define ELF32_R_TYPE(val) ((val)&0xff)
|
||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type)&0xff))
|
||||
#define ELF32_R_TYPE(val) ((val) & 0xff)
|
||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
|
||||
|
||||
#define ELF64_R_SYM(i) ((i) >> 32)
|
||||
#define ELF64_R_TYPE(i) ((i)&0xffffffff)
|
||||
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
|
||||
#define ELF64_R_INFO(sym, type) ((((Elf64_Xword)(sym)) << 32) + (type))
|
||||
|
||||
/* Program segment header. */
|
||||
|
|
@ -839,8 +833,7 @@ typedef struct
|
|||
/* Legal values for note segment descriptor types for core files. */
|
||||
|
||||
#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
|
||||
#define NT_PRFPREG 2 /* Contains copy of fpregset \
|
||||
struct. */
|
||||
#define NT_PRFPREG 2 /* Contains copy of fpregset struct. */
|
||||
#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
|
||||
#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
|
||||
#define NT_PRXREG 4 /* Contains copy of prxregset struct */
|
||||
|
|
@ -856,10 +849,8 @@ typedef struct
|
|||
#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
|
||||
#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
|
||||
#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */
|
||||
#define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, \
|
||||
size might increase */
|
||||
#define NT_FILE 0x46494c45 /* Contains information about mapped \
|
||||
files */
|
||||
#define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t, size might increase */
|
||||
#define NT_FILE 0x46494c45 /* Contains information about mapped files */
|
||||
#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */
|
||||
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
|
||||
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
|
||||
|
|
@ -874,14 +865,10 @@ typedef struct
|
|||
#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
|
||||
#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
|
||||
#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
|
||||
#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address \
|
||||
Register */
|
||||
#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority \
|
||||
Register */
|
||||
#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control \
|
||||
Register */
|
||||
#define NT_PPC_PKEY 0x110 /* Memory Protection Keys \
|
||||
registers. */
|
||||
#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */
|
||||
#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */
|
||||
#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */
|
||||
#define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers. */
|
||||
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
|
||||
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
|
||||
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
|
||||
|
|
@ -894,26 +881,20 @@ typedef struct
|
|||
#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
|
||||
#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
|
||||
#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
|
||||
#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 \
|
||||
upper half. */
|
||||
#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half. */
|
||||
#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31. */
|
||||
#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers. */
|
||||
#define NT_S390_GS_BC 0x30c /* s390 guarded storage \
|
||||
broadcast control block. */
|
||||
#define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block. */
|
||||
#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation. */
|
||||
#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
|
||||
#define NT_ARM_TLS 0x401 /* ARM TLS register */
|
||||
#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
|
||||
#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
|
||||
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
|
||||
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension \
|
||||
registers */
|
||||
#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication \
|
||||
code masks. */
|
||||
#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication \
|
||||
address keys. */
|
||||
#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication \
|
||||
generic key. */
|
||||
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */
|
||||
#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks. */
|
||||
#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys. */
|
||||
#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key. */
|
||||
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
|
||||
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
|
||||
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
|
||||
|
|
@ -1007,8 +988,7 @@ typedef struct
|
|||
#define DT_MOVEENT 0x6ffffdfa
|
||||
#define DT_MOVESZ 0x6ffffdfb
|
||||
#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */
|
||||
#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting \
|
||||
the following DT_* entry. */
|
||||
#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting the following DT_* entry. */
|
||||
#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
|
||||
#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
|
||||
#define DT_VALRNGHI 0x6ffffdff
|
||||
|
|
@ -1045,11 +1025,9 @@ typedef struct
|
|||
|
||||
/* These were chosen by Sun. */
|
||||
#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
|
||||
#define DT_VERDEF 0x6ffffffc /* Address of version definition \
|
||||
table */
|
||||
#define DT_VERDEF 0x6ffffffc /* Address of version definition table */
|
||||
#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
|
||||
#define DT_VERNEED 0x6ffffffe /* Address of table with needed \
|
||||
versions */
|
||||
#define DT_VERNEED 0x6ffffffe /* Address of table with needed versions */
|
||||
#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
|
||||
#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
|
||||
#define DT_VERSIONTAGNUM 16
|
||||
|
|
@ -1108,8 +1086,7 @@ typedef struct
|
|||
|
||||
/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */
|
||||
#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */
|
||||
#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not \
|
||||
generally available. */
|
||||
#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not generally available. */
|
||||
|
||||
/* Version definition sections. */
|
||||
|
||||
|
|
@ -1274,8 +1251,7 @@ typedef struct
|
|||
|
||||
/* Some more special a_type values describing the hardware. */
|
||||
#define AT_PLATFORM 15 /* String identifying platform. */
|
||||
#define AT_HWCAP 16 /* Machine-dependent hints about \
|
||||
processor capabilities. */
|
||||
#define AT_HWCAP 16 /* Machine-dependent hints about processor capabilities. */
|
||||
|
||||
/* This entry gives some information about the FPU initialization
|
||||
performed by the kernel. */
|
||||
|
|
@ -1296,8 +1272,7 @@ typedef struct
|
|||
|
||||
#define AT_RANDOM 25 /* Address of 16 random bytes. */
|
||||
|
||||
#define AT_HWCAP2 26 /* More machine-dependent hints about \
|
||||
processor capabilities. */
|
||||
#define AT_HWCAP2 26 /* More machine-dependent hints about processor capabilities. */
|
||||
|
||||
#define AT_EXECFN 31 /* Filename of executable. */
|
||||
|
||||
|
|
@ -1325,8 +1300,7 @@ typedef struct
|
|||
#define AT_L3_CACHESIZE 46
|
||||
#define AT_L3_CACHEGEOMETRY 47
|
||||
|
||||
#define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery \
|
||||
(AArch64). */
|
||||
#define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery (AArch64). */
|
||||
|
||||
/* Note section contents. Each entry in the note section begins with
|
||||
a header of a fixed form. */
|
||||
|
|
@ -1524,12 +1498,9 @@ typedef struct
|
|||
#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */
|
||||
#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */
|
||||
#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */
|
||||
#define R_68K_TLS_LE32 37 /* 32 bit offset relative to \
|
||||
static TLS block */
|
||||
#define R_68K_TLS_LE16 38 /* 16 bit offset relative to \
|
||||
static TLS block */
|
||||
#define R_68K_TLS_LE8 39 /* 8 bit offset relative to \
|
||||
static TLS block */
|
||||
#define R_68K_TLS_LE32 37 /* 32 bit offset relative to static TLS block */
|
||||
#define R_68K_TLS_LE16 38 /* 16 bit offset relative to static TLS block */
|
||||
#define R_68K_TLS_LE8 39 /* 8 bit offset relative to static TLS block */
|
||||
#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */
|
||||
#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */
|
||||
#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */
|
||||
|
|
@ -2121,22 +2092,15 @@ typedef struct
|
|||
#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
|
||||
#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
|
||||
#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
|
||||
#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in \
|
||||
DT_MIPS_DELTA_CLASS. */
|
||||
#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in DT_MIPS_DELTA_CLASS. */
|
||||
#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */
|
||||
#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in \
|
||||
DT_MIPS_DELTA_INSTANCE. */
|
||||
#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in DT_MIPS_DELTA_INSTANCE. */
|
||||
#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */
|
||||
#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in \
|
||||
DT_MIPS_DELTA_RELOC. */
|
||||
#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta \
|
||||
relocations refer to. */
|
||||
#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in \
|
||||
DT_MIPS_DELTA_SYM. */
|
||||
#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the \
|
||||
class declaration. */
|
||||
#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in \
|
||||
DT_MIPS_DELTA_CLASSSYM. */
|
||||
#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in DT_MIPS_DELTA_RELOC. */
|
||||
#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta relocations refer to. */
|
||||
#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in DT_MIPS_DELTA_SYM. */
|
||||
#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the class declaration. */
|
||||
#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in DT_MIPS_DELTA_CLASSSYM. */
|
||||
#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */
|
||||
#define DT_MIPS_PIXIE_INIT 0x70000023
|
||||
#define DT_MIPS_SYMBOL_LIB 0x70000024
|
||||
|
|
@ -2148,10 +2112,8 @@ typedef struct
|
|||
#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */
|
||||
#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
|
||||
#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
|
||||
#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve \
|
||||
function stored in GOT. */
|
||||
#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added \
|
||||
by rld on dlopen() calls. */
|
||||
#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve function stored in GOT. */
|
||||
#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added by rld on dlopen() calls. */
|
||||
#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
|
||||
#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
|
||||
#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
|
||||
|
|
@ -2325,8 +2287,7 @@ enum {
|
|||
#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */
|
||||
#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */
|
||||
#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */
|
||||
#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch \
|
||||
prediction. */
|
||||
#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch prediction. */
|
||||
#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */
|
||||
#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */
|
||||
|
||||
|
|
@ -2338,8 +2299,7 @@ enum {
|
|||
|
||||
/* Additional section indeces. */
|
||||
|
||||
#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared \
|
||||
symbols in ANSI C. */
|
||||
#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared symbols in ANSI C. */
|
||||
#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
|
||||
|
||||
/* Legal values for sh_type field of Elf32_Shdr. */
|
||||
|
|
@ -2585,8 +2545,7 @@ enum {
|
|||
|
||||
/* Cygnus local bits below */
|
||||
#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
|
||||
#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib \
|
||||
flag */
|
||||
#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib flag */
|
||||
|
||||
/* PowerPC relocations defined by the ABIs */
|
||||
#define R_PPC_NONE 0
|
||||
|
|
@ -2860,7 +2819,7 @@ enum {
|
|||
#define STO_PPC64_LOCAL_BIT 5
|
||||
#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT)
|
||||
#define PPC64_LOCAL_ENTRY_OFFSET(other) \
|
||||
(((1 << (((other)&STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
|
||||
(((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
|
||||
|
||||
/* ARM specific declarations */
|
||||
|
||||
|
|
@ -2892,7 +2851,7 @@ enum {
|
|||
#define EF_ARM_BE8 0x00800000
|
||||
#define EF_ARM_LE8 0x00400000
|
||||
|
||||
#define EF_ARM_EABI_VERSION(flags) ((flags)&EF_ARM_EABIMASK)
|
||||
#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
|
||||
#define EF_ARM_EABI_UNKNOWN 0x00000000
|
||||
#define EF_ARM_EABI_VER1 0x01000000
|
||||
#define EF_ARM_EABI_VER2 0x02000000
|
||||
|
|
@ -2906,12 +2865,10 @@ enum {
|
|||
|
||||
/* ARM-specific values for sh_flags */
|
||||
#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
|
||||
#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined \
|
||||
in the input to a link step. */
|
||||
#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */
|
||||
|
||||
/* ARM-specific program header flags */
|
||||
#define PF_ARM_SB 0x10000000 /* Segment contains the location \
|
||||
addressed by the static base. */
|
||||
#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */
|
||||
#define PF_ARM_PI 0x20000000 /* Position-independent segment. */
|
||||
#define PF_ARM_ABS 0x40000000 /* Absolute segment. */
|
||||
|
||||
|
|
@ -3073,8 +3030,7 @@ enum {
|
|||
/* ARM relocs. */
|
||||
|
||||
#define R_ARM_NONE 0 /* No reloc */
|
||||
#define R_ARM_PC24 1 /* Deprecated PC relative 26 \
|
||||
bit branch. */
|
||||
#define R_ARM_PC24 1 /* Deprecated PC relative 26 bit branch. */
|
||||
#define R_ARM_ABS32 2 /* Direct 32 bit */
|
||||
#define R_ARM_REL32 3 /* PC relative 32 bit */
|
||||
#define R_ARM_PC13 4
|
||||
|
|
@ -3084,8 +3040,7 @@ enum {
|
|||
#define R_ARM_ABS8 8 /* Direct 8 bit */
|
||||
#define R_ARM_SBREL32 9
|
||||
#define R_ARM_THM_PC22 10 /* PC relative 24 bit (Thumb32 BL). */
|
||||
#define R_ARM_THM_PC8 11 /* PC relative & 0x3FC \
|
||||
(Thumb16 LDR, ADD, ADR). */
|
||||
#define R_ARM_THM_PC8 11 /* PC relative & 0x3FC (Thumb16 LDR, ADD, ADR). */
|
||||
#define R_ARM_AMP_VCALL9 12
|
||||
#define R_ARM_SWI24 13 /* Obsolete static relocation. */
|
||||
#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */
|
||||
|
|
@ -3104,8 +3059,7 @@ enum {
|
|||
#define R_ARM_GOT32 26 /* 32 bit GOT entry */
|
||||
#define R_ARM_PLT32 27 /* Deprecated, 32 bit PLT address. */
|
||||
#define R_ARM_CALL 28 /* PC relative 24 bit (BL, BLX). */
|
||||
#define R_ARM_JUMP24 29 /* PC relative 24 bit \
|
||||
(B, BL<cond>). */
|
||||
#define R_ARM_JUMP24 29 /* PC relative 24 bit (B, BL<cond>). */
|
||||
#define R_ARM_THM_JUMP24 30 /* PC relative 24 bit (Thumb32 B.W). */
|
||||
#define R_ARM_BASE_ABS 31 /* Adjust by program base. */
|
||||
#define R_ARM_ALU_PCREL_7_0 32 /* Obsolete. */
|
||||
|
|
@ -3124,20 +3078,13 @@ enum {
|
|||
#define R_ARM_MOVW_PREL_NC 45 /* PC relative 16-bit (MOVW). */
|
||||
#define R_ARM_MOVT_PREL 46 /* PC relative (MOVT). */
|
||||
#define R_ARM_THM_MOVW_ABS_NC 47 /* Direct 16 bit (Thumb32 MOVW). */
|
||||
#define R_ARM_THM_MOVT_ABS 48 /* Direct high 16 bit \
|
||||
(Thumb32 MOVT). */
|
||||
#define R_ARM_THM_MOVW_PREL_NC 49 /* PC relative 16 bit \
|
||||
(Thumb32 MOVW). */
|
||||
#define R_ARM_THM_MOVT_PREL 50 /* PC relative high 16 bit \
|
||||
(Thumb32 MOVT). */
|
||||
#define R_ARM_THM_JUMP19 51 /* PC relative 20 bit \
|
||||
(Thumb32 B<cond>.W). */
|
||||
#define R_ARM_THM_JUMP6 52 /* PC relative X & 0x7E \
|
||||
(Thumb16 CBZ, CBNZ). */
|
||||
#define R_ARM_THM_ALU_PREL_11_0 53 /* PC relative 12 bit \
|
||||
(Thumb32 ADR.W). */
|
||||
#define R_ARM_THM_PC12 54 /* PC relative 12 bit \
|
||||
(Thumb32 LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_THM_MOVT_ABS 48 /* Direct high 16 bit (Thumb32 MOVT). */
|
||||
#define R_ARM_THM_MOVW_PREL_NC 49 /* PC relative 16 bit (Thumb32 MOVW). */
|
||||
#define R_ARM_THM_MOVT_PREL 50 /* PC relative high 16 bit (Thumb32 MOVT). */
|
||||
#define R_ARM_THM_JUMP19 51 /* PC relative 20 bit (Thumb32 B<cond>.W). */
|
||||
#define R_ARM_THM_JUMP6 52 /* PC relative X & 0x7E (Thumb16 CBZ, CBNZ). */
|
||||
#define R_ARM_THM_ALU_PREL_11_0 53 /* PC relative 12 bit (Thumb32 ADR.W). */
|
||||
#define R_ARM_THM_PC12 54 /* PC relative 12 bit (Thumb32 LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_ABS32_NOI 55 /* Direct 32-bit. */
|
||||
#define R_ARM_REL32_NOI 56 /* PC relative 32-bit. */
|
||||
#define R_ARM_ALU_PC_G0_NC 57 /* PC relative (ADD, SUB). */
|
||||
|
|
@ -3147,12 +3094,9 @@ enum {
|
|||
#define R_ARM_ALU_PC_G2 61 /* PC relative (ADD, SUB). */
|
||||
#define R_ARM_LDR_PC_G1 62 /* PC relative (LDR,STR,LDRB,STRB). */
|
||||
#define R_ARM_LDR_PC_G2 63 /* PC relative (LDR,STR,LDRB,STRB). */
|
||||
#define R_ARM_LDRS_PC_G0 64 /* PC relative (STR{D,H}, \
|
||||
LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_LDRS_PC_G1 65 /* PC relative (STR{D,H}, \
|
||||
LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_LDRS_PC_G2 66 /* PC relative (STR{D,H}, \
|
||||
LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_LDRS_PC_G0 64 /* PC relative (STR{D,H}, LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_LDRS_PC_G1 65 /* PC relative (STR{D,H}, LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_LDRS_PC_G2 66 /* PC relative (STR{D,H}, LDR{D,SB,H,SH}). */
|
||||
#define R_ARM_LDC_PC_G0 67 /* PC relative (LDC, STC). */
|
||||
#define R_ARM_LDC_PC_G1 68 /* PC relative (LDC, STC). */
|
||||
#define R_ARM_LDC_PC_G2 69 /* PC relative (LDC, STC). */
|
||||
|
|
@ -3161,33 +3105,21 @@ enum {
|
|||
#define R_ARM_ALU_SB_G1_NC 72 /* Program base relative (ADD,SUB). */
|
||||
#define R_ARM_ALU_SB_G1 73 /* Program base relative (ADD,SUB). */
|
||||
#define R_ARM_ALU_SB_G2 74 /* Program base relative (ADD,SUB). */
|
||||
#define R_ARM_LDR_SB_G0 75 /* Program base relative (LDR, \
|
||||
STR, LDRB, STRB). */
|
||||
#define R_ARM_LDR_SB_G1 76 /* Program base relative \
|
||||
(LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDR_SB_G2 77 /* Program base relative \
|
||||
(LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDRS_SB_G0 78 /* Program base relative \
|
||||
(LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDRS_SB_G1 79 /* Program base relative \
|
||||
(LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDRS_SB_G2 80 /* Program base relative \
|
||||
(LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDR_SB_G0 75 /* Program base relative (LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDR_SB_G1 76 /* Program base relative (LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDR_SB_G2 77 /* Program base relative (LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDRS_SB_G0 78 /* Program base relative (LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDRS_SB_G1 79 /* Program base relative (LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDRS_SB_G2 80 /* Program base relative (LDR, STR, LDRB, STRB). */
|
||||
#define R_ARM_LDC_SB_G0 81 /* Program base relative (LDC,STC). */
|
||||
#define R_ARM_LDC_SB_G1 82 /* Program base relative (LDC,STC). */
|
||||
#define R_ARM_LDC_SB_G2 83 /* Program base relative (LDC,STC). */
|
||||
#define R_ARM_MOVW_BREL_NC 84 /* Program base relative 16 \
|
||||
bit (MOVW). */
|
||||
#define R_ARM_MOVT_BREL 85 /* Program base relative high \
|
||||
16 bit (MOVT). */
|
||||
#define R_ARM_MOVW_BREL 86 /* Program base relative 16 \
|
||||
bit (MOVW). */
|
||||
#define R_ARM_THM_MOVW_BREL_NC 87 /* Program base relative 16 \
|
||||
bit (Thumb32 MOVW). */
|
||||
#define R_ARM_THM_MOVT_BREL 88 /* Program base relative high \
|
||||
16 bit (Thumb32 MOVT). */
|
||||
#define R_ARM_THM_MOVW_BREL 89 /* Program base relative 16 \
|
||||
bit (Thumb32 MOVW). */
|
||||
#define R_ARM_MOVW_BREL_NC 84 /* Program base relative 16 bit (MOVW). */
|
||||
#define R_ARM_MOVT_BREL 85 /* Program base relative high 16 bit (MOVT). */
|
||||
#define R_ARM_MOVW_BREL 86 /* Program base relative 16 bit (MOVW). */
|
||||
#define R_ARM_THM_MOVW_BREL_NC 87 /* Program base relative 16 bit (Thumb32 MOVW). */
|
||||
#define R_ARM_THM_MOVT_BREL 88 /* Program base relative high 16 bit (Thumb32 MOVT). */
|
||||
#define R_ARM_THM_MOVW_BREL 89 /* Program base relative 16 bit (Thumb32 MOVW). */
|
||||
#define R_ARM_TLS_GOTDESC 90
|
||||
#define R_ARM_TLS_CALL 91
|
||||
#define R_ARM_TLS_DESCSEQ 92 /* TLS relaxation. */
|
||||
|
|
@ -3195,38 +3127,26 @@ enum {
|
|||
#define R_ARM_PLT32_ABS 94
|
||||
#define R_ARM_GOT_ABS 95 /* GOT entry. */
|
||||
#define R_ARM_GOT_PREL 96 /* PC relative GOT entry. */
|
||||
#define R_ARM_GOT_BREL12 97 /* GOT entry relative to GOT \
|
||||
origin (LDR). */
|
||||
#define R_ARM_GOTOFF12 98 /* 12 bit, GOT entry relative \
|
||||
to GOT origin (LDR, STR). */
|
||||
#define R_ARM_GOT_BREL12 97 /* GOT entry relative to GOT origin (LDR). */
|
||||
#define R_ARM_GOTOFF12 98 /* 12 bit, GOT entry relative to GOT origin (LDR, STR). */
|
||||
#define R_ARM_GOTRELAX 99
|
||||
#define R_ARM_GNU_VTENTRY 100
|
||||
#define R_ARM_GNU_VTINHERIT 101
|
||||
#define R_ARM_THM_PC11 102 /* PC relative & 0xFFE (Thumb16 B). */
|
||||
#define R_ARM_THM_PC9 103 /* PC relative & 0x1FE \
|
||||
(Thumb16 B/B<cond>). */
|
||||
#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic \
|
||||
thread local data */
|
||||
#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic \
|
||||
thread local data */
|
||||
#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS \
|
||||
block */
|
||||
#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of \
|
||||
static TLS block offset */
|
||||
#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static \
|
||||
TLS block */
|
||||
#define R_ARM_TLS_LDO12 109 /* 12 bit relative to TLS \
|
||||
block (LDR, STR). */
|
||||
#define R_ARM_TLS_LE12 110 /* 12 bit relative to static \
|
||||
TLS block (LDR, STR). */
|
||||
#define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative \
|
||||
to GOT origin (LDR). */
|
||||
#define R_ARM_THM_PC9 103 /* PC relative & 0x1FE (Thumb16 B/B<cond>). */
|
||||
#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic thread local data */
|
||||
#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic thread local data */
|
||||
#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS block */
|
||||
#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of static TLS block offset */
|
||||
#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static TLS block */
|
||||
#define R_ARM_TLS_LDO12 109 /* 12 bit relative to TLS block (LDR, STR). */
|
||||
#define R_ARM_TLS_LE12 110 /* 12 bit relative to static TLS block (LDR, STR). */
|
||||
#define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative to GOT origin (LDR). */
|
||||
#define R_ARM_ME_TOO 128 /* Obsolete. */
|
||||
#define R_ARM_THM_TLS_DESCSEQ 129
|
||||
#define R_ARM_THM_TLS_DESCSEQ16 129
|
||||
#define R_ARM_THM_TLS_DESCSEQ32 130
|
||||
#define R_ARM_THM_GOT_BREL12 131 /* GOT entry relative to GOT \
|
||||
origin, 12 bit (Thumb32 LDR). */
|
||||
#define R_ARM_THM_GOT_BREL12 131 /* GOT entry relative to GOT origin, 12 bit (Thumb32 LDR). */
|
||||
#define R_ARM_IRELATIVE 160
|
||||
#define R_ARM_RXPC25 249
|
||||
#define R_ARM_RSBREL32 250
|
||||
|
|
@ -3538,47 +3458,29 @@ enum {
|
|||
#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
|
||||
#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
|
||||
#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
|
||||
#define R_390_TLS_GDCALL 38 /* Tag for function call in general \
|
||||
dynamic TLS code. */
|
||||
#define R_390_TLS_LDCALL 39 /* Tag for function call in local \
|
||||
dynamic TLS code. */
|
||||
#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic \
|
||||
thread local data. */
|
||||
#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic \
|
||||
thread local data. */
|
||||
#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS \
|
||||
block offset. */
|
||||
#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS \
|
||||
block offset. */
|
||||
#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS \
|
||||
block offset. */
|
||||
#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic \
|
||||
thread local data in LE code. */
|
||||
#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic \
|
||||
thread local data in LE code. */
|
||||
#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for \
|
||||
negated static TLS block offset. */
|
||||
#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for \
|
||||
negated static TLS block offset. */
|
||||
#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for \
|
||||
negated static TLS block offset. */
|
||||
#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to \
|
||||
static TLS block. */
|
||||
#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to \
|
||||
static TLS block. */
|
||||
#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS \
|
||||
block. */
|
||||
#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS \
|
||||
block. */
|
||||
#define R_390_TLS_GDCALL 38 /* Tag for function call in general dynamic TLS code. */
|
||||
#define R_390_TLS_LDCALL 39 /* Tag for function call in local dynamic TLS code. */
|
||||
#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic thread local data. */
|
||||
#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic thread local data. */
|
||||
#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS block offset. */
|
||||
#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS block offset. */
|
||||
#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS block offset. */
|
||||
#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic thread local data in LE code. */
|
||||
#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic thread local data in LE code. */
|
||||
#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for negated static TLS block offset. */
|
||||
#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for negated static TLS block offset. */
|
||||
#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for negated static TLS block offset. */
|
||||
#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to static TLS block. */
|
||||
#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to static TLS block. */
|
||||
#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS block. */
|
||||
#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS block. */
|
||||
#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
|
||||
#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
|
||||
#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS \
|
||||
block. */
|
||||
#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS block. */
|
||||
#define R_390_20 57 /* Direct 20 bit. */
|
||||
#define R_390_GOT20 58 /* 20 bit GOT offset. */
|
||||
#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
|
||||
#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS \
|
||||
block offset. */
|
||||
#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS block offset. */
|
||||
#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */
|
||||
/* Keep this the last entry. */
|
||||
#define R_390_NUM 62
|
||||
|
|
@ -3684,19 +3586,14 @@ enum {
|
|||
#define R_MN10300_TLS_GD 24 /* 32-bit offset for global dynamic. */
|
||||
#define R_MN10300_TLS_LD 25 /* 32-bit offset for local dynamic. */
|
||||
#define R_MN10300_TLS_LDO 26 /* Module-relative offset. */
|
||||
#define R_MN10300_TLS_GOTIE 27 /* GOT offset for static TLS block \
|
||||
offset. */
|
||||
#define R_MN10300_TLS_IE 28 /* GOT address for static TLS block \
|
||||
offset. */
|
||||
#define R_MN10300_TLS_LE 29 /* Offset relative to static TLS \
|
||||
block. */
|
||||
#define R_MN10300_TLS_GOTIE 27 /* GOT offset for static TLS block offset. */
|
||||
#define R_MN10300_TLS_IE 28 /* GOT address for static TLS block offset. */
|
||||
#define R_MN10300_TLS_LE 29 /* Offset relative to static TLS block. */
|
||||
#define R_MN10300_TLS_DTPMOD 30 /* ID of module containing symbol. */
|
||||
#define R_MN10300_TLS_DTPOFF 31 /* Offset in module TLS block. */
|
||||
#define R_MN10300_TLS_TPOFF 32 /* Offset in static TLS block. */
|
||||
#define R_MN10300_SYM_DIFF 33 /* Adjustment for next reloc as needed \
|
||||
by linker relaxation. */
|
||||
#define R_MN10300_ALIGN 34 /* Alignment requirement for linker \
|
||||
relaxation. */
|
||||
#define R_MN10300_SYM_DIFF 33 /* Adjustment for next reloc as needed by linker relaxation. */
|
||||
#define R_MN10300_ALIGN 34 /* Alignment requirement for linker relaxation. */
|
||||
#define R_MN10300_NUM 35
|
||||
|
||||
/* M32R relocs. */
|
||||
|
|
@ -3736,21 +3633,14 @@ enum {
|
|||
#define R_M32R_RELATIVE 53 /* Adjust by program base */
|
||||
#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */
|
||||
#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */
|
||||
#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned \
|
||||
low */
|
||||
#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed \
|
||||
low */
|
||||
#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned low */
|
||||
#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed low */
|
||||
#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */
|
||||
#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to \
|
||||
GOT with unsigned low */
|
||||
#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to \
|
||||
GOT with signed low */
|
||||
#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to \
|
||||
GOT */
|
||||
#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT \
|
||||
with unsigned low */
|
||||
#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT \
|
||||
with signed low */
|
||||
#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to GOT with unsigned low */
|
||||
#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to GOT with signed low */
|
||||
#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to GOT */
|
||||
#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT with unsigned low */
|
||||
#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT with signed low */
|
||||
#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */
|
||||
#define R_M32R_NUM 256 /* Keep this the last entry. */
|
||||
|
||||
|
|
@ -3811,8 +3701,7 @@ enum {
|
|||
#define R_NIOS2_UJMP 18 /* Unconditional branch. */
|
||||
#define R_NIOS2_CJMP 19 /* Conditional branch. */
|
||||
#define R_NIOS2_CALLR 20 /* Indirect call through register. */
|
||||
#define R_NIOS2_ALIGN 21 /* Alignment requirement for \
|
||||
linker relaxation. */
|
||||
#define R_NIOS2_ALIGN 21 /* Alignment requirement for linker relaxation. */
|
||||
#define R_NIOS2_GOT16 22 /* 16 bit GOT entry. */
|
||||
#define R_NIOS2_CALL16 23 /* 16 bit GOT entry for function. */
|
||||
#define R_NIOS2_GOTOFF_LO 24 /* %lo of offset to GOT pointer. */
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ 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 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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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