Skip to content

Commit ab9af35

Browse files
hdellerrth7680
authored andcommitted
target/hppa: Fix interruption based on default PSW
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>
1 parent 4e7abdb commit ab9af35

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

target/hppa/cpu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@
137137
#define PSW_SM_W 0x200 /* PA2.0 only : Enable Wide Mode */
138138

139139
#define CR_RC 0
140+
#define CR_PSW_DEFAULT 6 /* see SeaBIOS PDC_PSW firmware call */
141+
#define PDC_PSW_WIDE_BIT 2
140142
#define CR_PID1 8
141143
#define CR_PID2 9
142144
#define CR_PID3 12

target/hppa/int_helper.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,17 @@ static void io_eir_write(void *opaque, hwaddr addr,
5252
uint64_t data, unsigned size)
5353
{
5454
HPPACPU *cpu = opaque;
55-
int le_bit = ~data & 31;
55+
CPUHPPAState *env = &cpu->env;
56+
int widthm1 = 31;
57+
int le_bit;
58+
59+
/* The default PSW.W controls the width of EIRR. */
60+
if (hppa_is_pa20(env) && env->cr[CR_PSW_DEFAULT] & PDC_PSW_WIDE_BIT) {
61+
widthm1 = 63;
62+
}
63+
le_bit = ~data & widthm1;
5664

57-
cpu->env.cr[CR_EIRR] |= (target_ulong)1 << le_bit;
65+
env->cr[CR_EIRR] |= 1ull << le_bit;
5866
eval_interrupt(cpu);
5967
}
6068

@@ -104,8 +112,10 @@ void hppa_cpu_do_interrupt(CPUState *cs)
104112
/* step 1 */
105113
env->cr[CR_IPSW] = old_psw = cpu_hppa_get_psw(env);
106114

107-
/* step 2 -- note PSW_W == 0 for !HPPA64. */
108-
cpu_hppa_put_psw(env, PSW_W | (i == EXCP_HPMC ? PSW_M : 0));
115+
/* step 2 -- Note PSW_W is masked out again for pa1.x */
116+
cpu_hppa_put_psw(env,
117+
(env->cr[CR_PSW_DEFAULT] & PDC_PSW_WIDE_BIT ? PSW_W : 0) |
118+
(i == EXCP_HPMC ? PSW_M : 0));
109119

110120
/* step 3 */
111121
env->cr[CR_IIASQ] = iasq_f >> 32;

0 commit comments

Comments
 (0)