fix hppa ucas_*():

- "ret" is a kernel-space pointer.
 - move the ucas RAS check from the device interrupt path
   to the page-fault path.
This commit is contained in:
chs 2010-07-07 01:18:39 +00:00
parent e8200b900c
commit 794a8be6ca
3 changed files with 18 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.25 2010/03/31 17:46:21 skrll Exp $ */
/* $NetBSD: intr.c,v 1.26 2010/07/07 01:18:39 chs Exp $ */
/* $OpenBSD: intr.c,v 1.27 2009/12/31 12:52:35 jsing Exp $ */
/*
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.25 2010/03/31 17:46:21 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.26 2010/07/07 01:18:39 chs Exp $");
#define __MUTEX_PRIVATE
@ -370,9 +370,6 @@ hppa_intr(struct trapframe *frame)
int hp700_intr_ipending_new(struct hp700_int_reg *, int);
struct cpu_info *ci = curcpu();
extern char ucas_ras_start[];
extern char ucas_ras_end[];
#ifndef LOCKDEBUG
extern char mutex_enter_crit_start[];
extern char mutex_enter_crit_end[];
@ -399,13 +396,6 @@ hppa_intr(struct trapframe *frame)
((kmutex_t *)frame->tf_arg0)->mtx_owner = (uintptr_t)curlwp;
#endif
if (frame->tf_iisq_head == HPPA_SID_KERNEL &&
frame->tf_iioq_head >= (u_int)ucas_ras_start &&
frame->tf_iioq_head <= (u_int)ucas_ras_end) {
frame->tf_iioq_head = (u_int)ucas_ras_start;
frame->tf_iioq_tail = (u_int)ucas_ras_start + 4;
}
/*
* Read the CPU interrupt register and acknowledge all interrupts.
* Starting with this value, get our set of new pending interrupts and

View File

@ -1,4 +1,4 @@
/* $NetBSD: copy.S,v 1.17 2010/06/06 12:13:36 skrll Exp $ */
/* $NetBSD: copy.S,v 1.18 2010/07/07 01:18:39 chs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -363,14 +363,11 @@ LEAF_ENTRY(ucas_32)
ucas_ras_start:
ldw 0(%sr1, %arg0), %t1
comb,<> %arg1, %t1, 2f
copy %t1, %ret1
ucas_ras_end:
comb,<> %arg1, %t1, ucas_ras_end
copy %r0, %ret0
stw %arg2, 0(%sr1, %arg0)
copy %arg1, %ret1
2:
stw %ret1, 0(%sr1, %arg3)
copy %r0, %ret0
ucas_ras_end:
stw %t1, 0(%arg3)
L$ucas_32_fault:
bv 0(%rp)
@ -380,4 +377,3 @@ L$ucas_32_fault:
bv 0(%rp)
ldi EFAULT, %ret0
EXIT(ucas_32)

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.92 2010/05/31 20:19:33 skrll Exp $ */
/* $NetBSD: trap.c,v 1.93 2010/07/07 01:18:39 chs Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.92 2010/05/31 20:19:33 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.93 2010/07/07 01:18:39 chs Exp $");
/* #define INTRDEBUG */
/* #define TRAPDEBUG */
@ -917,6 +917,15 @@ do_onfault:
panic("trap: uvm_fault(%p, %lx, %d): %d",
map, va, vftype, ret);
}
} else if ((type & T_USER) == 0) {
extern char ucas_ras_start[];
extern char ucas_ras_end[];
if (frame->tf_iioq_head > (u_int)ucas_ras_start &&
frame->tf_iioq_head < (u_int)ucas_ras_end) {
frame->tf_iioq_head = (u_int)ucas_ras_start;
frame->tf_iioq_tail = (u_int)ucas_ras_start + 4;
}
}
break;