| Index: runtime/vm/os_fuchsia.cc
|
| diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
|
| index b6343522633a5c30e7b7f50ee7db207ab7d731d2..09aa389890f11d102216d5fcd060e8a4c28b0016 100644
|
| --- a/runtime/vm/os_fuchsia.cc
|
| +++ b/runtime/vm/os_fuchsia.cc
|
| @@ -10,6 +10,7 @@
|
| #include <errno.h>
|
| #include <magenta/syscalls.h>
|
| #include <magenta/types.h>
|
| +#include <runtime/sysinfo.h>
|
|
|
| #include "platform/assert.h"
|
| #include "vm/zone.h"
|
| @@ -86,13 +87,19 @@ int64_t OS::GetCurrentThreadCPUMicros() {
|
|
|
|
|
| void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) {
|
| - UNIMPLEMENTED();
|
| - return NULL;
|
| + const int kMinimumAlignment = 16;
|
| + ASSERT(Utils::IsPowerOfTwo(alignment));
|
| + ASSERT(alignment >= kMinimumAlignment);
|
| + void* p = memalign(alignment, size);
|
| + if (p == NULL) {
|
| + UNREACHABLE();
|
| + }
|
| + return p;
|
| }
|
|
|
|
|
| void OS::AlignedFree(void* ptr) {
|
| - UNIMPLEMENTED();
|
| + free(ptr);
|
| }
|
|
|
|
|
| @@ -146,18 +153,19 @@ bool OS::AllowStackFrameIteratorFromAnotherThread() {
|
|
|
|
|
| int OS::NumberOfAvailableProcessors() {
|
| - UNIMPLEMENTED();
|
| - return 0;
|
| + return mxr_get_nprocs_conf();
|
| }
|
|
|
|
|
| void OS::Sleep(int64_t millis) {
|
| - UNIMPLEMENTED();
|
| + mx_nanosleep(
|
| + millis * kMicrosecondsPerMillisecond * kNanosecondsPerMicrosecond);
|
| }
|
|
|
|
|
| void OS::SleepMicros(int64_t micros) {
|
| - UNIMPLEMENTED();
|
| + mx_nanosleep(
|
| + micros * kNanosecondsPerMicrosecond);
|
| }
|
|
|
|
|
|
|