Implemented function pointers as parameters

This commit is contained in:
2025-01-30 23:57:41 +01:00
parent 313302b9c8
commit dd6d1cc16c
5 changed files with 76 additions and 36 deletions

View File

@ -2,18 +2,18 @@ import mem
import sys
main() {
start()
start()
start()
start(thread)
start(thread)
start(thread)
thread()
}
start() {
start(func Pointer) {
size := 4096
stack := mem.alloc(size)
pointer := stack + size - 8
store(pointer, 8, thread)
sys.clone(0x100 | 0x200 | 0x400 | 0x800 | 0x8000 | 0x10000 | 0x80000000, pointer)
rip := stack + size - 8
store(rip, 8, func)
sys.clone(0x100|0x200|0x400|0x800|0x8000|0x10000|0x80000000, rip)
}
thread() {