21 lines
260 B
Plaintext
Raw Normal View History

2024-08-19 17:25:51 +02:00
import sys
2025-02-15 14:38:01 +01:00
const page {
readwrite 0x0004
}
const mem {
commit 0x1000
reserve 0x2000
}
2025-02-09 20:25:37 +01:00
alloc(length Int) -> []Int8 {
2025-02-15 14:38:01 +01:00
x := sys.mmap(0, length+8, page.readwrite, mem.commit|mem.reserve)
2025-02-09 14:38:01 +01:00
if x < 0x1000 {
return x
}
store(x, 8, length)
return x + 8
2024-08-19 17:25:51 +02:00
}