2003-11-23 17:55:54 +03:00
|
|
|
/*
|
2012-05-30 08:23:24 +04:00
|
|
|
* PowerPC emulation helpers for QEMU.
|
2007-09-17 01:08:06 +04:00
|
|
|
*
|
2007-03-07 11:32:30 +03:00
|
|
|
* Copyright (c) 2003-2007 Jocelyn Mayer
|
2003-11-23 17:55:54 +03:00
|
|
|
*
|
|
|
|
* 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
|
2009-07-17 00:47:01 +04:00
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2003-11-23 17:55:54 +03:00
|
|
|
*/
|
2005-07-05 02:17:05 +04:00
|
|
|
|
|
|
|
#include "cpu.h"
|
2007-10-26 01:35:50 +04:00
|
|
|
#include "helper_regs.h"
|
2008-12-16 13:43:58 +03:00
|
|
|
#include "kvm.h"
|
2011-09-30 01:39:10 +04:00
|
|
|
#include "kvm_ppc.h"
|
|
|
|
#include "cpus.h"
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2012-05-03 07:43:05 +04:00
|
|
|
PowerPCCPU *cpu_ppc_init(const char *cpu_model)
|
2007-04-16 12:56:52 +04:00
|
|
|
{
|
2012-04-06 16:39:03 +04:00
|
|
|
PowerPCCPU *cpu;
|
2007-04-16 12:56:52 +04:00
|
|
|
CPUPPCState *env;
|
2009-10-02 01:12:16 +04:00
|
|
|
const ppc_def_t *def;
|
2007-11-10 18:15:54 +03:00
|
|
|
|
|
|
|
def = cpu_ppc_find_by_name(cpu_model);
|
2012-05-30 08:23:24 +04:00
|
|
|
if (!def) {
|
2007-11-10 18:15:54 +03:00
|
|
|
return NULL;
|
2012-05-30 08:23:24 +04:00
|
|
|
}
|
2007-04-16 12:56:52 +04:00
|
|
|
|
2012-04-06 16:39:03 +04:00
|
|
|
cpu = POWERPC_CPU(object_new(TYPE_POWERPC_CPU));
|
|
|
|
env = &cpu->env;
|
2012-04-06 17:09:01 +04:00
|
|
|
|
2011-08-02 18:10:21 +04:00
|
|
|
if (tcg_enabled()) {
|
|
|
|
ppc_translate_init();
|
|
|
|
}
|
2012-04-06 17:09:01 +04:00
|
|
|
|
2007-12-09 05:22:57 +03:00
|
|
|
env->cpu_model_str = cpu_model;
|
2007-11-10 18:15:54 +03:00
|
|
|
cpu_ppc_register_internal(env, def);
|
2008-12-16 13:43:58 +03:00
|
|
|
|
2009-04-24 22:03:41 +04:00
|
|
|
qemu_init_vcpu(env);
|
2008-12-16 13:43:58 +03:00
|
|
|
|
2012-05-03 07:43:05 +04:00
|
|
|
return cpu;
|
2007-04-16 12:56:52 +04:00
|
|
|
}
|