[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 59/65] target/hppa: Fix interruption based on default PSW
|
From: |
Richard Henderson |
|
Subject: |
[PATCH v2 59/65] target/hppa: Fix interruption based on default PSW |
|
Date: |
Fri, 20 Oct 2023 13:43:25 -0700 |
From: Helge Deller <deller@gmx.de>
The default PSW is set by the operating system with the PDC_PSW
firmware call. Use that setting to decide if wide mode is to be
enabled for interruptions and EIRR usage.
Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/hppa/cpu.h | 2 ++
target/hppa/int_helper.c | 18 ++++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index c9a9b9d3be..4aea46442a 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -124,6 +124,8 @@
#define PSW_SM_W 0x200 /* PA2.0 only : Enable Wide Mode */
#define CR_RC 0
+#define CR_PSW_DEFAULT 6 /* see SeaBIOS PDC_PSW firmware call */
+#define PDC_PSW_WIDE_BIT 2
#define CR_PID1 8
#define CR_PID2 9
#define CR_PID3 12
diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c
index f355c4c76b..a11d607b31 100644
--- a/target/hppa/int_helper.c
+++ b/target/hppa/int_helper.c
@@ -52,9 +52,17 @@ static void io_eir_write(void *opaque, hwaddr addr,
uint64_t data, unsigned size)
{
HPPACPU *cpu = opaque;
- int le_bit = ~data & 31;
+ CPUHPPAState *env = &cpu->env;
+ int widthm1 = 31;
+ int le_bit;
- cpu->env.cr[CR_EIRR] |= (target_ulong)1 << le_bit;
+ /* The default PSW.W controls the width of EIRR. */
+ if (hppa_is_pa20(env) && env->cr[CR_PSW_DEFAULT] & PDC_PSW_WIDE_BIT) {
+ widthm1 = 63;
+ }
+ le_bit = ~data & widthm1;
+
+ env->cr[CR_EIRR] |= 1ull << le_bit;
eval_interrupt(cpu);
}
@@ -104,8 +112,10 @@ void hppa_cpu_do_interrupt(CPUState *cs)
/* step 1 */
env->cr[CR_IPSW] = old_psw = cpu_hppa_get_psw(env);
- /* step 2 -- note PSW_W == 0 for !HPPA64. */
- cpu_hppa_put_psw(env, PSW_W | (i == EXCP_HPMC ? PSW_M : 0));
+ /* step 2 -- Note PSW_W is masked out again for pa1.x */
+ cpu_hppa_put_psw(env,
+ (env->cr[CR_PSW_DEFAULT] & PDC_PSW_WIDE_BIT ? PSW_W : 0) |
+ (i == EXCP_HPMC ? PSW_M : 0));
/* step 3 */
env->cr[CR_IIASQ] = iasq_f >> 32;
--
2.34.1
- [PATCH v2 54/65] target/hppa: Implement HAVG, (continued)
- [PATCH v2 54/65] target/hppa: Implement HAVG, Richard Henderson, 2023/10/20
- [PATCH v2 55/65] target/hppa: Implement HSHL, HSHR, Richard Henderson, 2023/10/20
- [PATCH v2 56/65] target/hppa: Implement HSHLADD, HSHRADD, Richard Henderson, 2023/10/20
- [PATCH v2 50/65] target/hppa: Use tcg_temp_new_i64 not tcg_temp_new, Richard Henderson, 2023/10/20
- [PATCH v2 57/65] target/hppa: Implement MIXH, MIXW, Richard Henderson, 2023/10/20
- [PATCH v2 58/65] target/hppa: Implement PERMH, Richard Henderson, 2023/10/20
- [PATCH v2 60/65] target/hppa: Precompute zero into DisasContext, Richard Henderson, 2023/10/20
- [PATCH v2 61/65] target/hppa: Return zero for r0 from load_gpr, Richard Henderson, 2023/10/20
- [PATCH v2 59/65] target/hppa: Fix interruption based on default PSW,
Richard Henderson <=
- [PATCH v2 62/65] target/hppa: Simplify trans_dep*_imm, Richard Henderson, 2023/10/20
- [PATCH v2 65/65] linux-user/hppa: Drop EXCP_DUMP from handled exceptions, Richard Henderson, 2023/10/20
- [PATCH v2 64/65] hw/hppa: Translate phys addresses for the cpu, Richard Henderson, 2023/10/20
- [PATCH v2 63/65] include/hw/elf: Remove truncating signed casts, Richard Henderson, 2023/10/20