Added clock_lock protection to microtime.

This commit is contained in:
Steve Passe 1997-08-30 19:02:56 +00:00
parent bf9380893a
commit c10b70dbdc
1 changed files with 21 additions and 2 deletions

View File

@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: Steve McCanne's microtime code
* $Id: microtime.s,v 1.6 1997/08/23 05:16:26 smp Exp smp $
* $Id: microtime.s,v 1.29 1997/08/24 00:05:35 fsmp Exp $
*/
#include "opt_cpu.h"
@ -44,6 +44,10 @@
#include <i386/isa/isa.h>
#include <i386/isa/timerreg.h>
#ifdef SMP
#include <machine/smptests.h> /** SIMPLE_MPINTRLOCK */
#endif
ENTRY(microtime)
#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP)
@ -58,7 +62,15 @@ ENTRY(microtime)
pushfl
cli /* disable interrupts */
#ifdef SIMPLE_MPINTRLOCK
pushl %eax /* s_lock destroys %eax, %ecx */
pushl %ecx
pushl $_clock_lock
call _s_lock
addl $4, %esp
popl %ecx
popl %eax
#endif /* SIMPLE_MPINTRLOCK */
outb %al, $TIMER_MODE /* latch timer 0's counter */
inb $TIMER_CNTR0, %al /* read counter value, LSB first */
movb %al, %cl
@ -191,6 +203,13 @@ common_microtime:
addl _time+4, %eax /* usec += time.tv_sec */
movl _time, %edx /* sec = time.tv_sec */
#ifdef SIMPLE_MPINTRLOCK
pushl %eax /* s_lock destroys %eax, %ecx */
pushl $_clock_lock
call _s_unlock
addl $4, %esp
popl %eax
#endif /* SIMPLE_MPINTRLOCK */
popfl /* restore interrupt mask */
cmpl $1000000, %eax /* usec valid? */