@@ -22,15 +22,22 @@ fun run() uint:
2222 ref let! params os\CloneArgs
2323 set params.flags = os\CLONE_VM | os\CLONE_FS | os\CLONE_FILES | os\CLONE_SIGHAND |
2424 os\CLONE_THREAD | os\CLONE_SYSVSEM
25+ set params.stack_size = gStackSize
26+ fmt\print#("stack ", wrap_as(bitwise_as(params.stack, uint), fmt\uint_hex), "\n")
27+
28+
2529 for i = 0, gThreads, 1:
2630 fmt\print#("spawning ", i, "\n")
2731 ; do os\nanosleep(@req, @!rem)
2832 set params.stack = front!(gStacks[i + 1])
29- set params.stack_size = gStackSize
30- fmt\print#("stack ", wrap_as(bitwise_as(params.stack, uint), fmt\uint_hex), "\n")
31- trylet pid u32 = os\Clone3Wrapper(thread_runner, i, @!params), err:
32- fmt\print#("clone failed at ", i, " with ", unwrap(err), "\n")
33+ ; Note: here the stack parameter is the top of the stack
34+ trylet pid u32 = os\CloneWrapper(thread_runner, params.stack, 0, i, params.flags), err:
35+ fmt\print#("clone failed at ", i, " with ", unwrap(err), "\n")
3336 continue
37+ ; Note: here the stack parameter is the bottom of the stack
38+ ; trylet pid u32 = os\Clone3Wrapper(thread_runner, i, @!params), err:
39+ ; fmt\print#("clone failed at ", i, " with ", unwrap(err), "\n")
40+ ; continue
3441
3542 do os\nanosleep(@req, @!rem)
3643 return gIterations * gThreads
0 commit comments