diff options
author | fsmp <fsmp@FreeBSD.org> | 1997-08-04 19:14:56 +0000 |
---|---|---|
committer | fsmp <fsmp@FreeBSD.org> | 1997-08-04 19:14:56 +0000 |
commit | 97e0e6be57ff63ad387669f799c3555eebcffb68 (patch) | |
tree | e19b1a131c8b8f41608601e5b3307662a78b760c | |
parent | 315ebe1a90da7e179087984d982913bcf7c2324c (diff) | |
download | FreeBSD-src-97e0e6be57ff63ad387669f799c3555eebcffb68.zip FreeBSD-src-97e0e6be57ff63ad387669f799c3555eebcffb68.tar.gz |
pushed down "volatility" of simplelock to actual int inside the struct.
Submitted by: bde@zeta.org.a
-rw-r--r-- | sys/i386/i386/simplelock.s | 16 | ||||
-rw-r--r-- | sys/i386/include/param.h | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/sys/i386/i386/simplelock.s b/sys/i386/i386/simplelock.s index 9d5226d..139aeb3 100644 --- a/sys/i386/i386/simplelock.s +++ b/sys/i386/i386/simplelock.s @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: simplelock.s,v 1.1 1997/07/24 23:51:33 fsmp Exp $ */ /* @@ -35,6 +35,8 @@ /* * The following impliments the primitives described in i386/i386/param.h * necessary for the Lite2 lock manager system. + * The major difference is that the "volatility" of the lock datum has been + * pushed down from the various functions to lock_data itself. */ /* @@ -46,7 +48,7 @@ * only be used for exclusive locks. * * struct simplelock { - * int lock_data; + * volatile int lock_data; * }; */ @@ -65,7 +67,7 @@ ENTRY(s_lock_init) /* * void - * s_lock(__volatile struct simplelock *lkp) + * s_lock(struct simplelock *lkp) * { * while (test_and_set(&lkp->lock_data)) * continue; @@ -73,7 +75,7 @@ ENTRY(s_lock_init) * * Note: * If the acquire fails we do a loop of reads waiting for the lock to - * become free instead of continually beating on the lock with btsl. + * become free instead of continually beating on the lock with xchgl. * The theory here is that the CPU will stay within its cache until * a write by the other CPU updates it, instead of continually updating * the local cache (and thus causing external bus writes) with repeated @@ -96,7 +98,7 @@ gotit: /* * int - * s_lock_try(__volatile struct simplelock *lkp) + * s_lock_try(struct simplelock *lkp) * { * return (!test_and_set(&lkp->lock_data)); * } @@ -115,7 +117,7 @@ ENTRY(s_lock_try) /* * void - * s_unlock(__volatile struct simplelock *lkp) + * s_unlock(struct simplelock *lkp) * { * lkp->lock_data = 0; * } @@ -129,7 +131,7 @@ ENTRY(s_unlock) #ifdef needed /* - * test_and_set(struct simplelock *lkp); + * int test_and_set(struct simplelock *lkp); */ ENTRY(test_and_set) movl 4(%esp), %eax /* get the address of the lock */ diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index a5892c0..bb3a700 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $Id: param.h,v 1.4 1997/07/24 03:06:19 smp Exp smp $ + * $Id: param.h,v 1.30 1997/07/24 23:48:51 fsmp Exp $ */ #ifndef _MACHINE_PARAM_H_ @@ -140,7 +140,7 @@ * of these locks while a process is sleeping. */ struct simplelock { - int lock_data __attribute__ ((aligned (4))); + volatile int lock_data; }; #if !defined(SIMPLELOCK_DEBUG) && NCPUS > 1 @@ -163,7 +163,7 @@ simple_lock_init(struct simplelock *lkp) } static __inline void -simple_lock(__volatile struct simplelock *lkp) +simple_lock(struct simplelock *lkp) { while (test_and_set(&lkp->lock_data)) @@ -171,14 +171,14 @@ simple_lock(__volatile struct simplelock *lkp) } static __inline int -simple_lock_try(__volatile struct simplelock *lkp) +simple_lock_try(struct simplelock *lkp) { return (!test_and_set(&lkp->lock_data)); } static __inline void -simple_unlock(__volatile struct simplelock *lkp) +simple_unlock(struct simplelock *lkp) { lkp->lock_data = 0; |