Make INCR() atomic.
This commit is contained in:
parent
ab88a97d88
commit
fe278fa440
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.s,v 1.108 2000/12/29 18:32:47 eeh Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.109 2000/12/31 21:05:21 eeh Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1996-2000 Eduardo Horvath
|
||||
* Copyright (c) 1996 Paul Kranenburg
|
||||
|
@ -243,7 +243,7 @@
|
|||
|
||||
/*
|
||||
* A handy macro for maintaining instrumentation counters.
|
||||
* Note that this clobbers %o0 and %o1. Normal usage is
|
||||
* Note that this clobbers %o0, %o1 and %o2. Normal usage is
|
||||
* something like:
|
||||
* foointr:
|
||||
* TRAP_SETUP(...) ! makes %o registers safe
|
||||
|
@ -251,9 +251,14 @@
|
|||
*/
|
||||
#define INCR(what) \
|
||||
sethi %hi(what), %o0; \
|
||||
ldsw [%o0 + %lo(what)], %o1; \
|
||||
inc %o1; \
|
||||
stw %o1, [%o0 + %lo(what)]
|
||||
or %o0, %lo(what), %o0; \
|
||||
99: \
|
||||
lduw [%o0], %o1; \
|
||||
add %o1, 1, %o2; \
|
||||
casa [%o0] ASI_P, %o1, %o2; \
|
||||
cmp %o1, %o2; \
|
||||
bne,pn %icc, 99b; \
|
||||
nop
|
||||
|
||||
/*
|
||||
* A couple of handy macros to save and restore globals to/from
|
||||
|
@ -3077,7 +3082,7 @@ datafault:
|
|||
|
||||
TRAP_SETUP(-CC64FSZ-TF_SIZE)
|
||||
Ldatafault_internal:
|
||||
INCR(_C_LABEL(uvmexp)+V_FAULTS) ! cnt.v_faults++ (clobbers %o0,%o1) should not fault
|
||||
INCR(_C_LABEL(uvmexp)+V_FAULTS) ! cnt.v_faults++ (clobbers %o0,%o1,%o2) should not fault
|
||||
! ldx [%sp + CC64FSZ + STKB + TF_FAULT], %g1 ! DEBUG make sure this has not changed
|
||||
mov %g1, %o5 ! Move these to the out regs so we can save the globals
|
||||
mov %g2, %o1
|
||||
|
@ -3356,7 +3361,7 @@ textfault:
|
|||
membar #Sync ! No real reason for this XXXX
|
||||
|
||||
TRAP_SETUP(-CC64FSZ-TF_SIZE)
|
||||
INCR(_C_LABEL(uvmexp)+V_FAULTS) ! cnt.v_faults++ (clobbers %o0,%o1)
|
||||
INCR(_C_LABEL(uvmexp)+V_FAULTS) ! cnt.v_faults++ (clobbers %o0,%o1,%o2)
|
||||
|
||||
mov %g3, %o2
|
||||
|
||||
|
@ -4295,7 +4300,7 @@ _C_LABEL(sparc_interrupt):
|
|||
|
||||
flushw ! Do not remove this insn -- causes interrupt loss
|
||||
rd %y, %l6
|
||||
INCR(_C_LABEL(uvmexp)+V_INTR) ! cnt.v_intr++; (clobbers %o0,%o1)
|
||||
INCR(_C_LABEL(uvmexp)+V_INTR) ! cnt.v_intr++; (clobbers %o0,%o1,%o2)
|
||||
rdpr %tt, %l5 ! Find out our current IPL
|
||||
rdpr %tstate, %l0
|
||||
rdpr %tpc, %l1
|
||||
|
@ -7677,8 +7682,8 @@ ENTRY(switchexit)
|
|||
|
||||
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
|
||||
call _C_LABEL(sched_lock_idle) ! Acquire sched_lock
|
||||
nop
|
||||
#endif
|
||||
wrpr %g0, PIL_SCHED, %pil ! Set splsched()
|
||||
|
||||
/*
|
||||
* Now fall through to `the last switch'. %g6 was set to
|
||||
|
@ -7771,7 +7776,7 @@ idle:
|
|||
ba,a,pt %xcc, 1b
|
||||
nop ! spitfire bug
|
||||
notidle:
|
||||
wrpr %g0, PIL_HIGH, %pil ! (void) splhigh();
|
||||
wrpr %g0, PIL_SCHED, %pil ! (void) splhigh();
|
||||
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
|
||||
call _C_LABEL(sched_lock_idle) ! Grab sched_lock
|
||||
add %o7, (Lsw_scan-.-4), %o7 ! Return to Lsw_scan directly
|
||||
|
@ -8026,7 +8031,7 @@ Lsw_scan:
|
|||
brz,pn %l4, Lsw_load ! if no old process, go load
|
||||
wrpr %g0, PSTATE_KERN, %pstate
|
||||
|
||||
INCR(_C_LABEL(nswitchdiff)) ! clobbers %o0,%o1
|
||||
INCR(_C_LABEL(nswitchdiff)) ! clobbers %o0,%o1,%o2
|
||||
wb1:
|
||||
flushw ! save all register windows except this one
|
||||
stx %i7, [%l5 + PCB_PC] ! Save rpc
|
||||
|
@ -8860,7 +8865,7 @@ ENTRY(pmap_zero_page)
|
|||
#endif
|
||||
|
||||
rdpr %pil, %g1
|
||||
wrpr %g0, 15, %pil ! s = splhigh()
|
||||
wrpr %g0, PIL_HIGH, %pil ! s = splhigh()
|
||||
|
||||
fzero %f0 ! Set up FPU
|
||||
fzero %f2
|
||||
|
|
Loading…
Reference in New Issue