Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: runtime/vm/virtual_memory_fuchsia.cc

Issue 2471343002: Move to the new mx_vmo_syscall argument order (Closed)
Patch Set: typo Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/syscalls.h> 10 #include <magenta/syscalls.h>
11 #include <unistd.h> // NOLINT 11 #include <unistd.h> // NOLINT
12 12
13 #include "platform/assert.h" 13 #include "platform/assert.h"
14 #include "vm/memory_region.h" 14 #include "vm/memory_region.h"
15 #include "vm/os.h" 15 #include "vm/os.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 uword VirtualMemory::page_size_ = 0; 19 uword VirtualMemory::page_size_ = 0;
20 20
21 21
22 void VirtualMemory::InitOnce() { 22 void VirtualMemory::InitOnce() {
23 page_size_ = getpagesize(); 23 page_size_ = getpagesize();
24 } 24 }
25 25
26 26
27 VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) { 27 VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) {
28 mx_handle_t vmo = mx_vmo_create(size); 28 mx_handle_t vmo = MX_HANDLE_INVALID;
29 if (vmo <= 0) { 29 mx_status_t status = mx_vmo_create(size, 0u, &vmo);
30 if (status != NO_ERROR) {
30 return NULL; 31 return NULL;
31 } 32 }
32 33
33 // 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
34 // Commit and Protect when they are implemented. 35 // Commit and Protect when they are implemented.
35 // Issue MG-161. 36 // Issue MG-161.
36 const int prot = MX_VM_FLAG_PERM_READ | 37 const int prot = MX_VM_FLAG_PERM_READ |
37 MX_VM_FLAG_PERM_WRITE | 38 MX_VM_FLAG_PERM_WRITE |
38 MX_VM_FLAG_PERM_EXECUTE; 39 MX_VM_FLAG_PERM_EXECUTE;
39 uintptr_t addr; 40 uintptr_t addr;
40 mx_status_t status = mx_process_map_vm( 41 status = mx_process_map_vm(
41 mx_process_self(), vmo, 0, size, &addr, prot); 42 mx_process_self(), vmo, 0, size, &addr, prot);
42 if (status != NO_ERROR) { 43 if (status != NO_ERROR) {
43 mx_handle_close(vmo); 44 mx_handle_close(vmo);
44 FATAL("VirtualMemory::ReserveInternal FAILED"); 45 FATAL("VirtualMemory::ReserveInternal FAILED");
45 return NULL; 46 return NULL;
46 } 47 }
47 48
48 MemoryRegion region(reinterpret_cast<void*>(addr), size); 49 MemoryRegion region(reinterpret_cast<void*>(addr), size);
49 return new VirtualMemory(region, vmo); 50 return new VirtualMemory(region, vmo);
50 } 51 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 85
85 86
86 bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) { 87 bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
87 // TODO(zra): Implement when Fuchsia has an mprotect-like call. 88 // TODO(zra): Implement when Fuchsia has an mprotect-like call.
88 return true; 89 return true;
89 } 90 }
90 91
91 } // namespace dart 92 } // namespace dart
92 93
93 #endif // defined(TARGET_OS_FUCHSIA) 94 #endif // defined(TARGET_OS_FUCHSIA)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698