typedef struct cyc_list {
cyc_omni_handler_t cyl_omni;
wrap_timer_call_t cyl_wrap_by_cpus[];
+#if __arm__ && (__BIGGEST_ALIGNMENT__ > 4)
+} __attribute__ ((aligned (8))) cyc_list_t;
+#else
} cyc_list_t;
+#endif
/* CPU going online/offline notifications */
void (*dtrace_cpu_state_changed_hook)(int, boolean_t) = NULL;
}
}
-/*
- * timeout / untimeout (converted to dtrace_timeout / dtrace_untimeout due to name collision)
- */
-
-thread_call_t
-dtrace_timeout(void (*func)(void *, void *), void* arg, uint64_t nanos)
-{
-#pragma unused(arg)
- thread_call_t call = thread_call_allocate(func, NULL);
-
- nanoseconds_to_absolutetime(nanos, &nanos);
-
- /*
- * This method does not use clock_deadline_for_periodic_event() because it is a one-shot,
- * and clock drift on later invocations is not a worry.
- */
- uint64_t deadline = mach_absolute_time() + nanos;
- /* DRK: consider using a lower priority callout here */
- thread_call_enter_delayed(call, deadline);
-
- return call;
-}
-
/*
* ddi
*/
}
}
+extern const int copysize_limit_panic;
+
+int
+dtrace_buffer_copyout(const void *kaddr, user_addr_t uaddr, vm_size_t nbytes)
+{
+ /*
+ * Partition the copyout in copysize_limit_panic-sized chunks
+ */
+ while (nbytes >= (vm_size_t)copysize_limit_panic) {
+ if (copyout(kaddr, uaddr, copysize_limit_panic) != 0)
+ return (EFAULT);
+
+ nbytes -= copysize_limit_panic;
+ uaddr += copysize_limit_panic;
+ kaddr += copysize_limit_panic;
+ }
+ if (nbytes > 0) {
+ if (copyout(kaddr, uaddr, nbytes) != 0)
+ return (EFAULT);
+ }
+
+ return (0);
+}
+
uint8_t
dtrace_fuword8(user_addr_t uaddr)
{
{
char c;
size_t len;
+ if (!in || !str)
+ return in;
c = *str++;
if (!c)
return (const char *) (in - 1);
}
+const void*
+bsearch(const void *key, const void *base0, size_t nmemb, size_t size, int (*compar)(const void *, const void *))
+{
+ const char *base = base0;
+ size_t lim;
+ int cmp;
+ const void *p;
+ for (lim = nmemb; lim != 0; lim >>= 1) {
+ p = base + (lim >> 1) * size;
+ cmp = (*compar)(key, p);
+ if (cmp == 0)
+ return p;
+ if (cmp > 0) { /* key > p: move right */
+ base = (const char *)p + size;
+ lim--;
+ } /* else move left */
+ }
+ return (NULL);
+}
+
/*
* Runtime and ABI
*/