diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-04-02 23:44:50 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-04-02 23:44:50 +0200 |
commit | 57b7c45128bc4257157ce905537db2f3fb970b7b (patch) | |
tree | 98db34a7b987dd7135792615a58e75ba58e15e38 /lib/system/osalloc.nim | |
parent | c785066ee343268c5ef9c19c4d334a0f1e8e8c48 (diff) | |
parent | cab2ce7e8770f35561f002bab601358a09535ef2 (diff) | |
download | Nim-57b7c45128bc4257157ce905537db2f3fb970b7b.tar.gz |
Merge branch 'devel' into araq
Diffstat (limited to 'lib/system/osalloc.nim')
-rw-r--r-- | lib/system/osalloc.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/system/osalloc.nim b/lib/system/osalloc.nim index a57a88e8f..65a057772 100644 --- a/lib/system/osalloc.nim +++ b/lib/system/osalloc.nim @@ -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 |