summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-06-17 12:50:22 +0000
committerbde <bde@FreeBSD.org>1996-06-17 12:50:22 +0000
commitab552bbee7d360284da684e84cef05f4e5f242a7 (patch)
tree5896a9d86f514fcad8744e68e87f7c0751ba84e6
parent501044728620e5a296b82f0ab2bae44a27b2d661 (diff)
downloadFreeBSD-src-ab552bbee7d360284da684e84cef05f4e5f242a7.zip
FreeBSD-src-ab552bbee7d360284da684e84cef05f4e5f242a7.tar.gz
In getit(), use read_eflags()/write_eflags() to preserve the interrupt
enable flag instead of enable_intr() to restore it to its usual state. getit() is only called from DELAY() so there is no point in optimising its speed (this wasn't so clear when it was extern), and using enable_intr() made it inconvenient to call DELAY() from probes that need to run with interrupts disabled.
-rw-r--r--sys/amd64/amd64/tsc.c11
-rw-r--r--sys/amd64/isa/clock.c11
-rw-r--r--sys/i386/i386/tsc.c11
-rw-r--r--sys/i386/isa/clock.c11
-rw-r--r--sys/isa/atrtc.c11
5 files changed, 40 insertions, 15 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c
index 21b9e36..1b1c2d8 100644
--- a/sys/amd64/amd64/tsc.c
+++ b/sys/amd64/amd64/tsc.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.59 1996/06/11 16:02:55 pst Exp $
+ * $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
*/
/*
@@ -286,14 +286,19 @@ DDB_printrtc(void)
static int
getit(void)
{
+ u_long ef;
int high, low;
+ ef = read_eflags();
disable_intr();
- /* select timer0 and latch counter value */
+
+ /* Select timer0 and latch counter value. */
outb(TIMER_MODE, TIMER_SEL0);
+
low = inb(TIMER_CNTR0);
high = inb(TIMER_CNTR0);
- enable_intr();
+
+ write_eflags(ef);
return ((high << 8) | low);
}
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 21b9e36..1b1c2d8 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.59 1996/06/11 16:02:55 pst Exp $
+ * $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
*/
/*
@@ -286,14 +286,19 @@ DDB_printrtc(void)
static int
getit(void)
{
+ u_long ef;
int high, low;
+ ef = read_eflags();
disable_intr();
- /* select timer0 and latch counter value */
+
+ /* Select timer0 and latch counter value. */
outb(TIMER_MODE, TIMER_SEL0);
+
low = inb(TIMER_CNTR0);
high = inb(TIMER_CNTR0);
- enable_intr();
+
+ write_eflags(ef);
return ((high << 8) | low);
}
diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c
index 21b9e36..1b1c2d8 100644
--- a/sys/i386/i386/tsc.c
+++ b/sys/i386/i386/tsc.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.59 1996/06/11 16:02:55 pst Exp $
+ * $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
*/
/*
@@ -286,14 +286,19 @@ DDB_printrtc(void)
static int
getit(void)
{
+ u_long ef;
int high, low;
+ ef = read_eflags();
disable_intr();
- /* select timer0 and latch counter value */
+
+ /* Select timer0 and latch counter value. */
outb(TIMER_MODE, TIMER_SEL0);
+
low = inb(TIMER_CNTR0);
high = inb(TIMER_CNTR0);
- enable_intr();
+
+ write_eflags(ef);
return ((high << 8) | low);
}
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 21b9e36..1b1c2d8 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.59 1996/06/11 16:02:55 pst Exp $
+ * $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
*/
/*
@@ -286,14 +286,19 @@ DDB_printrtc(void)
static int
getit(void)
{
+ u_long ef;
int high, low;
+ ef = read_eflags();
disable_intr();
- /* select timer0 and latch counter value */
+
+ /* Select timer0 and latch counter value. */
outb(TIMER_MODE, TIMER_SEL0);
+
low = inb(TIMER_CNTR0);
high = inb(TIMER_CNTR0);
- enable_intr();
+
+ write_eflags(ef);
return ((high << 8) | low);
}
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index 21b9e36..1b1c2d8 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $Id: clock.c,v 1.59 1996/06/11 16:02:55 pst Exp $
+ * $Id: clock.c,v 1.60 1996/06/11 16:11:27 pst Exp $
*/
/*
@@ -286,14 +286,19 @@ DDB_printrtc(void)
static int
getit(void)
{
+ u_long ef;
int high, low;
+ ef = read_eflags();
disable_intr();
- /* select timer0 and latch counter value */
+
+ /* Select timer0 and latch counter value. */
outb(TIMER_MODE, TIMER_SEL0);
+
low = inb(TIMER_CNTR0);
high = inb(TIMER_CNTR0);
- enable_intr();
+
+ write_eflags(ef);
return ((high << 8) | low);
}
OpenPOWER on IntegriCloud