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

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

Issue 12041056: Initial revision of ARM simulator and (empty) MIPS simulator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/os.h" 5 #include "vm/os.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <limits.h> 8 #include <limits.h>
9 #include <mach/mach.h> 9 #include <mach/mach.h>
10 #include <mach/clock.h> 10 #include <mach/clock.h>
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return sysconf(_SC_NPROCESSORS_ONLN); 116 return sysconf(_SC_NPROCESSORS_ONLN);
117 } 117 }
118 118
119 119
120 void OS::Sleep(int64_t millis) { 120 void OS::Sleep(int64_t millis) {
121 // TODO(5411554): For now just use usleep we may have to revisit this. 121 // TODO(5411554): For now just use usleep we may have to revisit this.
122 usleep(millis * 1000); 122 usleep(millis * 1000);
123 } 123 }
124 124
125 125
126 void OS::DebugBreak() {
127 #if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32)
128 asm("int $3");
129 #else
130 #error Unsupported architecture.
131 #endif
132 }
133
134
126 void OS::Print(const char* format, ...) { 135 void OS::Print(const char* format, ...) {
127 va_list args; 136 va_list args;
128 va_start(args, format); 137 va_start(args, format);
129 VFPrint(stdout, format, args); 138 VFPrint(stdout, format, args);
130 va_end(args); 139 va_end(args);
131 } 140 }
132 141
133 142
134 void OS::VFPrint(FILE* stream, const char* format, va_list args) { 143 void OS::VFPrint(FILE* stream, const char* format, va_list args) {
135 vfprintf(stream, format, args); 144 vfprintf(stream, format, args);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 188
180 189
181 void OS::PrintErr(const char* format, ...) { 190 void OS::PrintErr(const char* format, ...) {
182 va_list args; 191 va_list args;
183 va_start(args, format); 192 va_start(args, format);
184 VFPrint(stderr, format, args); 193 VFPrint(stderr, format, args);
185 va_end(args); 194 va_end(args);
186 } 195 }
187 196
188 197
198 // Cache the null page size.
199 uword OS::null_page_size_ = 0;
200
201
189 void OS::InitOnce() { 202 void OS::InitOnce() {
190 // TODO(5411554): For now we check that initonce is called only once, 203 // TODO(5411554): For now we check that initonce is called only once,
191 // Once there is more formal mechanism to call InitOnce we can move 204 // Once there is more formal mechanism to call InitOnce we can move
192 // this check there. 205 // this check there.
193 static bool init_once_called = false; 206 static bool init_once_called = false;
194 ASSERT(init_once_called == false); 207 ASSERT(init_once_called == false);
195 init_once_called = true; 208 init_once_called = true;
209
210 // Initialize the null page size.
211 null_page_size_ = static_cast<uword>(getpagesize());
196 } 212 }
197 213
198 214
199 void OS::Shutdown() { 215 void OS::Shutdown() {
200 } 216 }
201 217
202 218
203 void OS::Abort() { 219 void OS::Abort() {
204 abort(); 220 abort();
205 } 221 }
206 222
207 223
208 void OS::Exit(int code) { 224 void OS::Exit(int code) {
209 exit(code); 225 exit(code);
210 } 226 }
211 227
212 } // namespace dart 228 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698