Rizin
unix-like reverse engineering framework and cli tools
opcode_30.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2020 FXTi <zjxiang1998@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include "opcode.h"
5 
7  pyc_opcodes *ret = opcode_31();
8  if (!ret) {
9  return NULL;
10  }
11 
12  ret->version_sig = (void *(*)())opcode_30;
13 
14  // These are in Python 3.x but not in Python 3.0
15 
16  rm_op(.op_obj = ret->opcodes, .op_name = "JUMP_IF_FALSE_OR_POP", .op_code = 111);
17  rm_op(.op_obj = ret->opcodes, .op_name = "JUMP_IF_TRUE_OR_POP", .op_code = 112);
18  rm_op(.op_obj = ret->opcodes, .op_name = "POP_JUMP_IF_FALSE", .op_code = 114);
19  rm_op(.op_obj = ret->opcodes, .op_name = "POP_JUMP_IF_TRUE", .op_code = 115);
20  rm_op(.op_obj = ret->opcodes, .op_name = "LIST_APPEND", .op_code = 145);
21  rm_op(.op_obj = ret->opcodes, .op_name = "MAP_ADD", .op_code = 147);
22 
23  // These are are in 3.0 but are not in 3.1 or they have
24  // different opcode numbers. Note: As a result of opcode value
25  // changes, these have to be applied *after* removing ops (with
26  // the same name).
27 
28  def_op(.op_obj = ret->opcodes, .op_name = "SET_ADD", .op_code = 17, .pop = 1, .push = 0);
29  def_op(.op_obj = ret->opcodes, .op_name = "LIST_APPEND", .op_code = 18, .pop = 2, .push = 1);
30 
31  jrel_op(.op_obj = ret->opcodes, .op_name = "JUMP_IF_FALSE", .op_code = 111, .pop = 1, .push = 1, .conditional = true);
32  jrel_op(.op_obj = ret->opcodes, .op_name = "JUMP_IF_TRUE", .op_code = 112, .pop = 1, .push = 1, .conditional = true);
33 
35  add_arg_fmt(ret, "EXTENDED_ARG", format_extended_arg);
36  add_arg_fmt(ret, "MAKE_FUNCTION", format_MAKE_FUNCTION_arg_3x);
37 
38  return ret;
39 }
#define NULL
Definition: cris-opc.c:27
RZ_API void rz_list_purge(RZ_NONNULL RzList *list)
Empties the list without freeing the list pointer.
Definition: list.c:120
void add_arg_fmt(pyc_opcodes *ret, char *op_name, const char *(*formatter)(ut32 oparg))
Definition: opcode.c:234
pyc_opcodes * opcode_30(void)
Definition: opcode_30.c:6
const char * format_extended_arg(ut32 oparg)
Definition: opcode_arg_fmt.c:6
const char * format_MAKE_FUNCTION_arg_3x(ut32 oparg)
pyc_opcodes * opcode_31(void)
Definition: opcode_31.c:6
#define jrel_op(...)
Definition: opcode.h:168
#define def_op(...)
Definition: opcode.h:127
#define rm_op(...)
Definition: opcode.h:175
char * op_name
Definition: opcode.h:38
void *(* version_sig)()
Definition: opcode.h:49
pyc_opcode_object * opcodes
Definition: opcode.h:51
RzList * opcode_arg_fmt
Definition: opcode.h:50