mov eax, [esp]\r
ret\r
\r
-[extern Proc_Clone]\r
-[extern Threads_Exit]\r
-[global SpawnTask]\r
-SpawnTask:\r
- ; Call Proc_Clone with Flags=0\r
- xor eax, eax\r
- push eax
+; int CallWithArgArray(void *Ptr, int NArgs, Uint *Args)\r
+; Call a function passing the array as arguments\r
+[global CallWithArgArray]\r
+CallWithArgArray:\r
+ push ebp\r
+ mov ebp, esp\r
+ mov ecx, [ebp+12] ; Get NArgs\r
+ mov edx, [ebp+16]\r
+\r
+.top:\r
+ mov eax, [edx+ecx*4-4]\r
push eax\r
- call Proc_Clone\r
- add esp, 8 ; Remove arguments from stack\r
- \r
- test eax, eax\r
- jnz .parent\r
- \r
- ; In child, so now set up stack frame\r
- mov ebx, [esp+4] ; Child Function\r
- mov edx, [esp+8] ; Argument\r
- ; Child\r
- push edx ; Argument\r
- call ebx ; Function\r
- call Threads_Exit ; Kill Thread\r
+ loop .top\r
\r
-.parent:\r
+ mov eax, [ebp+8]\r
+ call eax\r
+ lea esp, [ebp]\r
+ pop ebp\r
ret\r
\r
[section .initpd]\r