qemu/target-arm/cpu-qom.h
Peter Maydell 0ca7e01cbc target-arm: Move SCTLR reset value setup to per cpu init fns
Move the reset value of SCTLR to ARMCPU, initialised in
the per-cpu init functions. It can then be reset by a
simple copy, and we can drop the code from cpu_reset_model_id().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
2012-04-21 18:10:44 +00:00

90 lines
2.4 KiB
C

/*
* QEMU ARM CPU
*
* Copyright (c) 2012 SUSE LINUX Products GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>
*/
#ifndef QEMU_ARM_CPU_QOM_H
#define QEMU_ARM_CPU_QOM_H
#include "qemu/cpu.h"
#include "cpu.h"
#define TYPE_ARM_CPU "arm-cpu"
#define ARM_CPU_CLASS(klass) \
OBJECT_CLASS_CHECK(ARMCPUClass, (klass), TYPE_ARM_CPU)
#define ARM_CPU(obj) \
OBJECT_CHECK(ARMCPU, (obj), TYPE_ARM_CPU)
#define ARM_CPU_GET_CLASS(obj) \
OBJECT_GET_CLASS(ARMCPUClass, (obj), TYPE_ARM_CPU)
/**
* ARMCPUClass:
* @parent_reset: The parent class' reset handler.
*
* An ARM CPU model.
*/
typedef struct ARMCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/
void (*parent_reset)(CPUState *cpu);
} ARMCPUClass;
/**
* ARMCPU:
* @env: #CPUARMState
*
* An ARM CPU core.
*/
typedef struct ARMCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/
CPUARMState env;
/* The instance init functions for implementation-specific subclasses
* set these fields to specify the implementation-dependent values of
* various constant registers and reset values of non-constant
* registers.
* Some of these might become QOM properties eventually.
* Field names match the official register names as defined in the
* ARMv7AR ARM Architecture Reference Manual. A reset_ prefix
* is used for reset values of non-constant registers; no reset_
* prefix means a constant register.
*/
uint32_t midr;
uint32_t reset_fpsid;
uint32_t mvfr0;
uint32_t mvfr1;
uint32_t ctr;
uint32_t reset_sctlr;
} ARMCPU;
static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
{
return ARM_CPU(container_of(env, ARMCPU, env));
}
#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
void arm_cpu_realize(ARMCPU *cpu);
#endif