diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2016-06-30 13:24:42 -0500 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2016-06-30 13:24:42 -0500 |
commit | 9d5ffb47ff56597309eb2939cc97b1df4d616797 (patch) | |
tree | b34fd92dce8092bb4cb58c875caabd93e1fece39 /sys/i386 | |
parent | 1fc6b0207cc2f3cce33817706603caa41a9de24d (diff) | |
parent | 13295f52fb5936b237a994e75311fe18612c73c4 (diff) | |
download | FreeBSD-src-9d5ffb47ff56597309eb2939cc97b1df4d616797.zip FreeBSD-src-9d5ffb47ff56597309eb2939cc97b1df4d616797.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/include/apicvar.h | 1 | ||||
-rw-r--r-- | sys/i386/include/atomic.h | 26 |
2 files changed, 26 insertions, 1 deletions
diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h index afb8639..425601e 100644 --- a/sys/i386/include/apicvar.h +++ b/sys/i386/include/apicvar.h @@ -215,7 +215,6 @@ int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, void lapic_set_tpr(u_int vector); void lapic_setup(int boot); void xen_intr_handle_upcall(struct trapframe *frame); -void hv_vector_handler(struct trapframe *frame); #endif /* !LOCORE */ #endif /* _MACHINE_APICVAR_H_ */ diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h index 0156b5b..6e71b05 100644 --- a/sys/i386/include/atomic.h +++ b/sys/i386/include/atomic.h @@ -86,6 +86,7 @@ void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); int atomic_testandset_int(volatile u_int *p, u_int v); +int atomic_testandclear_int(volatile u_int *p, u_int v); #define ATOMIC_LOAD(TYPE, LOP) \ u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) @@ -224,6 +225,23 @@ atomic_testandset_int(volatile u_int *p, u_int v) return (res); } +static __inline int +atomic_testandclear_int(volatile u_int *p, u_int v) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " btrl %2,%1 ; " + " setc %0 ; " + "# atomic_testandclear_int" + : "=q" (res), /* 0 */ + "+m" (*p) /* 1 */ + : "Ir" (v & 0x1f) /* 2 */ + : "cc"); + return (res); +} + /* * We assume that a = b will do atomic loads and stores. Due to the * IA32 memory model, a simple store guarantees release semantics. @@ -549,6 +567,13 @@ atomic_testandset_long(volatile u_long *p, u_int v) return (atomic_testandset_int((volatile u_int *)p, v)); } +static __inline int +atomic_testandclear_long(volatile u_long *p, u_int v) +{ + + return (atomic_testandclear_int((volatile u_int *)p, v)); +} + /* Read the current value and store a new value in the destination. */ #ifdef __GNUCLIKE_ASM @@ -675,6 +700,7 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_readandclear_32 atomic_readandclear_int #define atomic_fetchadd_32 atomic_fetchadd_int #define atomic_testandset_32 atomic_testandset_int +#define atomic_testandclear_32 atomic_testandclear_int /* Operations on pointers. */ #define atomic_set_ptr(p, v) \ |