|
Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
| struct | sh_addr_dissassembler_helper_t |
Typedefs | |
| typedef struct sh_addr_dissassembler_helper_t | SHAddrHelper |
Functions | |
| static SHAddrMode | sh_pb_get_addrmode (SHParamBuilder pb) |
Get the addressing mode for pb. More... | |
| static char * | sh_op_space_params (const char *buffer) |
| Replace all the commas outside operands with spaces (i.e. "space out" the operands) More... | |
| static ut32 | sh_op_reg_bits (const char *param, ut8 offset) |
Get the bits corresponding to the register param (i.e. register number shifted at offset) More... | |
| static ut32 | sh_op_param_bits (SHParamBuilder shb, const char *param, SHScaling scaling, ut64 pc) |
Get the opcode bits corresponding to param, scaling, pc and addressing mode (shb.mode) This function does nothing if shb.is_param == true (i.e. there are no bits corresponding to it in the instruction opcode) More... | |
| static ut64 | sh_op_movl_param_bits (const char *reg_direct, const char *reg_disp_indirect) |
| Special assembler functions for the operands of "weird" MOVL instruction. More... | |
| static SHAddrHelper | sh_op_get_addr_mode (const char *param) |
Get the addressing mode being used in param. More... | |
| static bool | sh_op_compare (SHOpRaw raw, const char *mnem, SHAddrHelper modes[]) |
Check whether raw and instruction to be formed using mnem and modes will be equivalent. More... | |
| RZ_IPI ut16 | sh_assembler (RZ_NONNULL const char *buffer, ut64 pc, RZ_NULLABLE bool *success) |
| Assemble instruction from SuperH-4 ISA FPU instructions not implemented yet. More... | |
Variables | |
| const SHOpRaw | sh_op_lookup [] |
| const ut32 | OPCODE_NUM |
| typedef struct sh_addr_dissassembler_helper_t SHAddrHelper |
| RZ_IPI ut16 sh_assembler | ( | RZ_NONNULL const char * | buffer, |
| ut64 | pc, | ||
| RZ_NULLABLE bool * | success | ||
| ) |
Assemble instruction from SuperH-4 ISA FPU instructions not implemented yet.
| buffer | Instruction string buffer |
| pc | Current value of program counter |
| success | Store bool whether the assembler succeeded or not (RZ_NULLABLE) |
Definition at line 402 of file assembler.c.
References bye(), free(), i, sh_op_raw_t::mask, mnem, MOVL, NULL, sh_op_raw_t::opcode, OPCODE_NUM, sh_op_raw_t::param_builder, pc, rz_list_delete(), rz_list_free(), rz_list_length(), rz_list_pop_head(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_str_is_whitespace(), rz_str_split_duplist(), sh_op_raw_t::scaling, SH_ADDR_INVALID, sh_op_compare(), sh_op_get_addr_mode(), sh_op_lookup, sh_op_movl_param_bits(), sh_op_param_bits(), sh_op_space_params(), SH_REG_IND_SIZE, and autogen_x86imm::tmp.
Referenced by assemble().
|
static |
Check whether raw and instruction to be formed using mnem and modes will be equivalent.
| raw | SHOpRaw |
| mnem | Mnemonic for the instruction to be formed |
| modes | Addressing modes and register to be used |
Definition at line 333 of file assembler.c.
References sh_param_builder_t::addr, sh_param_builder_addr_t::bits, i, sh_param_builder_t::is_param, benchmark::md, mnem, sh_addr_dissassembler_helper_t::mode, sh_param_t::mode, sh_param_builder_t::param, sh_param_t::param, sh_op_raw_t::param_builder, reg, sh_addr_dissassembler_helper_t::reg, SH_IMM_S, SH_IMM_U, sh_pb_get_addrmode(), SH_PC_RELATIVE12, SH_PC_RELATIVE8, SH_PC_RELATIVE_REG, SH_REG_DIRECT, SH_REG_IND_R0B, SH_REG_IND_SIZE, sh_op_raw_t::str_mnem, and x.
Referenced by sh_assembler().
|
static |
Get the addressing mode being used in param.
| param | Param string |
Definition at line 251 of file assembler.c.
References i, sh_addr_dissassembler_helper_t::mode, sh_addr_dissassembler_helper_t::reg, rz_str_endswith(), rz_str_startswith(), rz_warn_if_reached, SH_GBR_INDIRECT_DISP, SH_GBR_INDIRECT_INDEXED, SH_IMM_U, SH_PC_RELATIVE_DISP, SH_REG_DIRECT, SH_REG_IND_FR0, SH_REG_IND_PC, SH_REG_IND_R0B, SH_REG_IND_SIZE, SH_REG_INDIRECT, SH_REG_INDIRECT_D, SH_REG_INDIRECT_DISP, SH_REG_INDIRECT_I, SH_REG_INDIRECT_INDEXED, and sh_registers.
Referenced by sh_assembler().
|
static |
Special assembler functions for the operands of "weird" MOVL instruction.
| reg_direct | Operand string for direct register addressing mode |
| reg_disp_indirect | Operand string for register indirect addressing mode |
Definition at line 209 of file assembler.c.
References comma, d, dup, fail, free(), NIB0, NIB1, NIB2, NULL, reg, rz_num_get(), sh_op_reg_bits(), SH_SCALING_L, sh_scaling_size, strdup(), and ut64().
Referenced by sh_assembler().
|
static |
Get the opcode bits corresponding to param, scaling, pc and addressing mode (shb.mode) This function does nothing if shb.is_param == true (i.e. there are no bits corresponding to it in the instruction opcode)
| shb | SHParamBuilder instance to use for addressing modes |
| param | Param string to be assembled |
| scaling | Instruction scaling |
| pc | Program counter |
param Definition at line 83 of file assembler.c.
References sh_param_builder_t::addr, comma, d, dd, dup, free(), sh_param_builder_t::is_param, sh_param_builder_addr_t::mode, NULL, pc, reg, RZ_LOG_ERROR, rz_num_get(), SH_GBR_INDIRECT_DISP, SH_IMM_S, SH_IMM_U, sh_op_reg_bits(), SH_PC_RELATIVE12, SH_PC_RELATIVE8, SH_PC_RELATIVE_DISP, SH_PC_RELATIVE_REG, SH_REG_DIRECT, SH_REG_INDIRECT, SH_REG_INDIRECT_D, SH_REG_INDIRECT_DISP, SH_REG_INDIRECT_I, SH_REG_INDIRECT_INDEXED, sh_scaling_size, st16, st64, sh_param_builder_addr_t::start, and strdup().
Referenced by sh_assembler().
Get the bits corresponding to the register param (i.e. register number shifted at offset)
| param | Register param string |
| offset | Offset to shift the register number to (a.k.a. nibble position) |
param Definition at line 58 of file assembler.c.
References i, RZ_LOG_ERROR, SH_REG_IND_R0B, and sh_registers.
Referenced by sh_op_movl_param_bits(), and sh_op_param_bits().
|
static |
Replace all the commas outside operands with spaces (i.e. "space out" the operands)
| buffer | Input instruction string |
Definition at line 26 of file assembler.c.
Referenced by sh_assembler().
|
static |
Get the addressing mode for pb.
| pb | SHParamBuilder |
Definition at line 16 of file assembler.c.
References sh_param_builder_t::addr, sh_param_builder_t::is_param, sh_param_builder_addr_t::mode, sh_param_t::mode, and sh_param_builder_t::param.
Referenced by sh_op_compare().
Definition at line 195 of file lookup.c.
Referenced by sh_assembler().
Definition at line 7 of file lookup.c.
Referenced by sh_assembler().