| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_OS_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include "vm/virtual_memory.h" | 8 #include "vm/virtual_memory.h" |
| 9 | 9 |
| 10 #include <magenta/process.h> | 10 #include <magenta/process.h> |
| 11 #include <magenta/syscalls.h> | 11 #include <magenta/syscalls.h> |
| 12 #include <unistd.h> // NOLINT | 12 #include <unistd.h> // NOLINT |
| 13 | 13 |
| 14 #include "platform/assert.h" | 14 #include "platform/assert.h" |
| 15 #include "vm/memory_region.h" | 15 #include "vm/memory_region.h" |
| 16 #include "vm/os.h" | 16 #include "vm/os.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 | 19 |
| 20 uword VirtualMemory::page_size_ = 0; | 20 uword VirtualMemory::page_size_ = 0; |
| 21 | 21 |
| 22 | 22 |
| 23 void VirtualMemory::InitOnce() { | 23 void VirtualMemory::InitOnce() { |
| 24 page_size_ = getpagesize(); | 24 page_size_ = getpagesize(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 | 27 |
| 28 VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { | 28 VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { |
| 29 mx_handle_t vmo = mx_vm_object_create(size); | 29 mx_handle_t vmo = mx_vmo_create(size); |
| 30 if (vmo <= 0) { | 30 if (vmo <= 0) { |
| 31 return NULL; | 31 return NULL; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // TODO(zra): map with PERM_NONE, when that works, and relax with | 34 // TODO(zra): map with PERM_NONE, when that works, and relax with |
| 35 // Commit and Protect when they are implemented. | 35 // Commit and Protect when they are implemented. |
| 36 // Issue MG-161. | 36 // Issue MG-161. |
| 37 const int prot = MX_VM_FLAG_PERM_READ | | 37 const int prot = MX_VM_FLAG_PERM_READ | |
| 38 MX_VM_FLAG_PERM_WRITE | | 38 MX_VM_FLAG_PERM_WRITE | |
| 39 MX_VM_FLAG_PERM_EXECUTE; | 39 MX_VM_FLAG_PERM_EXECUTE; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 | 86 |
| 87 bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { | 87 bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { |
| 88 // TODO(zra): Implement when Fuchsia has an mprotect-like call. | 88 // TODO(zra): Implement when Fuchsia has an mprotect-like call. |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace dart | 92 } // namespace dart |
| 93 | 93 |
| 94 #endif // defined(TARGET_OS_FUCHSIA) | 94 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |