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

Side by Side Diff: runtime/vm/os_linux.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 <malloc.h> 9 #include <malloc.h>
10 #include <time.h> 10 #include <time.h>
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return sysconf(_SC_NPROCESSORS_ONLN); 303 return sysconf(_SC_NPROCESSORS_ONLN);
304 } 304 }
305 305
306 306
307 void OS::Sleep(int64_t millis) { 307 void OS::Sleep(int64_t millis) {
308 // TODO(5411554): For now just use usleep we may have to revisit this. 308 // TODO(5411554): For now just use usleep we may have to revisit this.
309 usleep(millis * 1000); 309 usleep(millis * 1000);
310 } 310 }
311 311
312 312
313 void OS::DebugBreak() {
314 #if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32)
315 asm("int $3");
316 #elif defined(HOST_ARCH_ARM)
317 asm("svc #0x9f0001"); // __ARM_NR_breakpoint
318 #elif defined(HOST_ARCH_MIPS)
319 UNIMPLEMENTED();
320 #else
321 #error Unsupported architecture.
322 #endif
siva 2013/01/24 02:03:09 As discussed offline we have moved away from using
Kevin Millikin (Google) 2013/01/24 08:26:36 It's pretty minor, but it's nice to have because g
Ivan Posva 2013/01/24 18:25:57 Since this is in a OS specific file we can add the
regis 2013/01/24 21:47:48 As Kevin, I think that DebugBreak() is nice to hav
323 }
324
325
313 void OS::Print(const char* format, ...) { 326 void OS::Print(const char* format, ...) {
314 va_list args; 327 va_list args;
315 va_start(args, format); 328 va_start(args, format);
316 VFPrint(stdout, format, args); 329 VFPrint(stdout, format, args);
317 va_end(args); 330 va_end(args);
318 } 331 }
319 332
320 333
321 void OS::VFPrint(FILE* stream, const char* format, va_list args) { 334 void OS::VFPrint(FILE* stream, const char* format, va_list args) {
322 vfprintf(stream, format, args); 335 vfprintf(stream, format, args);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 391
379 392
380 void OS::PrintErr(const char* format, ...) { 393 void OS::PrintErr(const char* format, ...) {
381 va_list args; 394 va_list args;
382 va_start(args, format); 395 va_start(args, format);
383 VFPrint(stderr, format, args); 396 VFPrint(stderr, format, args);
384 va_end(args); 397 va_end(args);
385 } 398 }
386 399
387 400
401 // Cache the null page size.
402 uword OS::null_page_size_ = 0;
403
404
388 void OS::InitOnce() { 405 void OS::InitOnce() {
389 // TODO(5411554): For now we check that initonce is called only once, 406 // TODO(5411554): For now we check that initonce is called only once,
390 // Once there is more formal mechanism to call InitOnce we can move 407 // Once there is more formal mechanism to call InitOnce we can move
391 // this check there. 408 // this check there.
392 static bool init_once_called = false; 409 static bool init_once_called = false;
393 ASSERT(init_once_called == false); 410 ASSERT(init_once_called == false);
394 init_once_called = true; 411 init_once_called = true;
412
413 // Initialize the null page size.
414 null_page_size_ = static_cast<uword>(getpagesize());
395 } 415 }
396 416
397 417
398 void OS::Shutdown() { 418 void OS::Shutdown() {
399 } 419 }
400 420
401 421
402 void OS::Abort() { 422 void OS::Abort() {
403 abort(); 423 abort();
404 } 424 }
405 425
406 426
407 void OS::Exit(int code) { 427 void OS::Exit(int code) {
408 exit(code); 428 exit(code);
409 } 429 }
410 430
411 } // namespace dart 431 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698