Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/x86/include/lock.h,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/x86/include/lock.h,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.11 retrieving revision 1.11.20.2 diff -u -p -r1.11 -r1.11.20.2 --- src/sys/arch/x86/include/lock.h 2005/12/28 19:09:30 1.11 +++ src/sys/arch/x86/include/lock.h 2006/12/29 20:27:42 1.11.20.2 @@ -1,11 +1,11 @@ -/* $NetBSD: lock.h,v 1.11 2005/12/28 19:09:30 perry Exp $ */ +/* $NetBSD: lock.h,v 1.11.20.2 2006/12/29 20:27:42 ad Exp $ */ /*- - * Copyright (c) 2000 The NetBSD Foundation, Inc. + * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. + * by Jason R. Thorpe and Andrew Doran. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -81,7 +81,7 @@ static __inline void __cpu_simple_lock(__cpu_simple_lock_t *lockp) { - while (x86_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED) + while (x86_atomic_testset_b(lockp, __SIMPLELOCK_LOCKED) != __SIMPLELOCK_UNLOCKED) { do { x86_pause(); @@ -93,7 +93,7 @@ __cpu_simple_lock(__cpu_simple_lock_t *l static __inline int __cpu_simple_lock_try(__cpu_simple_lock_t *lockp) { - int r = (x86_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED) + int r = (x86_atomic_testset_b(lockp, __SIMPLELOCK_LOCKED) == __SIMPLELOCK_UNLOCKED); __insn_barrier(); @@ -112,7 +112,26 @@ __cpu_simple_unlock(__cpu_simple_lock_t #endif /* !LOCKDEBUG */ #ifdef _KERNEL -#define SPINLOCK_SPIN_HOOK x86_pause() +#define SPINLOCK_SPIN_HOOK /* nothing */ +#define SPINLOCK_BACKOFF_HOOK x86_pause() #endif +static inline void +mb_read(void) +{ + x86_lfence(); +} + +static inline void +mb_write(void) +{ + __insn_barrier(); +} + +static inline void +mb_memory(void) +{ + x86_lfence(); +} + #endif /* _X86_LOCK_H_ */