ed69e8314d
to do this, we need to take code out of cpu.c and helper.c, and also move some prototypes from cpu.h, for code that is needed in tcg/xxx_helper.c, and which in turn is part of the callbacks registered by the class initialization. Therefore, do some shuffling of the parts of cpu.h that are only relevant for tcg/, and put them in tcg/helper-tcg.h For FT0 and similar macros, put them in tcg/fpu-helper.c since they are used only there. Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20201212155530.23098-8-cfontana@suse.de> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
72 lines
2.1 KiB
C
72 lines
2.1 KiB
C
/*
|
|
* i386 TCG cpu class initialization
|
|
*
|
|
* Copyright (c) 2003 Fabrice Bellard
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "cpu.h"
|
|
#include "tcg-cpu.h"
|
|
#include "exec/exec-all.h"
|
|
#include "sysemu/runstate.h"
|
|
#include "helper-tcg.h"
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
#include "hw/i386/apic.h"
|
|
#endif
|
|
|
|
/* Frob eflags into and out of the CPU temporary format. */
|
|
|
|
static void x86_cpu_exec_enter(CPUState *cs)
|
|
{
|
|
X86CPU *cpu = X86_CPU(cs);
|
|
CPUX86State *env = &cpu->env;
|
|
|
|
CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
|
|
env->df = 1 - (2 * ((env->eflags >> 10) & 1));
|
|
CC_OP = CC_OP_EFLAGS;
|
|
env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
|
|
}
|
|
|
|
static void x86_cpu_exec_exit(CPUState *cs)
|
|
{
|
|
X86CPU *cpu = X86_CPU(cs);
|
|
CPUX86State *env = &cpu->env;
|
|
|
|
env->eflags = cpu_compute_eflags(env);
|
|
}
|
|
|
|
static void x86_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb)
|
|
{
|
|
X86CPU *cpu = X86_CPU(cs);
|
|
|
|
cpu->env.eip = tb->pc - tb->cs_base;
|
|
}
|
|
|
|
void tcg_cpu_common_class_init(CPUClass *cc)
|
|
{
|
|
cc->do_interrupt = x86_cpu_do_interrupt;
|
|
cc->cpu_exec_interrupt = x86_cpu_exec_interrupt;
|
|
cc->synchronize_from_tb = x86_cpu_synchronize_from_tb;
|
|
cc->cpu_exec_enter = x86_cpu_exec_enter;
|
|
cc->cpu_exec_exit = x86_cpu_exec_exit;
|
|
cc->tcg_initialize = tcg_x86_init;
|
|
cc->tlb_fill = x86_cpu_tlb_fill;
|
|
#ifndef CONFIG_USER_ONLY
|
|
cc->debug_excp_handler = breakpoint_handler;
|
|
#endif
|
|
}
|