2025-02-16 15:46:54 +01:00
|
|
|
import core
|
2025-01-31 12:11:39 +01:00
|
|
|
import sys
|
|
|
|
|
2025-02-16 11:31:31 +01:00
|
|
|
const clone {
|
|
|
|
vm 0x100
|
|
|
|
fs 0x200
|
|
|
|
files 0x400
|
|
|
|
sighand 0x800
|
|
|
|
parent 0x8000
|
|
|
|
thread 0x10000
|
|
|
|
io 0x80000000
|
|
|
|
}
|
|
|
|
|
2025-02-17 14:31:47 +01:00
|
|
|
create(func *any) -> int {
|
2025-02-27 00:18:34 +01:00
|
|
|
stack := sys.mmap(0, 4096, 0x1|0x2, 0x02|0x20|0x100)
|
|
|
|
stack += 4096 - 8
|
2025-02-16 15:46:54 +01:00
|
|
|
store(stack, 8, core.exit)
|
2025-02-16 11:31:31 +01:00
|
|
|
stack -= 8
|
|
|
|
store(stack, 8, func)
|
2025-02-21 13:47:56 +01:00
|
|
|
return sys.clone(clone.vm|clone.fs|clone.files|clone.sighand|clone.parent|clone.thread|clone.io, stack, 0, 0, 0)
|
2025-01-31 12:11:39 +01:00
|
|
|
}
|