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

Side by Side Diff: src/nonsfi/irt/irt_interfaces.c

Issue 686723003: Non-SFI mode: Implement nacl_irt_random only for nacl_helper_nonsfi. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/nonsfi/irt/irt_interfaces.h" 7 #include "native_client/src/nonsfi/irt/irt_interfaces.h"
8 8
9 #include <assert.h> 9 #include <assert.h>
10 #include <errno.h> 10 #include <errno.h>
(...skipping 19 matching lines...) Expand all
30 #include "native_client/src/nonsfi/linux/irt_exception_handling.h" 30 #include "native_client/src/nonsfi/linux/irt_exception_handling.h"
31 #include "native_client/src/public/irt_core.h" 31 #include "native_client/src/public/irt_core.h"
32 #include "native_client/src/trusted/service_runtime/include/machine/_types.h" 32 #include "native_client/src/trusted/service_runtime/include/machine/_types.h"
33 #include "native_client/src/trusted/service_runtime/include/sys/mman.h" 33 #include "native_client/src/trusted/service_runtime/include/sys/mman.h"
34 #include "native_client/src/trusted/service_runtime/include/sys/stat.h" 34 #include "native_client/src/trusted/service_runtime/include/sys/stat.h"
35 #include "native_client/src/trusted/service_runtime/include/sys/time.h" 35 #include "native_client/src/trusted/service_runtime/include/sys/time.h"
36 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h" 36 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h"
37 #include "native_client/src/untrusted/irt/irt.h" 37 #include "native_client/src/untrusted/irt/irt.h"
38 #include "native_client/src/untrusted/irt/irt_dev.h" 38 #include "native_client/src/untrusted/irt/irt_dev.h"
39 #include "native_client/src/untrusted/irt/irt_interfaces.h" 39 #include "native_client/src/untrusted/irt/irt_interfaces.h"
40 #include "native_client/src/untrusted/nacl/nacl_random.h"
40 41
41 /* 42 /*
42 * This is an implementation of NaCl's IRT interfaces that runs 43 * This is an implementation of NaCl's IRT interfaces that runs
43 * outside of the NaCl sandbox. 44 * outside of the NaCl sandbox.
44 * 45 *
45 * This allows PNaCl to be used as a portability layer without the 46 * This allows PNaCl to be used as a portability layer without the
46 * SFI-based sandboxing. PNaCl pexes can be translated to 47 * SFI-based sandboxing. PNaCl pexes can be translated to
47 * non-SFI-sandboxed native code and linked against this IRT 48 * non-SFI-sandboxed native code and linked against this IRT
48 * implementation. 49 * implementation.
49 */ 50 */
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 }; 593 };
593 #elif !defined(__native_client__) 594 #elif !defined(__native_client__)
594 DEFINE_STUB(futex_wait_abs) 595 DEFINE_STUB(futex_wait_abs)
595 DEFINE_STUB(futex_wake) 596 DEFINE_STUB(futex_wake)
596 const struct nacl_irt_futex nacl_irt_futex = { 597 const struct nacl_irt_futex nacl_irt_futex = {
597 USE_STUB(nacl_irt_futex, futex_wait_abs), 598 USE_STUB(nacl_irt_futex, futex_wait_abs),
598 USE_STUB(nacl_irt_futex, futex_wake), 599 USE_STUB(nacl_irt_futex, futex_wake),
599 }; 600 };
600 #endif 601 #endif
601 602
603 const struct nacl_irt_random nacl_irt_random = {
604 nacl_secure_random,
605 };
606
602 #if defined(__linux__) || defined(__native_client__) 607 #if defined(__linux__) || defined(__native_client__)
603 const struct nacl_irt_clock nacl_irt_clock = { 608 const struct nacl_irt_clock nacl_irt_clock = {
604 irt_clock_getres, 609 irt_clock_getres,
605 irt_clock_gettime, 610 irt_clock_gettime,
606 }; 611 };
607 #endif 612 #endif
608 613
609 DEFINE_STUB(utimes) 614 DEFINE_STUB(utimes)
610 const struct nacl_irt_dev_filename nacl_irt_dev_filename = { 615 const struct nacl_irt_dev_filename nacl_irt_dev_filename = {
611 irt_open, 616 irt_open,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 }; 648 };
644 #endif 649 #endif
645 650
646 static const struct nacl_irt_interface irt_interfaces[] = { 651 static const struct nacl_irt_interface irt_interfaces[] = {
647 { NACL_IRT_BASIC_v0_1, &nacl_irt_basic, sizeof(nacl_irt_basic), NULL }, 652 { NACL_IRT_BASIC_v0_1, &nacl_irt_basic, sizeof(nacl_irt_basic), NULL },
648 { NACL_IRT_FDIO_v0_1, &nacl_irt_fdio, sizeof(nacl_irt_fdio), NULL }, 653 { NACL_IRT_FDIO_v0_1, &nacl_irt_fdio, sizeof(nacl_irt_fdio), NULL },
649 { NACL_IRT_MEMORY_v0_3, &nacl_irt_memory, sizeof(nacl_irt_memory), NULL }, 654 { NACL_IRT_MEMORY_v0_3, &nacl_irt_memory, sizeof(nacl_irt_memory), NULL },
650 { NACL_IRT_TLS_v0_1, &nacl_irt_tls, sizeof(nacl_irt_tls), NULL }, 655 { NACL_IRT_TLS_v0_1, &nacl_irt_tls, sizeof(nacl_irt_tls), NULL },
651 { NACL_IRT_THREAD_v0_1, &nacl_irt_thread, sizeof(nacl_irt_thread), NULL }, 656 { NACL_IRT_THREAD_v0_1, &nacl_irt_thread, sizeof(nacl_irt_thread), NULL },
652 { NACL_IRT_FUTEX_v0_1, &nacl_irt_futex, sizeof(nacl_irt_futex), NULL }, 657 { NACL_IRT_FUTEX_v0_1, &nacl_irt_futex, sizeof(nacl_irt_futex), NULL },
658 { NACL_IRT_RANDOM_v0_1, &nacl_irt_random, sizeof(nacl_irt_random), NULL },
653 #if defined(__linux__) || defined(__native_client__) 659 #if defined(__linux__) || defined(__native_client__)
654 { NACL_IRT_CLOCK_v0_1, &nacl_irt_clock, sizeof(nacl_irt_clock), NULL }, 660 { NACL_IRT_CLOCK_v0_1, &nacl_irt_clock, sizeof(nacl_irt_clock), NULL },
655 #endif 661 #endif
656 { NACL_IRT_DEV_FILENAME_v0_3, &nacl_irt_dev_filename, 662 { NACL_IRT_DEV_FILENAME_v0_3, &nacl_irt_dev_filename,
657 sizeof(nacl_irt_dev_filename), NULL }, 663 sizeof(nacl_irt_dev_filename), NULL },
658 { NACL_IRT_DEV_GETPID_v0_1, &nacl_irt_dev_getpid, 664 { NACL_IRT_DEV_GETPID_v0_1, &nacl_irt_dev_getpid,
659 sizeof(nacl_irt_dev_getpid), NULL }, 665 sizeof(nacl_irt_dev_getpid), NULL },
660 #if defined(__native_client__) 666 #if defined(__native_client__)
661 { NACL_IRT_EXCEPTION_HANDLING_v0_1, &nacl_irt_exception_handling, 667 { NACL_IRT_EXCEPTION_HANDLING_v0_1, &nacl_irt_exception_handling,
662 sizeof(nacl_irt_exception_handling), NULL}, 668 sizeof(nacl_irt_exception_handling), NULL},
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 nacl_entry_func_t entry_func = 729 nacl_entry_func_t entry_func =
724 #if defined(__APPLE__) 730 #if defined(__APPLE__)
725 _start; 731 _start;
726 #else 732 #else
727 _user_start; 733 _user_start;
728 #endif 734 #endif
729 735
730 return nacl_irt_nonsfi_entry(argc, argv, environ, entry_func); 736 return nacl_irt_nonsfi_entry(argc, argv, environ, entry_func);
731 } 737 }
732 #endif 738 #endif
OLDNEW
« no previous file with comments | « src/nonsfi/irt/irt.gyp ('k') | src/nonsfi/irt/irt_random.h » ('j') | src/nonsfi/irt/irt_random.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698