support for the Genode OS framework (#5560)

This commit is contained in:
Emery Hemingway 2017-03-31 16:13:06 -05:00 • committed by Andreas Rumpf
commit 7e351fc7fa
14 changed files with 348 additions and 33 deletions

View file

@ -77,6 +77,19 @@ when defined(emscripten):
var mmapDescr = cast[EmscriptenMMapBlock](mmapDescrPos)
munmap(mmapDescr.realPointer, mmapDescr.realSize)
elif defined(genode):
proc osAllocPages(size: int): pointer {.
importcpp: "genodeEnv->rm().attach(genodeEnv->ram().alloc(@))".}
proc osTryAllocPages(size: int): pointer =
{.emit: """try {""".}
result = osAllocPages size
{.emit: """} catch (...) { }""".}
proc osDeallocPages(p: pointer, size: int) {.
importcpp: "genodeEnv->rm().detach(#)".}
elif defined(posix):
const
PROT_READ = 1 # page can be read