| 1 |
/* |
| 2 |
* FCML - Free Code Manipulation Library. |
| 3 |
* Copyright (C) 2010-2020 Slawomir Wojtasiak |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef FCML_ASM_DECODING_TREE_H_ |
| 21 |
#define FCML_ASM_DECODING_TREE_H_ |
| 22 |
|
| 23 |
#include "fcml_coll.h" |
| 24 |
#include "fcml_def.h" |
| 25 |
#include "fcml_dialect_int.h" |
| 26 |
|
| 27 |
#define FCML_DT_TREE_OPCODE_ARRAY_SIZE 256 |
| 28 |
|
| 29 |
typedef struct fcml_st_dt_diss_tree_element { |
| 30 |
struct fcml_st_dt_diss_tree_element *opcodes[FCML_DT_TREE_OPCODE_ARRAY_SIZE]; |
| 31 |
fcml_st_coll_list *instruction_decoding_defs; |
| 32 |
} fcml_st_dt_diss_tree_element; |
| 33 |
|
| 34 |
typedef fcml_ceh_error (*fcml_fp_dt_prep_inst_def_callback)( |
| 35 |
fcml_st_dialect_context_int *dialect, |
| 36 |
fcml_st_dt_diss_tree_element *element, |
| 37 |
fcml_st_def_instruction_desc *instruction_desc, |
| 38 |
fcml_st_def_addr_mode_desc *opcode_desc); |
| 39 |
|
| 40 |
typedef void (*fcml_fp_dt_disp_inst_def_callback)( |
| 41 |
fcml_st_dialect_context_int *dialect, fcml_ptr instruction_decoding); |
| 42 |
|
| 43 |
typedef struct fcml_st_dt_decoding_tree { |
| 44 |
fcml_st_dt_diss_tree_element *opcode[FCML_DT_TREE_OPCODE_ARRAY_SIZE]; |
| 45 |
fcml_st_dialect_context_int *dialect_context; |
| 46 |
fcml_fp_dt_prep_inst_def_callback prep_callback; |
| 47 |
fcml_fp_dt_disp_inst_def_callback disp_callback; |
| 48 |
} fcml_st_dt_decoding_tree; |
| 49 |
|
| 50 |
fcml_ceh_error fcml_fn_dt_dts_tree_init( |
| 51 |
fcml_st_dialect_context_int *dialect_context, |
| 52 |
fcml_st_dt_decoding_tree **tree, |
| 53 |
fcml_fp_dt_prep_inst_def_callback prepare_callback, |
| 54 |
fcml_fp_dt_disp_inst_def_callback dispose_callback); |
| 55 |
|
| 56 |
void fcml_fn_dt_dts_tree_free(fcml_st_dialect_context_int *dialect_context, |
| 57 |
fcml_st_dt_decoding_tree *tree); |
| 58 |
|
| 59 |
#endif /* FCML_ASM_DECODING_TREE_H_ */ |