OpenJDK / jdk / jdk
changeset 27927:354a5ba966a9
8067015: Implement os::pd_map_memory() on AIX
Reviewed-by: dholmes
author | simonis |
---|---|
date | Wed, 10 Dec 2014 19:12:27 +0100 |
parents | 0e2e188ab887 |
children | c12e49897c5a |
files | hotspot/src/os/aix/vm/os_aix.cpp |
diffstat | 1 files changed, 23 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hotspot/src/os/aix/vm/os_aix.cpp Fri Dec 05 16:36:07 2014 -0800 +++ b/hotspot/src/os/aix/vm/os_aix.cpp Wed Dec 10 19:12:27 2014 +0100 @@ -4144,8 +4144,29 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, char *addr, size_t bytes, bool read_only, bool allow_exec) { - Unimplemented(); - return NULL; + int prot; + int flags = MAP_PRIVATE; + + if (read_only) { + prot = PROT_READ; + } else { + prot = PROT_READ | PROT_WRITE; + } + + if (allow_exec) { + prot |= PROT_EXEC; + } + + if (addr != NULL) { + flags |= MAP_FIXED; + } + + char* mapped_address = (char*)mmap(addr, (size_t)bytes, prot, flags, + fd, file_offset); + if (mapped_address == MAP_FAILED) { + return NULL; + } + return mapped_address; }