Simplified thread example
This commit is contained in:
parent
326db85e41
commit
2ae8b04593
2 changed files with 16 additions and 14 deletions
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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue