21 lines
260 B
Plaintext

import sys
const page {
readwrite 0x0004
}
const mem {
commit 0x1000
reserve 0x2000
}
alloc(length Int) -> []Int8 {
x := sys.mmap(0, length+8, page.readwrite, mem.commit|mem.reserve)
if x < 0x1000 {
return x
}
store(x, 8, length)
return x + 8
}