OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 {{generator_warning}} | |
6 | |
7 #include <stdio.h> | |
8 #include <string.h> | |
9 | |
10 #include "mojo/nacl/mojo_irt.h" | |
11 #include "mojo/public/c/system/core.h" | |
12 #include "native_client/src/public/chrome_main.h" | |
13 #include "native_client/src/public/imc_syscalls.h" | |
14 #include "native_client/src/public/imc_types.h" | |
15 #include "native_client/src/public/irt_core.h" | |
16 | |
17 #define NACL_MOJO_DESC (NACL_CHROME_DESC_BASE + 3) | |
18 | |
19 static void DoMojoCall(uint32_t params[], nacl_abi_size_t num_params) { | |
20 struct NaClAbiNaClImcMsgIoVec iov[1] = { | |
21 {params, num_params} | |
22 }; | |
23 struct NaClAbiNaClImcMsgHdr msgh = {iov, 1, NULL, 0}; | |
24 // Note: return value unchecked. We're relying on the result parameter being | |
25 // unmodified - if the syscall fails, the Mojo function will return whatever | |
26 // the result parameter was initialized to before this function was called. | |
27 imc_sendmsg(NACL_MOJO_DESC, &msgh, 0); | |
28 } | |
29 | |
30 {{body}} | |
31 | |
32 size_t mojo_irt_query(const char* interface_ident, | |
33 void* table, | |
34 size_t tablesize) { | |
35 static const size_t size = sizeof(kIrtMojo); | |
36 if (0 == strcmp(interface_ident, NACL_IRT_MOJO_v0_1)) { | |
37 if (size <= tablesize) { | |
38 memcpy(table, &kIrtMojo, size); | |
39 return size; | |
40 } | |
41 } | |
42 return 0; | |
43 } | |
OLD | NEW |