diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-09 17:30:56 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-09 17:30:56 +0000 |
commit | c4819adfb371c4b8ea161ad8d6188da1738027cd (patch) | |
tree | 0482a00096175c941137686711bdff63fd0cde1b /sys/arch/mvme68k | |
parent | 0e63b28de578b1f7e6f6cc4940a3bfb8802cb07d (diff) |
Move splassert_check() from common m68k code to each m68k-based architecture,
as its implementation may vary accross platforms (and will very soon).
Diffstat (limited to 'sys/arch/mvme68k')
-rw-r--r-- | sys/arch/mvme68k/mvme68k/machdep.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index f4bf15e6421..cffa80442df 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.107 2007/11/02 19:18:54 martin Exp $ */ +/* $OpenBSD: machdep.c,v 1.108 2007/11/09 17:30:55 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -996,3 +996,24 @@ memsize162() } } #endif + +#ifdef DIAGNOSTIC +void +splassert_check(int wantipl, const char *func) +{ + int oldipl; + + __asm __volatile ("movew sr,%0" : "=&d" (oldipl)); + + oldipl = PSLTOIPL(oldipl); + + if (oldipl < wantipl) { + splassert_fail(wantipl, oldipl, func); + /* + * If the splassert_ctl is set to not panic, raise the ipl + * in a feeble attempt to reduce damage. + */ + _spl(PSL_S | IPLTOPSL(wantipl)); + } +} +#endif |