Rizin
unix-like reverse engineering framework and cli tools
sh_il.h File Reference

Go to the source code of this file.

Classes

struct  sh_il_context_t
 To store the context of the IL lifter ; Used to pass around information outside effects Other context variables may be added in the future when the rest of the instructions are lifted. More...
 

Typedefs

typedef struct sh_il_context_t SHILContext
 To store the context of the IL lifter ; Used to pass around information outside effects Other context variables may be added in the future when the rest of the instructions are lifted. More...
 

Functions

RZ_IPI bool rz_sh_il_opcode (RZ_NONNULL RzAnalysis *analysis, RZ_NONNULL RzAnalysisOp *aop, ut64 pc, RZ_BORROW RZ_NONNULL const SHOp *op, RZ_NULLABLE SHILContext *ctx)
 Store the lifted IL for op in aop This function also takes care of initializing and adding the privilege mode local variable if required. More...
 
RZ_IPI RzAnalysisILConfigrz_sh_il_config (RZ_NONNULL RzAnalysis *analysis)
 Initialize new config for the SuperH IL. More...
 

Typedef Documentation

◆ SHILContext

typedef struct sh_il_context_t SHILContext

To store the context of the IL lifter ; Used to pass around information outside effects Other context variables may be added in the future when the rest of the instructions are lifted.

Function Documentation

◆ rz_sh_il_config()

RZ_IPI RzAnalysisILConfig* rz_sh_il_config ( RZ_NONNULL RzAnalysis analysis)

Initialize new config for the SuperH IL.

Parameters
analysisRzAnalysis instance
Returns
RzAnalysisILConfig* RzIL config for SuperH ISA

Definition at line 1784 of file sh_il.c.

1784  {
1785  rz_return_val_if_fail(analysis, NULL);
1786 
1788  return r;
1789 }
RZ_API RZ_OWN RzAnalysisILConfig * rz_analysis_il_config_new(ut32 pc_size, bool big_endian, ut32 mem_key_size)
Definition: analysis_il.c:53
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define SH_ADDR_SIZE
Definition: disassembler.h:11
Description of the global context of an RzAnalysisILVM.
Definition: rz_analysis.h:1134

References NULL, r, rz_analysis_il_config_new(), rz_return_val_if_fail, and SH_ADDR_SIZE.

◆ rz_sh_il_opcode()

RZ_IPI bool rz_sh_il_opcode ( RZ_NONNULL RzAnalysis analysis,
RZ_NONNULL RzAnalysisOp aop,
ut64  pc,
RZ_BORROW RZ_NONNULL const SHOp op,
RZ_NULLABLE SHILContext ctx 
)

Store the lifted IL for op in aop This function also takes care of initializing and adding the privilege mode local variable if required.

Parameters
analysisRzAnalysis instance
aop
pcProgram counter
op
ctxContext variables for the current IL lifting
Returns
bool True if successful ; false otherwise

Definition at line 1759 of file sh_il.c.

1759  {
1760  rz_return_val_if_fail(analysis && aop && op, false);
1761  if (op->mnemonic >= SH_OP_SIZE) {
1762  RZ_LOG_ERROR("RzIL: SuperH: out of bounds op\n");
1763  return false;
1764  }
1765 
1766  sh_il_op create_op = sh_ops[op->mnemonic];
1767  RzILOpEffect *lifted = create_op(op, pc, analysis, ctx);
1768 
1769  // If the privilege was checked, then we need to set the local variable before the IL lifting
1770  if (ctx && ctx->privilege_check) {
1771  lifted = sh_apply_effects(lifted, sh_il_initialize_privilege(), NULL);
1772  }
1773 
1774  aop->il_op = lifted;
1775  return true;
1776 }
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
@ SH_OP_SIZE
Definition: disassembler.h:234
static const sh_il_op sh_ops[SH_OP_SIZE]
Lookup table for the IL lifting handlers for the various instructions.
Definition: sh_il.c:1665
RzILOpEffect *(* sh_il_op)(const SHOp *op, ut64 pc, RzAnalysis *analysis, SHILContext *ctx)
Definition: sh_il.c:1660
static RzILOpEffect * sh_il_initialize_privilege()
Set the value of the local variable "_priv" This exists so that the privilege mode IL doesn't have to...
Definition: sh_il.c:192
static RzILOpEffect * sh_apply_effects(RZ_NULLABLE RzILOpEffect *target, RZ_NULLABLE RzILOpEffect *pre, RZ_NULLABLE RzILOpEffect *post)
Apply the effects in order: pre, target, post The good thing about this function is that any of the a...
Definition: sh_il.c:407
Definition: dis.c:32

References NULL, pc, RZ_LOG_ERROR, rz_return_val_if_fail, sh_apply_effects(), sh_il_initialize_privilege(), SH_OP_SIZE, and sh_ops.

Referenced by sh_op().