summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2004-12-24 21:22:02 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2004-12-24 21:22:02 +0000
commitb11ac86a3fab5005d005684c5a1872b7ce954767 (patch)
treeeaa1706ec69e4561ef3a97b7a52f68c17b9caaab /sys/arch/i386
parent3313f98620cd834b80a7ac8c30829b7c50747781 (diff)
Rewrite intlock/intunlock not to pass around interrupt frame directly
without copying which is against C conventions and broke GENERIC.MP with a gcc3 optimization From niklas, tested by many
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/apicvec.s6
-rw-r--r--sys/arch/i386/i386/genassym.cf6
-rw-r--r--sys/arch/i386/i386/machdep.c10
-rw-r--r--sys/arch/i386/i386/vector.s14
-rw-r--r--sys/arch/i386/include/intr.h6
5 files changed, 23 insertions, 19 deletions
diff --git a/sys/arch/i386/i386/apicvec.s b/sys/arch/i386/i386/apicvec.s
index 59f3744052e..ae39cf975aa 100644
--- a/sys/arch/i386/i386/apicvec.s
+++ b/sys/arch/i386/i386/apicvec.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: apicvec.s,v 1.4 2004/08/12 06:11:57 niklas Exp $ */
+/* $OpenBSD: apicvec.s,v 1.5 2004/12/24 21:22:00 pvalchev Exp $ */
/* $NetBSD: apicvec.s,v 1.1.2.2 2000/02/21 21:54:01 sommerfeld Exp $ */
/*-
@@ -191,7 +191,7 @@ _C_LABEL(Xintr_/**/name/**/num): \
testl %ebx,%ebx ;\
jz 8f /* oops, no handlers.. */ ;\
7: \
- LOCK_KERNEL ;\
+ LOCK_KERNEL(IF_PPL(%esp)) ;\
movl IH_ARG(%ebx),%eax /* get handler arg */ ;\
testl %eax,%eax ;\
jnz 6f ;\
@@ -205,7 +205,7 @@ _C_LABEL(Xintr_/**/name/**/num): \
addl $1,IH_COUNT(%ebx) /* count the intrs */ ;\
adcl $0,IH_COUNT+4(%ebx) ;\
4: \
- UNLOCK_KERNEL ;\
+ UNLOCK_KERNEL(IF_PPL(%esp)) ;\
movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\
testl %ebx,%ebx ;\
jnz 7b ;\
diff --git a/sys/arch/i386/i386/genassym.cf b/sys/arch/i386/i386/genassym.cf
index 968ef80b33a..13147e84556 100644
--- a/sys/arch/i386/i386/genassym.cf
+++ b/sys/arch/i386/i386/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.18 2004/07/20 20:16:44 art Exp $
+# $OpenBSD: genassym.cf,v 1.19 2004/12/24 21:22:00 pvalchev Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -120,6 +120,10 @@ member tf_eax
member tf_esp
define FRAMESIZE sizeof(struct trapframe)
+# interrupt frame definitions
+struct intrframe
+member if_ppl
+
# signal handling
struct sigframe SIGF_
member HANDLER sf_handler
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 3c03ad15206..d0be5f08f6c 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.313 2004/12/06 23:40:44 hshoexer Exp $ */
+/* $OpenBSD: machdep.c,v 1.314 2004/12/24 21:22:00 pvalchev Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -4119,9 +4119,9 @@ splassert_check(int wantipl, const char *func)
#ifdef MULTIPROCESSOR
void
-i386_intlock(struct intrframe iframe)
+i386_intlock(int ipl)
{
- if (iframe.if_ppl < IPL_SCHED)
+ if (ipl < IPL_SCHED)
#ifdef notdef
spinlockmgr(&kernel_lock, LK_EXCLUSIVE|LK_CANRECURSE, 0);
#else
@@ -4130,9 +4130,9 @@ i386_intlock(struct intrframe iframe)
}
void
-i386_intunlock(struct intrframe iframe)
+i386_intunlock(int ipl)
{
- if (iframe.if_ppl < IPL_SCHED)
+ if (ipl < IPL_SCHED)
#ifdef notdef
spinlockmgr(&kernel_lock, LK_RELEASE, 0);
#else
diff --git a/sys/arch/i386/i386/vector.s b/sys/arch/i386/i386/vector.s
index 0c46cea7fd4..828dbd9df70 100644
--- a/sys/arch/i386/i386/vector.s
+++ b/sys/arch/i386/i386/vector.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: vector.s,v 1.4 2004/06/28 02:00:20 deraadt Exp $ */
+/* $OpenBSD: vector.s,v 1.5 2004/12/24 21:22:00 pvalchev Exp $ */
/* $NetBSD: vector.s,v 1.32 1996/01/07 21:29:47 mycroft Exp $ */
/*
@@ -60,11 +60,11 @@
.globl _C_LABEL(isa_strayintr)
#ifdef MULTIPROCESSOR
-#define LOCK_KERNEL call _C_LABEL(i386_intlock)
-#define UNLOCK_KERNEL call _C_LABEL(i386_intunlock)
+#define LOCK_KERNEL(ipl) pushl ipl; call _C_LABEL(i386_intlock); addl $4,%esp
+#define UNLOCK_KERNEL(ipl) pushl ipl; call _C_LABEL(i386_intunlock); addl $4,%esp
#else
-#define LOCK_KERNEL
-#define UNLOCK_KERNEL
+#define LOCK_KERNEL(ipl)
+#define UNLOCK_KERNEL(ipl)
#endif
#define voidop(num)
@@ -113,7 +113,7 @@ Xresume_/**/name/**/num/**/: ;\
testl %ebx,%ebx ;\
jz _C_LABEL(Xstray_/**/name/**/num) /* no handlers; we're stray */ ;\
STRAY_INITIALIZE /* nobody claimed it yet */ ;\
- LOCK_KERNEL ;\
+ LOCK_KERNEL(IF_PPL(%esp)) ;\
7: movl IH_ARG(%ebx),%eax /* get handler arg */ ;\
testl %eax,%eax ;\
jnz 4f ;\
@@ -129,7 +129,7 @@ Xresume_/**/name/**/num/**/: ;\
5: movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\
testl %ebx,%ebx ;\
jnz 7b ;\
- UNLOCK_KERNEL ;\
+ UNLOCK_KERNEL(IF_PPL(%esp)) ;\
STRAY_TEST /* see if it's a stray */ ;\
6: unmask(num) /* unmask it in hardware */ ;\
late_ack(num) ;\
diff --git a/sys/arch/i386/include/intr.h b/sys/arch/i386/include/intr.h
index 1169873a9f6..a7606ca005b 100644
--- a/sys/arch/i386/include/intr.h
+++ b/sys/arch/i386/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.22 2004/06/16 18:27:26 grange Exp $ */
+/* $OpenBSD: intr.h,v 1.23 2004/12/24 21:22:01 pvalchev Exp $ */
/* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */
/*
@@ -142,8 +142,8 @@ int i386_send_ipi(struct cpu_info *, int);
void i386_broadcast_ipi(int);
void i386_multicast_ipi(int, int);
void i386_ipi_handler(void);
-void i386_intlock(struct intrframe);
-void i386_intunlock(struct intrframe);
+void i386_intlock(int);
+void i386_intunlock(int);
void i386_softintlock(void);
void i386_softintunlock(void);