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