[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 11/20] target-ppc: QOM'ify CPU reset
From: |
Andreas Färber |
Subject: |
[Qemu-ppc] [PATCH 11/20] target-ppc: QOM'ify CPU reset |
Date: |
Sun, 15 Apr 2012 20:38:55 +0200 |
Move code from cpu_state_reset() into ppc_cpu_reset().
Reorder #include of helper_regs.h to use it in translate_init.c.
Adjust whitespace and add braces.
Signed-off-by: Andreas Färber <address@hidden>
Acked-by: David Gibson <address@hidden>
---
target-ppc/helper.c | 45 +-----------------------------------------
target-ppc/translate.c | 2 +-
target-ppc/translate_init.c | 46 ++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 47 insertions(+), 46 deletions(-)
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index c5de0ea..c610ce3 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -3138,50 +3138,7 @@ void cpu_dump_rfi (target_ulong RA, target_ulong msr)
void cpu_state_reset(CPUPPCState *env)
{
- target_ulong msr;
-
- if (qemu_loglevel_mask(CPU_LOG_RESET)) {
- qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
- log_cpu_state(env, 0);
- }
-
- msr = (target_ulong)0;
- if (0) {
- /* XXX: find a suitable condition to enable the hypervisor mode */
- msr |= (target_ulong)MSR_HVB;
- }
- msr |= (target_ulong)0 << MSR_AP; /* TO BE CHECKED */
- msr |= (target_ulong)0 << MSR_SA; /* TO BE CHECKED */
- msr |= (target_ulong)1 << MSR_EP;
-#if defined (DO_SINGLE_STEP) && 0
- /* Single step trace mode */
- msr |= (target_ulong)1 << MSR_SE;
- msr |= (target_ulong)1 << MSR_BE;
-#endif
-#if defined(CONFIG_USER_ONLY)
- msr |= (target_ulong)1 << MSR_FP; /* Allow floating point usage */
- msr |= (target_ulong)1 << MSR_VR; /* Allow altivec usage */
- msr |= (target_ulong)1 << MSR_SPE; /* Allow SPE usage */
- msr |= (target_ulong)1 << MSR_PR;
-#else
- env->excp_prefix = env->hreset_excp_prefix;
- env->nip = env->hreset_vector | env->excp_prefix;
- if (env->mmu_model != POWERPC_MMU_REAL)
- ppc_tlb_invalidate_all(env);
-#endif
- env->msr = msr & env->msr_mask;
-#if defined(TARGET_PPC64)
- if (env->mmu_model & POWERPC_MMU_64)
- env->msr |= (1ULL << MSR_SF);
-#endif
- hreg_compute_hflags(env);
- env->reserve_addr = (target_ulong)-1ULL;
- /* Be sure no exception or interrupt is pending */
- env->pending_interrupts = 0;
- env->exception_index = POWERPC_EXCP_NONE;
- env->error_code = 0;
- /* Flush all TLBs */
- tlb_flush(env, 1);
+ cpu_reset(ENV_GET_CPU(env));
}
CPUPPCState *cpu_ppc_init (const char *cpu_model)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index c9a503a..cf59765 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -9306,8 +9306,8 @@ GEN_SPEOP_LDST(evstwwe, 0x1C, 2),
GEN_SPEOP_LDST(evstwwo, 0x1E, 2),
};
-#include "translate_init.c"
#include "helper_regs.h"
+#include "translate_init.c"
/*****************************************************************************/
/* Misc PowerPC helpers */
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 5a7ac77..025122d 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -10211,10 +10211,54 @@ static void ppc_cpu_reset(CPUState *s)
PowerPCCPU *cpu = POWERPC_CPU(s);
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
CPUPPCState *env = &cpu->env;
+ target_ulong msr;
+
+ if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+ qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+ log_cpu_state(env, 0);
+ }
pcc->parent_reset(s);
- cpu_state_reset(env);
+ msr = (target_ulong)0;
+ if (0) {
+ /* XXX: find a suitable condition to enable the hypervisor mode */
+ msr |= (target_ulong)MSR_HVB;
+ }
+ msr |= (target_ulong)0 << MSR_AP; /* TO BE CHECKED */
+ msr |= (target_ulong)0 << MSR_SA; /* TO BE CHECKED */
+ msr |= (target_ulong)1 << MSR_EP;
+#if defined(DO_SINGLE_STEP) && 0
+ /* Single step trace mode */
+ msr |= (target_ulong)1 << MSR_SE;
+ msr |= (target_ulong)1 << MSR_BE;
+#endif
+#if defined(CONFIG_USER_ONLY)
+ msr |= (target_ulong)1 << MSR_FP; /* Allow floating point usage */
+ msr |= (target_ulong)1 << MSR_VR; /* Allow altivec usage */
+ msr |= (target_ulong)1 << MSR_SPE; /* Allow SPE usage */
+ msr |= (target_ulong)1 << MSR_PR;
+#else
+ env->excp_prefix = env->hreset_excp_prefix;
+ env->nip = env->hreset_vector | env->excp_prefix;
+ if (env->mmu_model != POWERPC_MMU_REAL) {
+ ppc_tlb_invalidate_all(env);
+ }
+#endif
+ env->msr = msr & env->msr_mask;
+#if defined(TARGET_PPC64)
+ if (env->mmu_model & POWERPC_MMU_64) {
+ env->msr |= (1ULL << MSR_SF);
+ }
+#endif
+ hreg_compute_hflags(env);
+ env->reserve_addr = (target_ulong)-1ULL;
+ /* Be sure no exception or interrupt is pending */
+ env->pending_interrupts = 0;
+ env->exception_index = POWERPC_EXCP_NONE;
+ env->error_code = 0;
+ /* Flush all TLBs */
+ tlb_flush(env, 1);
}
static void ppc_cpu_initfn(Object *obj)
--
1.7.7
- [Qemu-ppc] [PULL] ppc patch queue 2012-04-15, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 01/20] PPC: Fix TLB invalidation bug within the PPC interrupt handler., Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 03/20] pseries: Fix bug with reset of VIO CRQs, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 04/20] pseries: Implement RTAS system-reboot call, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 05/20] pseries: Remove unused fields from VIOsPAPRBus structure, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 07/20] target-ppc: Drop cpu_ppc_close(), Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 11/20] target-ppc: QOM'ify CPU reset,
Andreas Färber <=
- [Qemu-ppc] [PATCH 09/20] target-ppc: QOM'ify CPU, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 12/20] target-ppc: Fix type casts for w64 (uintptr_t), Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 10/20] target-ppc: Start QOM'ifying CPU init, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 13/20] target-ppc: Init dcache and icache size for e500 user mode, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 08/20] target-ppc: Add hooks for handling tcg and kvm limitations, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 15/20] pseries: Fix RTAS based config access, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 17/20] pseries: Remove old hcalls hook stub, Andreas Färber, 2012/04/15