Implement __HAVE_RAS. Unlike most implementation, this is done in userret

instead of cpu_switchto since we already accessing the proc structure so
the additional overhead of check p_raslist is minimal.
This commit is contained in:
matt 2012-05-25 12:32:48 +00:00
parent 99c563ccca
commit e950a585b9
2 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: types.h,v 1.44 2012/01/17 20:34:57 joerg Exp $ */
/* $NetBSD: types.h,v 1.45 2012/05/25 12:32:48 matt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -78,6 +78,9 @@ typedef volatile char __cpu_simple_lock_t;
#define __HAVE_CPU_DATA_FIRST
#define __HAVE_MM_MD_READWRITE
#define __HAVE_MM_MD_DIRECT_MAPPED_PHYS
#ifdef _KERNEL
#define __HAVE_RAS
#endif
#define __HAVE___LWP_GETPRIVATE_FAST
#define __HAVE_NO___THREAD

View File

@ -1,4 +1,4 @@
/* $NetBSD: userret.h,v 1.13 2011/07/03 02:18:20 matt Exp $ */
/* $NetBSD: userret.h,v 1.14 2012/05/25 12:32:48 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -31,6 +31,7 @@
*/
#include <sys/userret.h>
#include <sys/ras.h>
/*
* Common code used by various exception handlers to
@ -43,6 +44,15 @@ userret(struct lwp *l, struct trapframe *tf, u_quad_t oticks)
mi_userret(l);
/*
* Check to see if a RAS was interrupted and restart it if it was.
*/
if (__predict_false(p->p_raslist != NULL)) {
void * const ras_pc = ras_lookup(p, (void *) tf->tf_pc);
if (ras_pc != (void *) -1)
tf->tf_pc = (vaddr_t) ras_pc;
}
/*
* If profiling, charge system time to the trapped pc.
*/