X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/fe8ab488e9161c46dd9885d58fc52996dc0249ff..3e170ce000f1506b7b5d2c5c7faec85ceabb573d:/tools/tests/testkext/testthreadcall.cpp diff --git a/tools/tests/testkext/testthreadcall.cpp b/tools/tests/testkext/testthreadcall.cpp index c8cd7529b..2afb5c8e1 100644 --- a/tools/tests/testkext/testthreadcall.cpp +++ b/tools/tests/testkext/testthreadcall.cpp @@ -7,6 +7,7 @@ #include "testthreadcall.h" #include +#include #define super IOService OSDefineMetaClassAndStructors(testthreadcall, super); @@ -21,18 +22,29 @@ static void thread_call_test_func2(thread_call_param_t param0, } +static int my_event; + bool testthreadcall::start( IOService * provider ) { - boolean_t ret; - uint64_t deadline; - int sleepret; + boolean_t ret; + uint64_t deadline; + int sleepret; + uint32_t kernel_configuration; IOLog("%s\n", __PRETTY_FUNCTION__); if (!super::start(provider)) { return false; } + + kernel_configuration = PE_i_can_has_kernel_configuration(); + IOLog("%s: Assertions %s\n", __PRETTY_FUNCTION__, + (kernel_configuration & kPEICanHasAssertions) ? "enabled" : "disabled"); + IOLog("%s: Statistics %s\n", __PRETTY_FUNCTION__, + (kernel_configuration & kPEICanHasStatistics) ? "enabled" : "disabled"); + IOLog("%s: Diagnostic API %s\n", __PRETTY_FUNCTION__, + (kernel_configuration & kPEICanHasDiagnosticAPI) ? "enabled" : "disabled"); IOLog("Attempting thread_call_allocate\n"); tcall = thread_call_allocate(thread_call_test_func, this); @@ -62,8 +74,8 @@ testthreadcall::start( IOService * provider ) clock_interval_to_deadline(3, NSEC_PER_SEC, &deadline); IOLog("%d sec deadline is %llu\n", 3, deadline); - sleepret = IOLockSleepDeadline(tlock2, NULL, deadline, THREAD_INTERRUPTIBLE); - IOLog("IOLockSleepDeadline(NULL, %llu) returned %d, expected 0\n", deadline, sleepret); + sleepret = IOLockSleepDeadline(tlock2, &my_event, deadline, THREAD_INTERRUPTIBLE); + IOLog("IOLockSleepDeadline(&my_event, %llu) returned %d, expected 0\n", deadline, sleepret); IOLockUnlock(tlock2); @@ -76,8 +88,8 @@ testthreadcall::start( IOService * provider ) clock_interval_to_deadline(3, NSEC_PER_SEC, &deadline); IOLog("%d sec deadline is %llu\n", 3, deadline); - sleepret = IOLockSleepDeadline(tlock2, NULL, deadline, THREAD_INTERRUPTIBLE); - IOLog("IOLockSleepDeadline(NULL, %llu) returned %d, expected 1\n", deadline, sleepret); + sleepret = IOLockSleepDeadline(tlock2, &my_event, deadline, THREAD_INTERRUPTIBLE); + IOLog("IOLockSleepDeadline(&my_event, %llu) returned %d, expected 1\n", deadline, sleepret); IOLockUnlock(tlock2); @@ -102,5 +114,5 @@ static void thread_call_test_func2(thread_call_param_t param0, IOLog("thread_call_test_func2 %p %p\n", param0, param1); - IOLockWakeup(self->tlock2, NULL, false); + IOLockWakeup(self->tlock2, &my_event, false); }