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