22 lines
275 B
Plaintext

import sys
const prot {
read 0x1
write 0x2
}
const map {
private 0x02
anonymous 0x1000
}
alloc(length Int) -> []Int8 {
x := sys.mmap(0, length+8, prot.read|prot.write, map.private|map.anonymous)
if x < 0x1000 {
return x
}
store(x, 8, length)
return x + 8
}