summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mooney <pmooney@pfmooney.com>2018-03-27 21:30:33 +0000
committerPatrick Mooney <pmooney@pfmooney.com>2018-04-02 20:38:18 +0000
commit89f28c29187081c8db00a633d949df9b5f2a403d (patch)
tree529f93245e47f99101b94578f991a49e38cec5d9
parentca73f140cd7d1061c0f3af071ab0a8dfa2bee3ad (diff)
downloadillumos-joyent-89f28c29187081c8db00a633d949df9b5f2a403d.tar.gz
OS-6851 some bhyve atomics shims are too heavy-handed
Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Mike Gerdts <mike.gerdts@joyent.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r--usr/src/compat/freebsd/amd64/machine/atomic.h49
1 files changed, 5 insertions, 44 deletions
diff --git a/usr/src/compat/freebsd/amd64/machine/atomic.h b/usr/src/compat/freebsd/amd64/machine/atomic.h
index 47a26bd2d3..0b5998880e 100644
--- a/usr/src/compat/freebsd/amd64/machine/atomic.h
+++ b/usr/src/compat/freebsd/amd64/machine/atomic.h
@@ -17,38 +17,14 @@
#ifndef _COMPAT_FREEBSD_AMD64_MACHINE_ATOMIC_H_
#define _COMPAT_FREEBSD_AMD64_MACHINE_ATOMIC_H_
-static __inline u_char
-atomic_load_acq_char(volatile u_char *p)
-{
- u_char res;
-
- __asm volatile("lock ; " "cmpxchgb %b0,%1"
- : "=a" (res), "=m" (*p)
- : "m" (*p) : "memory", "cc");
- return (res);
-}
-
-static __inline u_short
-atomic_load_acq_short(volatile u_short *p)
-{
- u_short res;
-
- __asm volatile("lock ; " "cmpxchgw %w0,%1"
- : "=a" (res), "=m" (*p)
- : "m" (*p)
- : "memory", "cc");
- return (res);
-}
-
static __inline u_int
atomic_load_acq_int(volatile u_int *p)
{
u_int res;
- __asm volatile("lock ; " "cmpxchgl %0,%1"
- : "=a" (res), "=m" (*p)
- : "m" (*p)
- : "memory", "cc");
+ res = *p;
+ __asm volatile("" : : : "memory");
+
return (res);
}
@@ -57,25 +33,10 @@ atomic_load_acq_long(volatile u_long *p)
{
u_long res;
- __asm volatile("lock ; " "cmpxchgq %0,%1"
- : "=a" (res), "=m" (*p)
- : "m" (*p)
- : "memory", "cc");
- return (res);
-}
-
-static __inline void
-atomic_store_rel_char(volatile u_char *p, u_char v)
-{
+ res = *p;
__asm volatile("" : : : "memory");
- *p = v;
-}
-static __inline void
-atomic_store_rel_short(volatile u_short *p, u_short v)
-{
- __asm volatile("" : : : "memory");
- *p = v;
+ return (res);
}
static __inline void