Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | LUA_REG_PREF "R" |
#define | LUA_CONST_PREF "CONST" |
#define | LUA_KR_PREF "R/CONST" |
#define | LUA_UPVALUE_PREF "UPV" |
#define | LUA_EVENT_PREF "EVENT" |
#define | LUA_KPROTO_PREF "KPROTO" |
#define | LUA_NO_PREFIX "" |
#define | LUA_EXTRAARG_MARK "#Ex" |
#define | LUA_KFLAG_MARK "#Kflag" |
#define | LUA_JMP_MARK "#To" |
#define | LUA_CLOSURE_MARK "#CLOSURE" |
#define | LUA_KX_MARK " CONST[#Ex]" |
Typedefs | |
typedef ut32 | LuaInstruction |
typedef char ** | LuaOpNameList |
#define LUA_CLOSURE_MARK "#CLOSURE" |
Definition at line 23 of file lua_arch.h.
#define LUA_CONST_PREF "CONST" |
Definition at line 12 of file lua_arch.h.
#define LUA_EVENT_PREF "EVENT" |
Definition at line 15 of file lua_arch.h.
#define LUA_EXTRAARG_MARK "#Ex" |
Definition at line 20 of file lua_arch.h.
#define LUA_JMP_MARK "#To" |
Definition at line 22 of file lua_arch.h.
#define LUA_KFLAG_MARK "#Kflag" |
Definition at line 21 of file lua_arch.h.
#define LUA_KPROTO_PREF "KPROTO" |
Definition at line 16 of file lua_arch.h.
#define LUA_KR_PREF "R/CONST" |
Definition at line 13 of file lua_arch.h.
#define LUA_KX_MARK " CONST[#Ex]" |
Definition at line 24 of file lua_arch.h.
#define LUA_NO_PREFIX "" |
Definition at line 17 of file lua_arch.h.
#define LUA_REG_PREF "R" |
Definition at line 11 of file lua_arch.h.
#define LUA_UPVALUE_PREF "UPV" |
Definition at line 14 of file lua_arch.h.
typedef ut32 LuaInstruction |
Definition at line 27 of file lua_arch.h.
typedef char** LuaOpNameList |
Definition at line 30 of file lua_arch.h.
bool free_lua_opnames | ( | LuaOpNameList | list | ) |
Definition at line 22 of file lua_arch.c.
References list(), NULL, and RZ_FREE.
Referenced by rz_luac_disasm().
Definition at line 69 of file opcode_53.c.
References lua_strcase, OP_ADD, OP_BAND, OP_BNOT, OP_BOR, OP_BXOR, OP_CALL, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_IDIV, OP_JMP, OP_LE, OP_LEN, OP_LOADBOOL, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LT, OP_MOD, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHR, OP_SUB, OP_TAILCALL, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_UNM, and OP_VARARG.
Referenced by lua53_assembly().
LuaOpNameList get_lua53_opnames | ( | void | ) |
Definition at line 10 of file opcode_53.c.
References list(), LUA_NUM_OPCODES, NULL, OP_ADD, OP_BAND, OP_BNOT, OP_BOR, OP_BXOR, OP_CALL, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_IDIV, OP_JMP, OP_LE, OP_LEN, OP_LOADBOOL, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LT, OP_MOD, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHR, OP_SUB, OP_TAILCALL, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_UNM, OP_VARARG, RZ_LOG_ERROR, and RZ_NEWS.
Referenced by rz_luac_disasm().
Definition at line 105 of file opcode_54.c.
References lua_strcase, OP_ADD, OP_ADDI, OP_ADDK, OP_BAND, OP_BANDK, OP_BNOT, OP_BOR, OP_BORK, OP_BXOR, OP_BXORK, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_DIVK, OP_EQ, OP_EQI, OP_EQK, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GEI, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_GTI, OP_IDIV, OP_IDIVK, OP_JMP, OP_LE, OP_LEI, OP_LEN, OP_LFALSESKIP, OP_LOADF, OP_LOADFALSE, OP_LOADI, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LOADTRUE, OP_LT, OP_LTI, OP_MMBIN, OP_MMBINI, OP_MMBINK, OP_MOD, OP_MODK, OP_MOVE, OP_MUL, OP_MULK, OP_NEWTABLE, OP_NOT, OP_POW, OP_POWK, OP_RETURN, OP_RETURN0, OP_RETURN1, OP_SELF, OP_SETFIELD, OP_SETI, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHLI, OP_SHR, OP_SHRI, OP_SUB, OP_SUBK, OP_TAILCALL, OP_TBC, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_TFORPREP, OP_UNM, OP_VARARG, and OP_VARARGPREP.
Referenced by lua54_assembly().
LuaOpNameList get_lua54_opnames | ( | void | ) |
Definition at line 9 of file opcode_54.c.
References list(), LUA_NUM_OPCODES, NULL, OP_ADD, OP_ADDI, OP_ADDK, OP_BAND, OP_BANDK, OP_BNOT, OP_BOR, OP_BORK, OP_BXOR, OP_BXORK, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_DIVK, OP_EQ, OP_EQI, OP_EQK, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GEI, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_GTI, OP_IDIV, OP_IDIVK, OP_JMP, OP_LE, OP_LEI, OP_LEN, OP_LFALSESKIP, OP_LOADF, OP_LOADFALSE, OP_LOADI, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LOADTRUE, OP_LT, OP_LTI, OP_MMBIN, OP_MMBINI, OP_MMBINK, OP_MOD, OP_MODK, OP_MOVE, OP_MUL, OP_MULK, OP_NEWTABLE, OP_NOT, OP_POW, OP_POWK, OP_RETURN, OP_RETURN0, OP_RETURN1, OP_SELF, OP_SETFIELD, OP_SETI, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHLI, OP_SHR, OP_SHRI, OP_SUB, OP_SUBK, OP_TAILCALL, OP_TBC, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_TFORPREP, OP_UNM, OP_VARARG, OP_VARARGPREP, RZ_LOG_ERROR, and RZ_NEWS.
Referenced by rz_luac_disasm().
int lua53_anal_op | ( | RzAnalysis * | analysis, |
RzAnalysisOp * | op, | ||
ut64 | addr, | ||
const ut8 * | data, | ||
int | len | ||
) |
Definition at line 7 of file analysis_53.c.
References addr, GET_OPCODE, GETARG_B, GETARG_sBx, lua_build_instruction(), memset(), OP_ADD, OP_BAND, OP_BNOT, OP_BOR, OP_BXOR, OP_CALL, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_IDIV, OP_JMP, OP_LE, OP_LEN, OP_LOADBOOL, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LT, OP_MOD, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHR, OP_SUB, OP_TAILCALL, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_UNM, OP_VARARG, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_AND, RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_CMOV, RZ_ANALYSIS_OP_TYPE_CPL, RZ_ANALYSIS_OP_TYPE_DIV, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_MOD, RZ_ANALYSIS_OP_TYPE_MOV, RZ_ANALYSIS_OP_TYPE_MUL, RZ_ANALYSIS_OP_TYPE_NEW, RZ_ANALYSIS_OP_TYPE_NOT, RZ_ANALYSIS_OP_TYPE_OR, RZ_ANALYSIS_OP_TYPE_RCALL, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_SHL, RZ_ANALYSIS_OP_TYPE_SHR, RZ_ANALYSIS_OP_TYPE_STORE, RZ_ANALYSIS_OP_TYPE_SUB, RZ_ANALYSIS_OP_TYPE_UNK, RZ_ANALYSIS_OP_TYPE_XOR, RZ_ANALYSIS_STACK_INC, and st32.
Referenced by rz_lua_analysis_op().
bool lua53_assembly | ( | const char * | input, |
st32 | input_size, | ||
LuaInstruction * | instruction | ||
) |
Definition at line 60 of file assembly_53.c.
References encode_instruction(), get_lua53_opcode_by_name(), input(), NULL, OP_ADD, OP_BAND, OP_BNOT, OP_BOR, OP_BXOR, OP_CALL, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_IDIV, OP_JMP, OP_LE, OP_LEN, OP_LOADBOOL, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LT, OP_MOD, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHR, OP_SUB, OP_TAILCALL, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_UNM, OP_VARARG, PARAM_A, PARAM_Ax, PARAM_B, PARAM_Bx, PARAM_C, PARAM_sBx, and rz_str_trim_head_ro().
Referenced by rz_luac_asm().
Definition at line 7 of file disassembly_53.c.
References a, ax, b, c, GET_OPCODE, GETARG_A, GETARG_Ax, GETARG_B, GETARG_Bx, GETARG_C, GETARG_sBx, len, lua_build_instruction(), luaop_new_str_1arg(), luaop_new_str_2arg(), luaop_new_str_3arg(), OP_ADD, OP_BAND, OP_BNOT, OP_BOR, OP_BXOR, OP_CALL, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_IDIV, OP_JMP, OP_LE, OP_LEN, OP_LOADBOOL, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LT, OP_MOD, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHR, OP_SUB, OP_TAILCALL, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_UNM, OP_VARARG, RZ_FREE, RZ_LOG_DEBUG, rz_str_new(), and rz_strbuf_append().
Referenced by rz_luac_disasm().
int lua54_anal_op | ( | RzAnalysis * | analysis, |
RzAnalysisOp * | op, | ||
ut64 | addr, | ||
const ut8 * | data, | ||
int | len | ||
) |
Definition at line 6 of file analysis_54.c.
References addr, len, lua_build_instruction(), LUA_GET_OPCODE, LUA_GETARG_Bx, LUA_GETARG_sJ, memset(), OP_ADD, OP_ADDI, OP_ADDK, OP_BAND, OP_BANDK, OP_BNOT, OP_BOR, OP_BORK, OP_BXOR, OP_BXORK, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_DIVK, OP_EQ, OP_EQI, OP_EQK, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GEI, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_GTI, OP_IDIV, OP_IDIVK, OP_JMP, OP_LE, OP_LEI, OP_LEN, OP_LFALSESKIP, OP_LOADF, OP_LOADFALSE, OP_LOADI, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LOADTRUE, OP_LT, OP_LTI, OP_MMBIN, OP_MMBINI, OP_MMBINK, OP_MOD, OP_MODK, OP_MOVE, OP_MUL, OP_MULK, OP_NEWTABLE, OP_NOT, OP_POW, OP_POWK, OP_RETURN, OP_RETURN0, OP_RETURN1, OP_SELF, OP_SETFIELD, OP_SETI, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHLI, OP_SHR, OP_SHRI, OP_SUB, OP_SUBK, OP_TAILCALL, OP_TBC, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_TFORPREP, OP_UNM, OP_VARARG, OP_VARARGPREP, RZ_ANALYSIS_ADDR_HINT_TYPE_RET, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_AND, RZ_ANALYSIS_OP_TYPE_CALL, RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_CMOV, RZ_ANALYSIS_OP_TYPE_CPL, RZ_ANALYSIS_OP_TYPE_DIV, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_MOD, RZ_ANALYSIS_OP_TYPE_MOV, RZ_ANALYSIS_OP_TYPE_MUL, RZ_ANALYSIS_OP_TYPE_NEW, RZ_ANALYSIS_OP_TYPE_NOT, RZ_ANALYSIS_OP_TYPE_OR, RZ_ANALYSIS_OP_TYPE_RCALL, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_SHL, RZ_ANALYSIS_OP_TYPE_SHR, RZ_ANALYSIS_OP_TYPE_STORE, RZ_ANALYSIS_OP_TYPE_SUB, RZ_ANALYSIS_OP_TYPE_XOR, RZ_ANALYSIS_STACK_INC, and st32.
Referenced by rz_lua_analysis_op().
bool lua54_assembly | ( | const char * | input, |
st32 | input_size, | ||
LuaInstruction * | instruction | ||
) |
Definition at line 96 of file assembly_54.c.
References encode_instruction(), get_lua54_opcode_by_name(), input(), LUA_SET_OPCODE, NULL, OP_ADD, OP_ADDI, OP_ADDK, OP_BAND, OP_BANDK, OP_BNOT, OP_BOR, OP_BORK, OP_BXORK, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_DIVK, OP_EQ, OP_EQI, OP_EQK, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GEI, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_GTI, OP_IDIV, OP_IDIVK, OP_JMP, OP_LE, OP_LEI, OP_LEN, OP_LFALSESKIP, OP_LOADF, OP_LOADFALSE, OP_LOADI, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LOADTRUE, OP_LT, OP_LTI, OP_MMBIN, OP_MMBINI, OP_MMBINK, OP_MODK, OP_MOVE, OP_MUL, OP_MULK, OP_NEWTABLE, OP_NOT, OP_POW, OP_POWK, OP_RETURN, OP_RETURN0, OP_RETURN1, OP_SELF, OP_SETFIELD, OP_SETI, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHLI, OP_SHR, OP_SHRI, OP_SUB, OP_SUBK, OP_TAILCALL, OP_TBC, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_TFORPREP, OP_UNM, OP_VARARG, OP_VARARGPREP, PARAM_A, PARAM_Ax, PARAM_B, PARAM_Bx, PARAM_C, PARAM_k, PARAM_sB, PARAM_sBx, PARAM_sC, PARAM_sJ, and rz_str_trim_head_ro().
Referenced by rz_luac_asm().
Definition at line 6 of file disassembly_54.c.
References a, ax, b, c, len, lua_build_instruction(), LUA_GET_OPCODE, LUA_GETARG_A, LUA_GETARG_Ax, LUA_GETARG_B, LUA_GETARG_Bx, LUA_GETARG_C, LUA_GETARG_k, LUA_GETARG_sB, LUA_GETARG_sBx, LUA_GETARG_sC, LUA_GETARG_sJ, luaop_new_str_1arg(), luaop_new_str_1arg_ex(), luaop_new_str_2arg(), luaop_new_str_2arg_ex(), luaop_new_str_3arg(), luaop_new_str_3arg_ex(), OP_ADD, OP_ADDI, OP_ADDK, OP_BAND, OP_BANDK, OP_BNOT, OP_BOR, OP_BORK, OP_BXOR, OP_BXORK, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_DIVK, OP_EQ, OP_EQI, OP_EQK, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GEI, OP_GETFIELD, OP_GETI, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_GTI, OP_IDIV, OP_IDIVK, OP_JMP, OP_LE, OP_LEI, OP_LEN, OP_LFALSESKIP, OP_LOADF, OP_LOADFALSE, OP_LOADI, OP_LOADK, OP_LOADKX, OP_LOADNIL, OP_LOADTRUE, OP_LT, OP_LTI, OP_MMBIN, OP_MMBINI, OP_MMBINK, OP_MOD, OP_MODK, OP_MOVE, OP_MUL, OP_MULK, OP_NEWTABLE, OP_NOT, OP_POW, OP_POWK, OP_RETURN, OP_RETURN0, OP_RETURN1, OP_SELF, OP_SETFIELD, OP_SETI, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SHL, OP_SHLI, OP_SHR, OP_SHRI, OP_SUB, OP_SUBK, OP_TAILCALL, OP_TBC, OP_TEST, OP_TESTSET, OP_TFORCALL, OP_TFORLOOP, OP_TFORPREP, OP_UNM, OP_VARARG, OP_VARARGPREP, RZ_FREE, RZ_LOG_DEBUG, rz_str_newf(), rz_strbuf_append(), sb, and sc.
Referenced by rz_luac_disasm().
LuaInstruction lua_build_instruction | ( | const ut8 * | buf | ) |
Definition at line 6 of file lua_arch.c.
Referenced by lua53_anal_op(), lua53_disasm(), lua54_anal_op(), and lua54_disasm().
Definition at line 137 of file lua_arch.c.
References NULL, and cmd_descs_generate::str.
Referenced by encode_instruction().
Definition at line 129 of file lua_arch.c.
References NULL, rz_is_valid_input_num_value(), RZ_LOG_ERROR, and cmd_descs_generate::str.
Referenced by encode_instruction().
Definition at line 98 of file lua_arch.c.
References memcpy(), NULL, and rz_str_trim_head_ro().
Referenced by encode_instruction().
void lua_set_instruction | ( | LuaInstruction | instruction, |
ut8 * | data | ||
) |
char* luaop_new_str_1arg | ( | char * | opname, |
int | a | ||
) |
Definition at line 53 of file lua_arch.c.
References a, and rz_str_newf().
Referenced by lua53_disasm(), and lua54_disasm().
Definition at line 87 of file lua_arch.c.
References a, and rz_str_newf().
Referenced by lua54_disasm().
Definition at line 42 of file lua_arch.c.
References a, b, and rz_str_newf().
Referenced by lua53_disasm(), and lua54_disasm().
Definition at line 76 of file lua_arch.c.
References a, b, and rz_str_newf().
Referenced by lua54_disasm().
Definition at line 31 of file lua_arch.c.
References a, b, c, and rz_str_newf().
Referenced by lua53_disasm(), and lua54_disasm().
Definition at line 65 of file lua_arch.c.
References a, b, c, and rz_str_newf().
Referenced by lua54_disasm().