--- 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;
}