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
*/
#pragma unused(devi)
}
-
-static unsigned int gRegisteredProps = 0;
-static struct {
- char name[32]; /* enough for "dof-data-" + digits */
- int *data;
- uint_t nelements;
-} gPropTable[16];
-
kern_return_t _dtrace_register_anon_DOF(char *, uchar_t *, uint_t);
kern_return_t
_dtrace_register_anon_DOF(char *name, uchar_t *data, uint_t nelements)
{
- if (gRegisteredProps < sizeof(gPropTable)/sizeof(gPropTable[0])) {
- int *p = (int *)_MALLOC(nelements*sizeof(int), M_TEMP, M_WAITOK);
-
- if (NULL == p)
- return KERN_FAILURE;
-
- strlcpy(gPropTable[gRegisteredProps].name, name, sizeof(gPropTable[0].name));
- gPropTable[gRegisteredProps].nelements = nelements;
- gPropTable[gRegisteredProps].data = p;
-
- while (nelements-- > 0) {
- *p++ = (int)(*data++);
- }
-
- gRegisteredProps++;
- return KERN_SUCCESS;
- }
- else
- return KERN_FAILURE;
-}
-
-int
-ddi_prop_lookup_int_array(dev_t match_dev, dev_info_t *dip, uint_t flags,
- const char *name, int **data, uint_t *nelements)
-{
-#pragma unused(match_dev,dip,flags)
- unsigned int i;
- for (i = 0; i < gRegisteredProps; ++i)
- {
- if (0 == strncmp(name, gPropTable[i].name,
- sizeof(gPropTable[i].name))) {
- *data = gPropTable[i].data;
- *nelements = gPropTable[i].nelements;
- return DDI_SUCCESS;
- }
- }
- return DDI_FAILURE;
-}
-
-int
-ddi_prop_free(void *buf)
-{
- _FREE(buf, M_TEMP);
- return DDI_SUCCESS;
+#pragma unused(name, data, nelements)
+ return KERN_FAILURE;
}
int
}
}
+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
*/