From b92c0168f8f97067797ab4c4fc3d202ba0891393 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 5 Apr 2011 15:46:54 +0000 Subject: Move PSW in struct cpu_info. Also ensure that we leave interrupts disabled when switching to virtual mode in the trap handler. Re-enabling interrupts whilst in the trap handler for an interrupt makes life interesting. ok kettenis@ --- sys/arch/hppa64/hppa64/genassym.cf | 3 ++- sys/arch/hppa64/hppa64/locore.S | 20 +++++++++++++------- sys/arch/hppa64/hppa64/machdep.c | 4 +--- sys/arch/hppa64/include/cpu.h | 4 +++- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/sys/arch/hppa64/hppa64/genassym.cf b/sys/arch/hppa64/hppa64/genassym.cf index b145c09376f..31bb023d329 100644 --- a/sys/arch/hppa64/hppa64/genassym.cf +++ b/sys/arch/hppa64/hppa64/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.4 2008/04/20 17:11:24 kettenis Exp $ +# $OpenBSD: genassym.cf,v 1.5 2011/04/05 15:46:53 jsing Exp $ # # Copyright (c) 1982, 1990, 1993 @@ -128,6 +128,7 @@ member pcb_ksp member pcb_space struct cpu_info +member ci_psw member ci_curproc struct uvm diff --git a/sys/arch/hppa64/hppa64/locore.S b/sys/arch/hppa64/hppa64/locore.S index 5314ffadc91..d1735bdeaf0 100644 --- a/sys/arch/hppa64/hppa64/locore.S +++ b/sys/arch/hppa64/hppa64/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.14 2011/04/05 15:30:45 jsing Exp $ */ +/* $OpenBSD: locore.S,v 1.15 2011/04/05 15:46:53 jsing Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -45,8 +45,6 @@ .data .align 16 -$kpsl - .word PSL_W | PSL_Q | PSL_P | PSL_C | PSL_D | PSL_S | PSL_O .export cpl, data cpl .word IPL_HIGH @@ -94,6 +92,13 @@ $start mtctl %r1, %eirr mtctl %r0, %cr10 /* ccr */ + ldil L%cpu0_info, %r1 + ldo R%cpu0_info(%r1), %r1 + mtctl %r1, %cr24 + ldil L%(PSL_W|PSL_Q|PSL_P|PSL_C|PSL_D|PSL_S|PSL_O), %r8 + ldo R%(PSL_W|PSL_Q|PSL_P|PSL_C|PSL_D|PSL_S|PSL_O)(%r8), %r8 + stw %r8, CI_PSW(%r1) + ldil L%pdc, %r1 std %arg0, R%pdc(%r1) ldil L%boothowto, %r1 @@ -212,8 +217,8 @@ $start_zero_tf std %r1, TF_FLAGS(%arg2) std %arg3, TF_CR30(%arg2) - ldil L%$kpsl, %r1 - ldw R%$kpsl(%r1), arg7 + mfctl %cr24, %r1 + ldw CI_PSW(%r1), arg7 ldil L%$start_virt, %r31 ldo R%$start_virt(%r31), %r31 ldil L%$ivaaddr, %r1 @@ -651,8 +656,9 @@ ENTRY(TLABEL(all),0) mtctl %r9, %pcoq mtctl %r25, %cr29 - ldil L%$kpsl, %r9 - ldw R%$kpsl(%r9), %r9 + mfctl %cr24, %r9 + ldw CI_PSW(%r9), %r9 + depi 0, PSL_I_POS, 1, %r9 /* Leave interrupts disabled. */ mtctl %r9, %ipsw mfctl %cr30, %r9 diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c index f164a44986e..c3bb292d979 100644 --- a/sys/arch/hppa64/hppa64/machdep.c +++ b/sys/arch/hppa64/hppa64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.31 2011/04/05 14:13:25 jsing Exp $ */ +/* $OpenBSD: machdep.c,v 1.32 2011/04/05 15:46:53 jsing Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -182,8 +182,6 @@ hppa_init(paddr_t start) int error; paddr_t avail_end; - mtctl((long)&cpu0_info, 24); - pdc_init(); /* init PDC iface, so we can call em easy */ delay_init(); /* calculate cpu clock ratio */ diff --git a/sys/arch/hppa64/include/cpu.h b/sys/arch/hppa64/include/cpu.h index 88b5d46be49..4a328282ce5 100644 --- a/sys/arch/hppa64/include/cpu.h +++ b/sys/arch/hppa64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.19 2010/12/21 14:56:23 claudio Exp $ */ +/* $OpenBSD: cpu.h,v 1.20 2011/04/05 15:46:53 jsing Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -116,6 +116,8 @@ #include struct cpu_info { + volatile int ci_psw; + struct proc *ci_curproc; struct pcb *ci_cpcb; struct cpu_info *ci_next; -- cgit v1.2.3