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