Simplified thread example
This commit is contained in:
10
lib/thread/thread.q
Normal file
10
lib/thread/thread.q
Normal file
@ -0,0 +1,10 @@
|
||||
import mem
|
||||
import sys
|
||||
|
||||
create(func Pointer) -> Int {
|
||||
size := 4096
|
||||
stack := mem.alloc(size)
|
||||
rip := stack + size - 8
|
||||
store(rip, 8, func)
|
||||
return sys.clone(0x100|0x200|0x400|0x800|0x8000|0x10000|0x80000000, rip)
|
||||
}
|
Reference in New Issue
Block a user