translate-all.c revision 178d85b8274f9ac82fb553c80760bbbb4044401c
/*
* Host code generation
*
* Copyright (c) 2003 Fabrice Bellard
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "config.h"
#define NO_CPU_IO_DEFS
#include "cpu.h"
#include "exec-all.h"
#include "disas.h"
#include "tcg.h"
/* code generation context */
#if defined(TARGET_I386)
#elif defined(TARGET_SPARC)
#endif
/* XXX: suppress that */
unsigned long code_gen_max_block_size(void)
{
#ifdef VBOX
/* Just to suppress a lot of dummy warnings */
static long max;
#else
static unsigned long max;
#endif
if (max == 0) {
#include "tcg-opc.h"
max *= OPC_MAX_SIZE;
}
return max;
}
void cpu_gen_init(void)
{
CPU_TEMP_BUF_NLONGS * sizeof(long));
}
/* return non zero if the very first instruction is invalid so that
the virtual CPU can trigger an exception.
'*gen_code_size_ptr' contains the size of the generated code (host
code).
*/
{
TCGContext *s = &tcg_ctx;
int gen_code_size;
#ifdef CONFIG_PROFILER
#endif
#ifdef CONFIG_PROFILER
s->tb_count1++; /* includes aborted translations because of
exceptions */
ti = profile_getclock();
#endif
#ifdef VBOX
#endif
tcg_func_start(s);
/* generate machine code */
#ifdef USE_DIRECT_JUMP
/* the following two entries are optional (only used for string ops) */
/* XXX: not used ? */
#else
s->tb_jmp_offset = NULL;
#endif
#ifdef CONFIG_PROFILER
s->tb_count++;
s->code_time -= profile_getclock();
#endif
#ifdef CONFIG_PROFILER
s->code_time += profile_getclock();
s->code_out_len += gen_code_size;
#endif
#ifdef VBOX
#endif
#ifdef DEBUG_DISAS
if (loglevel & CPU_LOG_TB_OUT_ASM) {
}
#endif
return 0;
}
/* The cpu state corresponding to 'searched_pc' is restored.
*/
void *puc)
{
TCGContext *s = &tcg_ctx;
int j;
unsigned long tc_ptr;
#ifdef CONFIG_PROFILER
#endif
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
tcg_func_start(s);
if (use_icount) {
/* Reset the cycle counter to the start of the block. */
/* Clear the IO flag. */
}
/* find opc index corresponding to search_pc */
if (searched_pc < tc_ptr)
return -1;
#ifdef USE_DIRECT_JUMP
#else
s->tb_jmp_offset = NULL;
#endif
if (j < 0)
return -1;
/* now find start of instruction before */
while (gen_opc_instr_start[j] == 0)
j--;
#ifdef CONFIG_PROFILER
s->restore_count++;
#endif
return 0;
}