Simplified thread example

This commit is contained in:
2025-01-31 12:11:39 +01:00
parent 547e7d066b
commit 6163ba547e
2 changed files with 16 additions and 14 deletions

10
lib/thread/thread.q Normal file
View 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)
}