Skip to content

Commit

Permalink
Remove unused reil crap from esil
Browse files Browse the repository at this point in the history
  • Loading branch information
condret committed Nov 27, 2024
1 parent a0d3f2c commit 02de5d2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 98 deletions.
24 changes: 0 additions & 24 deletions libr/esil/esil.c
Original file line number Diff line number Diff line change
Expand Up @@ -3517,30 +3517,6 @@ static bool runword(REsil *esil, const char *word) {
return false;
}

#if 0
// Don't push anything onto stack when processing if statements
if (!strcmp (word, "?{") && esil->Reil) {
esil->Reil->skip = esil->Reil->skip? 0: 1;
if (esil->Reil->skip) {
esil->Reil->cmd_count = 0;
memset (esil->Reil->if_buf, 0, sizeof (esil->Reil->if_buf));
}
}

if (esil->Reil && esil->Reil->skip) {
char *if_buf = esil->Reil->if_buf;
size_t n = strlen (if_buf);
snprintf (if_buf + n, sizeof (esil->Reil->if_buf) - n, "%s,", word);
if (!strcmp (word, "}")) {
r_esil_pushnum (esil, esil->Reil->addr + esil->Reil->cmd_count + 1);
r_esil_parse (esil, esil->Reil->if_buf);
} else if (iscommand (esil, word, &op)) {
esil->Reil->cmd_count++;
}
return true;
}
#endif

//eprintf ("WORD (%d) (%s)\n", esil->skip, word);
if (!strcmp (word, "}{")) {
if (esil->skip == 1) {
Expand Down
74 changes: 0 additions & 74 deletions libr/include/r_esil.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ typedef struct r_esil_t {
REsilCallbacks cb;
REsilCallbacks ocb;
bool ocb_set;
#if 0
struct r_anal_reil_t *Reil;
#endif
char *pending; // pending op computed as a macro
// this is so cursed, can we please remove external commands from esil internals.
// Function pointers are fine, but not commands
Expand Down Expand Up @@ -213,77 +210,6 @@ typedef struct r_anal_ref_char_t {
char *cols;
} RAnalRefStr;

#if 0

/* reil -- must be deprecated */
/* Constructs to convert from ESIL to REIL */
#define FOREACHOP(GENERATE) \
/* No Operation */ GENERATE(NOP) \
/* Unknown/Undefined */ GENERATE(UNK) \
/* Conditional Jump */ GENERATE(JCC) \
/* Store Value to register */ GENERATE(STR) \
/* Store value to memory */ GENERATE(STM) \
/* Load value from memory */ GENERATE(LDM) \
/* Addition */ GENERATE(ADD) \
/* Subtraction */ GENERATE(SUB) \
/* Negation */ GENERATE(NEG) \
/* Multiplication */ GENERATE(MUL) \
/* Division */ GENERATE(DIV) \
/* Modulo */ GENERATE(MOD) \
/* Signed Multiplication */ GENERATE(SMUL) \
/* Sugned Division */ GENERATE(SDIV) \
/* Signed Modulus */ GENERATE(SMOD) \
/* Shift Left */ GENERATE(SHL) \
/* Shift Right */ GENERATE(SHR) \
/* Binary and */ GENERATE(AND) \
/* Binary or */ GENERATE(OR) \
/* Binary xor */ GENERATE(XOR) \
/* Binary not */ GENERATE(NOT) \
/* Equation */ GENERATE(EQ) \
/* Less Than */ GENERATE(LT)

#define MAKE_ENUM(OP) REIL_##OP,
#define REIL_OP_STRING(STRING) #STRING,

typedef enum {
FOREACHOP(MAKE_ENUM)
} RAnalReilOpcode;

typedef enum {
ARG_REG, // CPU Register
ARG_TEMP, // Temporary register used by REIL
ARG_CONST, // Constant value
ARG_ESIL_INTERNAL, // Used to resolve ESIL internal flags
ARG_NONE // Operand not used by the instruction
} RAnalReilArgType;

// Arguments to a REIL instruction.
typedef struct r_anal_reil_arg {
RAnalReilArgType type; // Type of the argument
ut8 size; // Size of the argument in bytes
char name[32]; // Name of the argument
} RAnalReilArg;

// Instruction arg1, arg2, arg3
typedef struct r_anal_reil_inst_t {
RAnalReilOpcode opcode;
RAnalReilArg *arg[3];
} RAnalReilInst;

typedef struct r_anal_reil_t {
char old[32]; // Used to compute flags.
char cur[32];
ut8 lastsz;
ut64 reilNextTemp; // Used to store the index of the next REIL temp register to be used.
ut64 addr; // Used for instruction sequencing. Check esil2reil.c for details.
ut8 seq_num; // Incremented and used when noInc is set to 1.
int skip;
int cmd_count;
char if_buf[64];
char pc[8];
} RAnalReil;
#endif

typedef struct r_esil_plugin_t {
RPluginMeta meta;
char *arch;
Expand Down

0 comments on commit 02de5d2

Please sign in to comment.