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

Side by Side Diff: components/nacl/loader/nonsfi/irt_interfaces.cc

Issue 139453002: Implement nacl_irt_futex for non-sfi mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/nacl/loader/nonsfi/irt_interfaces.h" 5 #include "components/nacl/loader/nonsfi/irt_interfaces.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 namespace nacl { 9 namespace nacl {
10 namespace nonsfi { 10 namespace nonsfi {
11 11
12 namespace { 12 namespace {
13 13
14 // This table keeps a pair of IRT entry (such as nacl_irt_basic, nacl_irt_fdio 14 // This table keeps a pair of IRT entry (such as nacl_irt_basic, nacl_irt_fdio
15 // etc.) and its registered name with its version (such as NACL_IRT_BASIC_v0_1, 15 // etc.) and its registered name with its version (such as NACL_IRT_BASIC_v0_1,
16 // NACL_IRT_DEV_FDIO_v0_1, etc.). 16 // NACL_IRT_DEV_FDIO_v0_1, etc.).
17 struct NaClInterfaceTable { 17 struct NaClInterfaceTable {
18 const char* name; 18 const char* name;
19 const void* table; 19 const void* table;
20 size_t size; 20 size_t size;
21 }; 21 };
22 22
23 #define NACL_INTERFACE_TABLE(name, value) { name, &value, sizeof(value) } 23 #define NACL_INTERFACE_TABLE(name, value) { name, &value, sizeof(value) }
24 const NaClInterfaceTable kIrtInterfaces[] = { 24 const NaClInterfaceTable kIrtInterfaces[] = {
25 NACL_INTERFACE_TABLE(NACL_IRT_BASIC_v0_1, kIrtBasic), 25 NACL_INTERFACE_TABLE(NACL_IRT_BASIC_v0_1, kIrtBasic),
26 NACL_INTERFACE_TABLE(NACL_IRT_DEV_FDIO_v0_1, kIrtFdIO), 26 NACL_INTERFACE_TABLE(NACL_IRT_DEV_FDIO_v0_1, kIrtFdIO),
27 NACL_INTERFACE_TABLE(NACL_IRT_THREAD_v0_1, kIrtThread), 27 NACL_INTERFACE_TABLE(NACL_IRT_THREAD_v0_1, kIrtThread),
28 NACL_INTERFACE_TABLE(NACL_IRT_FUTEX_v0_1, kIrtFutex),
28 NACL_INTERFACE_TABLE(NACL_IRT_TLS_v0_1, kIrtTls), 29 NACL_INTERFACE_TABLE(NACL_IRT_TLS_v0_1, kIrtTls),
29 }; 30 };
30 #undef NACL_INTERFACE_TABLE 31 #undef NACL_INTERFACE_TABLE
31 32
32 } // namespace 33 } // namespace
33 34
34 size_t NaClIrtInterface(const char* interface_ident, 35 size_t NaClIrtInterface(const char* interface_ident,
35 void* table, size_t tablesize) { 36 void* table, size_t tablesize) {
36 for (size_t i = 0; i < arraysize(kIrtInterfaces); ++i) { 37 for (size_t i = 0; i < arraysize(kIrtInterfaces); ++i) {
37 if (std::strcmp(interface_ident, kIrtInterfaces[i].name) == 0) { 38 if (std::strcmp(interface_ident, kIrtInterfaces[i].name) == 0) {
38 const size_t size = kIrtInterfaces[i].size; 39 const size_t size = kIrtInterfaces[i].size;
39 if (size <= tablesize) { 40 if (size <= tablesize) {
40 std::memcpy(table, kIrtInterfaces[i].table, size); 41 std::memcpy(table, kIrtInterfaces[i].table, size);
41 return size; 42 return size;
42 } 43 }
43 break; 44 break;
44 } 45 }
45 } 46 }
46 return 0; 47 return 0;
47 } 48 }
48 49
49 } // namespace nonsfi 50 } // namespace nonsfi
50 } // namespace nacl 51 } // namespace nacl
OLDNEW
« components/nacl/loader/nonsfi/irt_futex.cc ('K') | « components/nacl/loader/nonsfi/irt_interfaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698