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.
This commit is contained in:
Bruce Evans 1996-06-17 12:50:22 +00:00
parent b7911dc3bb
commit 16263f7a8b
5 changed files with 40 additions and 15 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}