]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/dev/arm/fasttrap_isa.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / bsd / dev / arm / fasttrap_isa.c
index c45a952882baa38a2fa6d0db1785f27a3a9c63f6..ea44261515d06c2e218d8d2acfe395df1428efa7 100644 (file)
  * Use is subject to license terms.
  */
 
-/*
- * #pragma ident       "@(#)fasttrap_isa.c     1.19    05/09/14 SMI"
- */
-
-#ifdef KERNEL
-#ifndef _KERNEL
-#define _KERNEL                 /* Solaris vs. Darwin */
-#endif
-#endif
-
 #include <sys/fasttrap_isa.h>
 #include <sys/fasttrap_impl.h>
 #include <sys/dtrace.h>
@@ -293,8 +283,8 @@ fasttrap_return_common(proc_t *p, arm_saved_state_t *regs, user_addr_t pc, user_
                }
 
                if (probe->ftp_prov->ftp_provider_type == DTFTP_PROVIDER_ONESHOT) {
-                       uint8_t already_triggered = atomic_or_8(&probe->ftp_triggered, 1);
-                       if (already_triggered) {
+                       if (os_atomic_xchg(&probe->ftp_triggered, 1, relaxed)) {
+                               /* already triggered */
                                continue;
                        }
                }
@@ -306,13 +296,13 @@ fasttrap_return_common(proc_t *p, arm_saved_state_t *regs, user_addr_t pc, user_
                else {
                        retire_tp = 0;
                }
-#ifndef CONFIG_EMBEDDED
+#if defined(XNU_TARGET_OS_OSX)
                if (ISSET(current_proc()->p_lflag, P_LNOATTACH)) {
                        dtrace_probe(dtrace_probeid_error, 0 /* state */, id->fti_probe->ftp_id,
                            1 /* ndx */, -1 /* offset */, DTRACEFLT_UPRIV);
 #else
                if (FALSE) {
-#endif
+#endif /* defined(XNU_TARGET_OS_OSX) */
                } else {
                        dtrace_probe(id->fti_probe->ftp_id,
                            pc - id->fti_probe->ftp_faddr,
@@ -326,6 +316,9 @@ fasttrap_return_common(proc_t *p, arm_saved_state_t *regs, user_addr_t pc, user_
        lck_mtx_unlock(pid_mtx);
 }
 
+#if DEBUG
+__dead2
+#endif
 static void
 fasttrap_sigsegv(proc_t *p, uthread_t t, user_addr_t addr, arm_saved_state_t *regs)
 {
@@ -513,17 +506,17 @@ fasttrap_pid_probe(arm_saved_state_t *regs)
                for (id = tp->ftt_ids; id != NULL; id = id->fti_next) {
                        fasttrap_probe_t *probe = id->fti_probe;
 
-#ifndef CONFIG_EMBEDDED
+#if defined(XNU_TARGET_OS_OSX)
                        if (ISSET(current_proc()->p_lflag, P_LNOATTACH)) {
                                dtrace_probe(dtrace_probeid_error, 0 /* state */, probe->ftp_id,
                                    1 /* ndx */, -1 /* offset */, DTRACEFLT_UPRIV);
 #else
                        if (FALSE) {
-#endif
+#endif /* defined(XNU_TARGET_OS_OSX) */
                        } else {
                                if (probe->ftp_prov->ftp_provider_type == DTFTP_PROVIDER_ONESHOT) {
-                                       uint8_t already_triggered = atomic_or_8(&probe->ftp_triggered, 1);
-                                       if (already_triggered) {
+                                       if (os_atomic_xchg(&probe->ftp_triggered, 1, relaxed)) {
+                                               /* already triggered */
                                                continue;
                                        }
                                }