aboutsummaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-20 07:39:14 +0000
committerPeter Maydell <peter.maydell@linaro.org>2012-04-27 11:04:44 +0000
commit778c3a0619f3b47f94e566ca4f656aabe5f4b3d6 (patch)
tree62657bfb866880be18316425819a730e8228ad90 /target-arm
parentbe5ea8ed4481f0ffa4ea0f7ba13e465701536001 (diff)
downloadqemu-778c3a0619f3b47f94e566ca4f656aabe5f4b3d6.zip
qemu-778c3a0619f3b47f94e566ca4f656aabe5f4b3d6.tar.gz
qemu-778c3a0619f3b47f94e566ca4f656aabe5f4b3d6.tar.bz2
target-arm: Change cpu_arm_init() return type to ARMCPU
Make cpu_arm_init() return a QOM ARMCPU, so that we don't need to obtain an ARMCPU through arm_env_get_cpu() in machine init code. This requires to adjust the inclusion site of cpu-qom.h and in turn, forward-looking, to homogenize its include order. cpu_init() must still return a CPUARMState for backwards and cross-target compatibility, so adjust the cpu_init macro. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/cpu-qom.h1
-rw-r--r--target-arm/cpu.c2
-rw-r--r--target-arm/cpu.h7
-rw-r--r--target-arm/helper.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h
index b6c044a..2891521 100644
--- a/target-arm/cpu-qom.h
+++ b/target-arm/cpu-qom.h
@@ -21,7 +21,6 @@
#define QEMU_ARM_CPU_QOM_H
#include "qemu/cpu.h"
-#include "cpu.h"
#define TYPE_ARM_CPU "arm-cpu"
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index cc67d4d..2e0eccd 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -18,7 +18,7 @@
* <http://www.gnu.org/licenses/gpl-2.0.html>
*/
-#include "cpu-qom.h"
+#include "cpu.h"
#include "qemu-common.h"
#if !defined(CONFIG_USER_ONLY)
#include "hw/loader.h"
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 01e0e36..5eac070 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -238,7 +238,9 @@ typedef struct CPUARMState {
const struct arm_boot_info *boot_info;
} CPUARMState;
-CPUARMState *cpu_arm_init(const char *cpu_model);
+#include "cpu-qom.h"
+
+ARMCPU *cpu_arm_init(const char *cpu_model);
void arm_translate_init(void);
int cpu_arm_exec(CPUARMState *s);
void do_interrupt(CPUARMState *);
@@ -456,7 +458,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
#define TARGET_PHYS_ADDR_SPACE_BITS 32
#define TARGET_VIRT_ADDR_SPACE_BITS 32
-#define cpu_init cpu_arm_init
+#define cpu_init(model) (&cpu_arm_init(model)->env)
#define cpu_exec cpu_arm_exec
#define cpu_gen_code cpu_arm_gen_code
#define cpu_signal_handler cpu_arm_signal_handler
@@ -483,7 +485,6 @@ static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp)
#endif
#include "cpu-all.h"
-#include "cpu-qom.h"
/* Bit usage in the TB flags field: */
#define ARM_TBFLAG_THUMB_SHIFT 0
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 101031d..7e1c2c0 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -61,7 +61,7 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg)
return 0;
}
-CPUARMState *cpu_arm_init(const char *cpu_model)
+ARMCPU *cpu_arm_init(const char *cpu_model)
{
ARMCPU *cpu;
CPUARMState *env;
@@ -92,7 +92,7 @@ CPUARMState *cpu_arm_init(const char *cpu_model)
19, "arm-vfp.xml", 0);
}
qemu_init_vcpu(env);
- return env;
+ return cpu;
}
typedef struct ARMCPUListState {