[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 66/72] PPC: Add support for MSR_CM
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 66/72] PPC: Add support for MSR_CM |
Date: |
Sun, 24 Jun 2012 01:07:30 +0200 |
The BookE variant of MSR_SF is MSR_CM. Implement everything it takes in TCG to
support running 64bit code with MSR_CM set.
Signed-off-by: Alexander Graf <address@hidden>
---
target-ppc/cpu.h | 9 +++++++++
target-ppc/excp_helper.c | 9 +++++----
target-ppc/mem_helper.c | 2 +-
target-ppc/translate.c | 2 +-
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 12200ab..7a77fff 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -2212,6 +2212,15 @@ static inline uint32_t booke206_tlbnps(CPUPPCState *env,
const int tlbn)
#endif
+static inline bool msr_is_64bit(CPUPPCState *env, target_ulong msr)
+{
+ if (env->mmu_model == POWERPC_MMU_BOOKE206) {
+ return msr & (1ULL << MSR_CM);
+ }
+
+ return msr & (1ULL << MSR_SF);
+}
+
extern void (*cpu_ppc_hypercall)(CPUPPCState *);
static inline bool cpu_has_work(CPUPPCState *env)
diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
index c7762b9..1a593f6 100644
--- a/target-ppc/excp_helper.c
+++ b/target-ppc/excp_helper.c
@@ -608,10 +608,11 @@ static inline void powerpc_excp(CPUPPCState *env, int
excp_model, int excp)
vector |= env->excp_prefix;
#if defined(TARGET_PPC64)
if (excp_model == POWERPC_EXCP_BOOKE) {
- if (!msr_icm) {
- vector = (uint32_t)vector;
- } else {
+ if (env->spr[SPR_BOOKE_EPCR] & EPCR_ICM) {
+ /* Cat.64-bit: EPCR.ICM is copied to MSR.CM */
new_msr |= (target_ulong)1 << MSR_CM;
+ } else {
+ vector = (uint32_t)vector;
}
} else {
if (!msr_isf && !(env->mmu_model & POWERPC_MMU_64)) {
@@ -803,7 +804,7 @@ static inline void do_rfi(CPUPPCState *env, target_ulong
nip, target_ulong msr,
target_ulong msrm, int keep_msrh)
{
#if defined(TARGET_PPC64)
- if (msr & (1ULL << MSR_SF)) {
+ if (msr_is_64bit(env, msr)) {
nip = (uint64_t)nip;
msr &= (uint64_t)msrm;
} else {
diff --git a/target-ppc/mem_helper.c b/target-ppc/mem_helper.c
index ebcd7b2..5b5f1bd 100644
--- a/target-ppc/mem_helper.c
+++ b/target-ppc/mem_helper.c
@@ -35,7 +35,7 @@ static inline target_ulong addr_add(CPUPPCState *env,
target_ulong addr,
target_long arg)
{
#if defined(TARGET_PPC64)
- if (!msr_sf) {
+ if (!msr_is_64bit(env, env->msr)) {
return (uint32_t)(addr + arg);
} else
#endif
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 9103fd5..73ee74b 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -9626,7 +9626,7 @@ static inline void
gen_intermediate_code_internal(CPUPPCState *env,
ctx.access_type = -1;
ctx.le_mode = env->hflags & (1 << MSR_LE) ? 1 : 0;
#if defined(TARGET_PPC64)
- ctx.sf_mode = msr_sf;
+ ctx.sf_mode = msr_is_64bit(env, env->msr);
ctx.has_cfar = !!(env->flags & POWERPC_FLAG_CFAR);
#endif
ctx.fpu_enabled = msr_fp;
--
1.6.0.2
- [Qemu-ppc] [PATCH 42/72] PPC: e500: dt: create /hypervisor node dynamically, (continued)
- [Qemu-ppc] [PATCH 42/72] PPC: e500: dt: create /hypervisor node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 35/72] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 50/72] PPC: e500: dt: start with empty device tree, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 30/72] raw-posix: Fix build without is_allocated support, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 68/72] PPC: BookE: Make ivpr selectable by CPU type, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 47/72] PPC: e500: dt: create mpic node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 72/72] PPC: BookE206: Bump MAS2 to 64bit, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 71/72] PPC: BookE: Support 32 and 64 bit wide MAS2, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 07/72] ppc: Avoid AREG0 for FPU and SPE helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 63/72] PPC: e500: allow users to set the /compatible property via -machine, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 66/72] PPC: Add support for MSR_CM,
Alexander Graf <=
- [Qemu-ppc] [PATCH 70/72] PPC: Extract SPR dump generation into its own function, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 52/72] PPC: e500: dt: use 64bit cell helper, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 10/72] ppc: Split MMU etc. helpers from op_helper.c, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 33/72] dt: add helper for phandle references, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 44/72] PPC: e500: dt: create /chosen node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 32/72] dt: add helpers for multi-cell adds, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 29/72] spapr: Add "memop" hypercall, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 61/72] PPC: e500: Refactor serial dt generation, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 45/72] PPC: e500: dt: create /soc8544 node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 36/72] dt: add helper for empty dt creation, Alexander Graf, 2012/06/23