Loading...
iokit/Kernel/IOWorkLoop.cpp xnu-517.7.21 xnu-344.12.2
--- xnu/xnu-517.7.21/iokit/Kernel/IOWorkLoop.cpp
+++ xnu/xnu-344.12.2/iokit/Kernel/IOWorkLoop.cpp
@@ -57,8 +57,14 @@
 
 #define fFlags loopRestart
 
+extern "C" extern void stack_privilege( thread_t thread);
+
 void IOWorkLoop::launchThreadMain(void *self)
 {
+    register thread_t mythread = current_thread();
+
+    // Make sure that this thread always has a kernel stack
+    stack_privilege(mythread);
     thread_set_cont_arg((int) self);
     threadMainContinuation();
 }
@@ -103,7 +109,7 @@
     IOWorkLoop *me = new IOWorkLoop;
 
     if (me && !me->init()) {
-        me->release();
+        me->free();
         return 0;
     }
 
@@ -367,8 +373,8 @@
 }
 
 IOReturn IOWorkLoop::runAction(Action inAction, OSObject *target,
-                                  void *arg0, void *arg1,
-                                  void *arg2, void *arg3)
+                                  void *arg0 = 0, void *arg1 = 0,
+                                  void *arg2 = 0, void *arg3 = 0)
 {
     IOReturn res;