diff --git a/qemu/Makefile.target b/qemu/Makefile.target index 088c665f..880ca98a 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -44,6 +44,7 @@ obj-y = exec.o translate-all.o cpu-exec.o obj-y += translate-common.o obj-y += cpu-exec-common.o obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o +obj-y += tcg/tcg-common.o obj-y += fpu/softfloat.o obj-y += target-$(TARGET_BASE_ARCH)/ diff --git a/qemu/tcg/tcg-common.c b/qemu/tcg/tcg-common.c new file mode 100644 index 00000000..dd579cc7 --- /dev/null +++ b/qemu/tcg/tcg-common.c @@ -0,0 +1,32 @@ +/* + * Tiny Code Generator for QEMU + * + * Copyright (c) 2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "tcg/tcg.h" + +const TCGOpDef tcg_op_defs_org[TCG_OP_DEFS_TABLE_SIZE] = { +#define DEF(s, oargs, iargs, cargs, flags) \ + { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags }, +#include "tcg-opc.h" +#undef DEF +}; diff --git a/qemu/tcg/tcg.c b/qemu/tcg/tcg.c index 259c89d6..84cdfa6f 100644 --- a/qemu/tcg/tcg.c +++ b/qemu/tcg/tcg.c @@ -109,13 +109,6 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type, static void tcg_out_tb_init(TCGContext *s); static void tcg_out_tb_finalize(TCGContext *s); - -TCGOpDef tcg_op_defs_org[] = { -#define DEF(s, oargs, iargs, cargs, flags) { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags }, -#include "tcg-opc.h" -#undef DEF -}; - #if TCG_TARGET_INSN_UNIT_SIZE == 1 static QEMU_UNUSED_FUNC inline void tcg_out8(TCGContext *s, uint8_t v) { @@ -1281,7 +1274,7 @@ void tcg_add_target_add_op_defs(TCGContext *s, const TCGTargetOpDef *tdefs) #if defined(CONFIG_DEBUG_TCG) i = 0; - for (op = 0; op < ARRAY_SIZE(s->tcg_op_defs); op++) { + for (op = 0; op < tcg_op_defs_org_max; op++) { const TCGOpDef *def = &s->tcg_op_defs[op]; if (def->flags & TCG_OPF_NOT_PRESENT) { /* Wrong entry in op definitions? */ diff --git a/qemu/tcg/tcg.h b/qemu/tcg/tcg.h index c3055c45..9e995793 100644 --- a/qemu/tcg/tcg.h +++ b/qemu/tcg/tcg.h @@ -831,6 +831,10 @@ static inline bool tcg_op_buf_full(TCGContext *tcg_ctx) return tcg_op_buf_count(tcg_ctx) >= OPC_MAX_SIZE; } +// UNICORN: Added +#define TCG_OP_DEFS_TABLE_SIZE 124 +extern const TCGOpDef tcg_op_defs_org[TCG_OP_DEFS_TABLE_SIZE]; + typedef struct TCGTargetOpDef { TCGOpcode op; const char *args_ct_str[TCG_MAX_OP_ARGS];