]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/thread_act.c
xnu-6153.11.26.tar.gz
[apple/xnu.git] / osfmk / kern / thread_act.c
index c93dda8e30ddad37935ad1d6390f52e418ac5fe8..944d61d991f1993014d7d898d2ea83e96c3672ff 100644 (file)
@@ -1132,12 +1132,32 @@ act_set_astbsd(
 void
 act_set_astkevent(thread_t thread, uint16_t bits)
 {
-       atomic_fetch_or(&thread->kevent_ast_bits, bits);
+       os_atomic_or(&thread->kevent_ast_bits, bits, relaxed);
 
        /* kevent AST shouldn't send immediate IPIs */
        act_set_ast_async(thread, AST_KEVENT);
 }
 
+uint16_t
+act_clear_astkevent(thread_t thread, uint16_t bits)
+{
+       /*
+        * avoid the atomic operation if none of the bits is set,
+        * which will be the common case.
+        */
+       uint16_t cur = os_atomic_load(&thread->kevent_ast_bits, relaxed);
+       if (cur & bits) {
+               cur = os_atomic_andnot_orig(&thread->kevent_ast_bits, bits, relaxed);
+       }
+       return cur & bits;
+}
+
+void
+act_set_ast_reset_pcs(thread_t thread)
+{
+       act_set_ast(thread, AST_RESET_PCS);
+}
+
 void
 act_set_kperf(
        thread_t        thread)