summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2007-05-29 20:22:11 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2007-05-29 20:22:11 +0000
commit61fe44591a758344c988e9dd59faba1c0a08dd95 (patch)
tree00f43ce2d3f066cb1ca2954709477a4df015c1cc /sys/arch/powerpc
parentc3607619e4085e9171fba8aabba45501ed7de795 (diff)
Panic if the locker is self.
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r--sys/arch/powerpc/powerpc/mutex.S16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/arch/powerpc/powerpc/mutex.S b/sys/arch/powerpc/powerpc/mutex.S
index 24f0c4c6ad9..0b5bfab1e6b 100644
--- a/sys/arch/powerpc/powerpc/mutex.S
+++ b/sys/arch/powerpc/powerpc/mutex.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.S,v 1.1 2007/03/22 19:26:28 kettenis Exp $ */
+/* $OpenBSD: mutex.S,v 1.2 2007/05/29 20:22:10 drahn Exp $ */
/*
* Copyright (c) 2007 Dale Rahn
@@ -51,6 +51,10 @@ ENTRY(mtx_enter)
cmpwi 0,%r6,0 # test owner == 0
beq+ 0,.L_mutex_free # if owner == 0 branch free
.L_mutex_locked:
+#ifdef DIAGNOSTIC
+ cmpl 0,%r4,%r6
+ beq- .L_mutex_selflocked
+#endif
stw %r3,28(%r1) # save mtx during lcsplx
la %r4,28(%r1)
stwcx. %r3,0,%r4 # unreserve owner
@@ -68,6 +72,16 @@ ENTRY(mtx_enter)
addi %r1,%r1,32 # restore stack
blr
+#ifdef DIAGNOSTIC
+.L_mutex_selflocked:
+ mr %r5, %r3
+ lis %r3,.L_panicstr@ha
+ la %r3,.L_panicstr@l(%r3)
+ bl panic
+.L_panicstr:
+ .string "mtx_enter: recursed %x %x\n"
+#endif
+
ENTRY(mtx_leave)
li %r4,0