OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" | 5 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h" | 8 #include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h" |
9 #include "mojo/public/c/system/types.h" | 9 #include "mojo/public/c/system/types.h" |
10 #include "native_client/src/public/irt_core.h" | 10 #include "native_client/src/public/irt_core.h" |
11 #include "native_client/src/public/nonsfi/elf_loader.h" | 11 #include "native_client/src/public/nonsfi/elf_loader.h" |
12 | 12 |
13 namespace nacl { | 13 namespace nacl { |
14 | 14 |
15 void MojoLaunchNexeNonsfi(int nexe_fd, MojoHandle initial_handle) { | 15 void MojoLaunchNexeNonsfi(int nexe_fd, MojoHandle initial_handle, |
| 16 bool enable_translate_irt) { |
16 // Run -- also, closes the nexe_fd, removing the temp file. | 17 // Run -- also, closes the nexe_fd, removing the temp file. |
17 uintptr_t entry = NaClLoadElfFile(nexe_fd); | 18 uintptr_t entry = NaClLoadElfFile(nexe_fd); |
18 | 19 |
| 20 // Enable the translation section of the IRT, if requested. |
| 21 if (enable_translate_irt) { |
| 22 MojoPnaclTranslatorEnable(); |
| 23 } |
19 MojoSetInitialHandle(initial_handle); | 24 MojoSetInitialHandle(initial_handle); |
20 int argc = 1; | 25 int argc = 1; |
21 char* argvp = const_cast<char*>("NaClMain"); | 26 char* argvp = const_cast<char*>("NaClMain"); |
22 char* envp = nullptr; | 27 char* envp = nullptr; |
23 nacl_irt_nonsfi_entry(argc, &argvp, &envp, | 28 nacl_irt_nonsfi_entry(argc, &argvp, &envp, |
24 reinterpret_cast<nacl_entry_func_t>(entry), | 29 reinterpret_cast<nacl_entry_func_t>(entry), |
25 MojoIrtNonsfiQuery); | 30 MojoIrtNonsfiQuery); |
26 abort(); | 31 abort(); |
27 NOTREACHED(); | 32 NOTREACHED(); |
28 } | 33 } |
29 | 34 |
30 } // namespace nacl | 35 } // namespace nacl |
OLD | NEW |