diff options
Diffstat (limited to 'src/pkg/runtime/mem_dragonfly.c')
-rw-r--r-- | src/pkg/runtime/mem_dragonfly.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/pkg/runtime/mem_dragonfly.c b/src/pkg/runtime/mem_dragonfly.c index 025b62ea6..c270332cb 100644 --- a/src/pkg/runtime/mem_dragonfly.c +++ b/src/pkg/runtime/mem_dragonfly.c @@ -45,17 +45,26 @@ runtime·SysFree(void *v, uintptr n, uint64 *stat) runtime·munmap(v, n); } +void +runtime·SysFault(void *v, uintptr n) +{ + runtime·mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0); +} + void* -runtime·SysReserve(void *v, uintptr n) +runtime·SysReserve(void *v, uintptr n, bool *reserved) { void *p; // On 64-bit, people with ulimit -v set complain if we reserve too // much address space. Instead, assume that the reservation is okay // and check the assumption in SysMap. - if(sizeof(void*) == 8) + if(sizeof(void*) == 8 && n > 1LL<<32) { + *reserved = false; return v; - + } + + *reserved = true; p = runtime·mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0); if(p < (void*)4096) return nil; @@ -63,14 +72,14 @@ runtime·SysReserve(void *v, uintptr n) } void -runtime·SysMap(void *v, uintptr n, uint64 *stat) +runtime·SysMap(void *v, uintptr n, bool reserved, uint64 *stat) { void *p; runtime·xadd64(stat, n); // On 64-bit, we don't actually have v reserved, so tread carefully. - if(sizeof(void*) == 8) { + if(!reserved) { // TODO(jsing): For some reason DragonFly seems to return // memory at a different address than we requested, even when // there should be no reason for it to do so. This can be |