6#if defined(DART_HOST_OS_FUCHSIA)
10#include <zircon/process.h>
11#include <zircon/status.h>
12#include <zircon/syscalls.h>
20uword VirtualMemory::page_size_ = 0;
22intptr_t VirtualMemory::CalculatePageSize() {
23 const intptr_t page_size = getpagesize();
33 zx_handle_t vmar = zx_vmar_root_self();
34 zx_handle_t vmo = ZX_HANDLE_INVALID;
35 zx_status_t status = zx_vmo_create(
size, 0u, &vmo);
36 if (status != ZX_OK) {
40 if (
name !=
nullptr) {
41 zx_object_set_property(vmo, ZX_PROP_NAME,
name, strlen(
name));
47 status = zx_vmo_replace_as_executable(vmo, ZX_HANDLE_INVALID, &vmo);
48 if (status != ZX_OK) {
54 const zx_vm_option_t region_options =
55 ZX_VM_PERM_READ | ZX_VM_PERM_WRITE |
56 (is_executable ? ZX_VM_PERM_EXECUTE : 0);
58 status = zx_vmar_map(vmar, region_options, 0, vmo, 0u,
size, &
base);
60 if (status != ZX_OK) {
64 return new VirtualMemory(
reinterpret_cast<void*
>(
base),
size);
68 if (address_ !=
nullptr) {
69 zx_status_t status = zx_vmar_unmap(
70 zx_vmar_root_self(),
reinterpret_cast<uword>(address_), size_);
71 if (status != ZX_OK) {
72 FATAL(
"zx_vmar_unmap failed: %s\n", zx_status_get_string(status));
79 const uword end_address = start_address +
size;
87 prot = ZX_VM_PERM_READ;
90 prot = ZX_VM_PERM_READ | ZX_VM_PERM_WRITE;
93 prot = ZX_VM_PERM_READ | ZX_VM_PERM_EXECUTE;
96 prot = ZX_VM_PERM_READ | ZX_VM_PERM_WRITE | ZX_VM_PERM_EXECUTE;
99 zx_status_t status = zx_vmar_protect(zx_vmar_root_self(), prot, page_address,
100 end_address - page_address);
101 if (status != ZX_OK) {
102 FATAL(
"zx_vmar_protect(0x%lx, 0x%lx) failed: %s\n", page_address,
103 end_address - page_address, zx_status_get_string(status));
static constexpr T RoundDown(T x, intptr_t alignment)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
static constexpr bool IsPowerOfTwo(T x)
static VirtualMemory * Allocate(intptr_t size, bool is_executable, const char *name)
static void Protect(void *address, intptr_t size, Protection mode)
static intptr_t PageSize()
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size