- Define LOCK_CAS_CHECK() in m68k/frame.h (there because it operates on

a clockframe).
- Call LOCK_CAS_CHECK() in clock_intr() (noted by Izumi Tsutsui).
This commit is contained in:
thorpej 2007-03-12 02:51:03 +00:00
parent b3cd0abcf6
commit 8f326e8290
3 changed files with 28 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: frame.h,v 1.26 2005/12/11 12:17:53 christos Exp $ */
/* $NetBSD: frame.h,v 1.27 2007/03/12 02:51:03 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -256,6 +256,26 @@ void buildcontext(struct lwp *, void *, void *);
void sendsig_sigcontext(const ksiginfo_t *, const sigset_t *);
#endif
#if defined(__mc68010__)
/*
* Restartable atomic sequence-cased compare-and-swap for locking
* primitives. We defined this here because it manipulates a
* "clockframe" as prepared by interrupt handlers.
*/
extern char _lock_cas_ras_start;
extern char _lock_cas_ras_end;
#define LOCK_CAS_CHECK(cfp) \
do { \
if ((cfp)->cf_pc < (u_long)&_lock_cas_ras_end && \
(cfp)->cf_pc > (u_long)&_lock_cas_ras_start) { \
(cfp)->cf_pc = (u_long)&_lock_cas_ras_start; \
} \
} while (/*CONSTCOND*/0)
#else
#define LOCK_CAS_CHECK(cfp) /* nothing */
#endif /* __mc68010__ */
#endif /* _KERNEL */
#endif /* _M68K_FRAME_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.11 2006/09/03 21:43:56 gdamore Exp $ */
/* $NetBSD: clock.c,v 1.12 2007/03/12 02:51:03 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2006/09/03 21:43:56 gdamore Exp $");
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.12 2007/03/12 02:51:03 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -95,6 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2006/09/03 21:43:56 gdamore Exp $");
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/leds.h>
#include <sun2/sun2/control.h>
@ -307,4 +308,6 @@ clock_intr(struct clockframe cf)
/* Call common clock interrupt handler. */
hardclock(&cf);
LOCK_CAS_CHECK(&cf);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: isr.c,v 1.13 2007/03/11 05:22:26 thorpej Exp $ */
/* $NetBSD: isr.c,v 1.14 2007/03/12 02:51:03 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.13 2007/03/11 05:22:26 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.14 2007/03/12 02:51:03 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -92,21 +92,6 @@ void *get_vector_entry(int);
void isr_autovec (struct clockframe);
void isr_vectored(struct clockframe);
#if defined(__mc68010__)
extern char _lock_cas_ras_start;
extern char _lock_cas_ras_end;
#define LOCK_CAS_CHECK(cfp) \
do { \
if ((cfp)->cf_pc < (u_long)&_lock_cas_ras_end && \
(cfp)->cf_pc > (u_long)&_lock_cas_ras_start) { \
(cfp)->cf_pc = (u_long)&_lock_cas_ras_start; \
} \
} while (/*CONSTCOND*/0)
#else /* ! __mc68010__ */
#define LOCK_CAS_CHECK(cfp) /* nothing */
#endif /* __mc68010__ */
void
isr_add_custom(int level, void *handler)
{