summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2017-08-08 15:53:55 +0000
committervisa <visa@openbsd.org>2017-08-08 15:53:55 +0000
commit13ffdfaa2be256b8f757755dcdee9ec2367792da (patch)
tree611bac7a820fdc8c9aa62ead227b2ee62a3ab89f
parentKernel sendsyslog(2), libc syslog(3), and syslogd(8) restrict and (diff)
downloadwireguard-openbsd-13ffdfaa2be256b8f757755dcdee9ec2367792da.tar.xz
wireguard-openbsd-13ffdfaa2be256b8f757755dcdee9ec2367792da.zip
Get rid of read_psl() and write_psl() by replacing
read_psl() + disable_intr() with intr_disable(), and write_psl() with intr_restore(). OK kettenis@
-rw-r--r--sys/arch/amd64/amd64/intr.c9
-rw-r--r--sys/arch/amd64/amd64/ioapic.c7
-rw-r--r--sys/arch/amd64/include/cpufunc.h5
-rw-r--r--sys/arch/i386/i386/ioapic.c7
-rw-r--r--sys/arch/i386/include/cpufunc.h5
5 files changed, 12 insertions, 21 deletions
diff --git a/sys/arch/amd64/amd64/intr.c b/sys/arch/amd64/amd64/intr.c
index 15698844914..622a07fbde8 100644
--- a/sys/arch/amd64/amd64/intr.c
+++ b/sys/arch/amd64/amd64/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.48 2016/06/22 01:12:38 mikeb Exp $ */
+/* $OpenBSD: intr.c,v 1.49 2017/08/08 15:53:55 visa Exp $ */
/* $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $ */
/*
@@ -712,19 +712,18 @@ spllower(int nlevel)
int olevel;
struct cpu_info *ci = curcpu();
u_int64_t imask;
- u_long psl;
+ u_long flags;
imask = IUNMASK(ci, nlevel);
olevel = ci->ci_ilevel;
- psl = read_psl();
- disable_intr();
+ flags = intr_disable();
if (ci->ci_ipending & imask) {
Xspllower(nlevel);
} else {
ci->ci_ilevel = nlevel;
- write_psl(psl);
+ intr_restore(flags);
}
return (olevel);
}
diff --git a/sys/arch/amd64/amd64/ioapic.c b/sys/arch/amd64/amd64/ioapic.c
index 85df17f0c35..e8f5e6aa77e 100644
--- a/sys/arch/amd64/amd64/ioapic.c
+++ b/sys/arch/amd64/amd64/ioapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioapic.c,v 1.25 2016/06/29 06:05:15 mlarkin Exp $ */
+/* $OpenBSD: ioapic.c,v 1.26 2017/08/08 15:53:55 visa Exp $ */
/* $NetBSD: ioapic.c,v 1.6 2003/05/15 13:30:31 fvdl Exp $ */
/*-
@@ -114,8 +114,7 @@ ioapic_lock(struct ioapic_softc *sc)
{
u_long flags;
- flags = read_psl();
- disable_intr();
+ flags = intr_disable();
#ifdef MULTIPROCESSOR
mtx_enter(&sc->sc_pic.pic_mutex);
#endif
@@ -128,7 +127,7 @@ ioapic_unlock(struct ioapic_softc *sc, u_long flags)
#ifdef MULTIPROCESSOR
mtx_leave(&sc->sc_pic.pic_mutex);
#endif
- write_psl(flags);
+ intr_restore(flags);
}
/*
diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h
index 14131ad0732..cb569d4afc2 100644
--- a/sys/arch/amd64/include/cpufunc.h
+++ b/sys/arch/amd64/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.19 2017/05/30 15:11:32 deraadt Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.20 2017/08/08 15:53:55 visa Exp $ */
/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
/*-
@@ -313,9 +313,6 @@ breakpoint(void)
__asm volatile("int $3");
}
-#define read_psl() read_rflags()
-#define write_psl(x) write_rflags(x)
-
void amd64_errata(struct cpu_info *);
#endif /* _KERNEL */
diff --git a/sys/arch/i386/i386/ioapic.c b/sys/arch/i386/i386/ioapic.c
index ff88a16820f..f6de0573efc 100644
--- a/sys/arch/i386/i386/ioapic.c
+++ b/sys/arch/i386/i386/ioapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioapic.c,v 1.38 2016/05/07 14:19:50 kettenis Exp $ */
+/* $OpenBSD: ioapic.c,v 1.39 2017/08/08 15:53:55 visa Exp $ */
/* $NetBSD: ioapic.c,v 1.7 2003/07/14 22:32:40 lukem Exp $ */
/*-
@@ -120,8 +120,7 @@ ioapic_lock(struct ioapic_softc *sc)
{
u_long flags;
- flags = read_psl();
- disable_intr();
+ flags = intr_disable();
#ifdef MULTIPROCESSOR
mtx_enter(&sc->sc_pic.pic_mutex);
#endif
@@ -134,7 +133,7 @@ ioapic_unlock(struct ioapic_softc *sc, u_long flags)
#ifdef MULTIPROCESSOR
mtx_leave(&sc->sc_pic.pic_mutex);
#endif
- write_psl(flags);
+ intr_restore(flags);
}
/*
diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h
index fb745da8edb..3677ebec01c 100644
--- a/sys/arch/i386/include/cpufunc.h
+++ b/sys/arch/i386/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.26 2017/06/17 09:32:26 jmatthew Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.27 2017/08/08 15:53:55 visa Exp $ */
/* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */
/*
@@ -287,9 +287,6 @@ breakpoint(void)
__asm volatile("int $3");
}
-#define read_psl() read_eflags()
-#define write_psl(x) write_eflags(x)
-
void amd64_errata(struct cpu_info *);
#endif /* _KERNEL */