[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/41] target/ppc/mmu_common: Fix SRR1/MSR error code on Book-E
From: |
Cédric Le Goater |
Subject: |
[PULL 03/41] target/ppc/mmu_common: Fix SRR1/MSR error code on Book-E |
Date: |
Mon, 31 Jan 2022 12:07:33 +0100 |
From: Vitaly Cheptsov <cheptsov@ispras.ru>
Book-E architecture does not set the error code in 31:27 bits
of SRR1, but instead uses these bits for custom fields such
as GS (Guest Supervisor).
Wrongly setting these fields will result in QEMU crashes
when attempting to execute not executable code due to the attempts
to use Guest Supervisor mode.
Cc: "Cédric Le Goater" <clg@kaod.org>
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Greg Kurz <groug@kaod.org>
Cc: qemu-ppc@nongnu.org
Cc: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220121093107.15478-1-cheptsov@ispras.ru>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/mmu_common.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
index 91270c1f17eb..6512ee031cfc 100644
--- a/target/ppc/mmu_common.c
+++ b/target/ppc/mmu_common.c
@@ -1367,22 +1367,34 @@ static bool ppc_jumbo_xlate(PowerPCCPU *cpu, vaddr
eaddr,
case -2:
/* Access rights violation */
cs->exception_index = POWERPC_EXCP_ISI;
- env->error_code = 0x08000000;
+ if ((env->mmu_model == POWERPC_MMU_BOOKE) ||
+ (env->mmu_model == POWERPC_MMU_BOOKE206)) {
+ env->error_code = 0;
+ } else {
+ env->error_code = 0x08000000;
+ }
break;
case -3:
/* No execute protection violation */
if ((env->mmu_model == POWERPC_MMU_BOOKE) ||
(env->mmu_model == POWERPC_MMU_BOOKE206)) {
env->spr[SPR_BOOKE_ESR] = 0x00000000;
+ env->error_code = 0;
+ } else {
+ env->error_code = 0x10000000;
}
cs->exception_index = POWERPC_EXCP_ISI;
- env->error_code = 0x10000000;
break;
case -4:
/* Direct store exception */
/* No code fetch is allowed in direct-store areas */
cs->exception_index = POWERPC_EXCP_ISI;
- env->error_code = 0x10000000;
+ if ((env->mmu_model == POWERPC_MMU_BOOKE) ||
+ (env->mmu_model == POWERPC_MMU_BOOKE206)) {
+ env->error_code = 0;
+ } else {
+ env->error_code = 0x10000000;
+ }
break;
}
} else {
--
2.34.1
- [PULL 28/41] target/ppc: Introduce powerpc_excp_books, (continued)
- [PULL 28/41] target/ppc: Introduce powerpc_excp_books, Cédric Le Goater, 2022/01/31
- [PULL 39/41] target/ppc: 74xx: System Reset interrupt cleanup, Cédric Le Goater, 2022/01/31
- [PULL 15/41] target/ppc: 405: Add missing MSR_ME bit, Cédric Le Goater, 2022/01/31
- [PULL 37/41] target/ppc: 74xx: Program exception cleanup, Cédric Le Goater, 2022/01/31
- [PULL 17/41] target/ppc: Simplify powerpc_excp_40x, Cédric Le Goater, 2022/01/31
- [PULL 22/41] target/ppc: 405: Alignment exception cleanup, Cédric Le Goater, 2022/01/31
- [PULL 21/41] target/ppc: 405: System call exception cleanup, Cédric Le Goater, 2022/01/31
- [PULL 34/41] target/ppc: Simplify powerpc_excp_74xx, Cédric Le Goater, 2022/01/31
- [PULL 09/41] spapr.c: check bus != NULL in spapr_get_fw_dev_path(), Cédric Le Goater, 2022/01/31
- [PULL 04/41] ppc/pnv: Fail DMA access if page permissions are not correct, Cédric Le Goater, 2022/01/31
- [PULL 03/41] target/ppc/mmu_common: Fix SRR1/MSR error code on Book-E,
Cédric Le Goater <=
- [PULL 08/41] target/ppc: fix 'skip KVM' cond in cpu_interrupt_exittb(), Cédric Le Goater, 2022/01/31
- [PULL 20/41] target/ppc: 405: External exception cleanup, Cédric Le Goater, 2022/01/31
- [PULL 13/41] ppc/ppc405: Fix TLB flushing, Cédric Le Goater, 2022/01/31
- Re: [PULL 00/41] ppc queue, Peter Maydell, 2022/01/31