Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 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/trusted/service_runtime/sel_main_chrome.h" | 7 #include "native_client/src/trusted/service_runtime/sel_main_chrome.h" |
| 8 | 8 |
| 9 #include "native_client/src/include/portability.h" | 9 #include "native_client/src/include/portability.h" |
| 10 #include "native_client/src/include/portability_io.h" | 10 #include "native_client/src/include/portability_io.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "native_client/src/trusted/desc/nacl_desc_io.h" | 23 #include "native_client/src/trusted/desc/nacl_desc_io.h" |
| 24 #include "native_client/src/trusted/fault_injection/fault_injection.h" | 24 #include "native_client/src/trusted/fault_injection/fault_injection.h" |
| 25 #include "native_client/src/trusted/gio/gio_nacl_desc.h" | 25 #include "native_client/src/trusted/gio/gio_nacl_desc.h" |
| 26 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" | 26 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" |
| 27 #include "native_client/src/trusted/service_runtime/nacl_globals.h" | 27 #include "native_client/src/trusted/service_runtime/nacl_globals.h" |
| 28 #include "native_client/src/trusted/service_runtime/env_cleanser.h" | 28 #include "native_client/src/trusted/service_runtime/env_cleanser.h" |
| 29 #include "native_client/src/trusted/service_runtime/nacl_app.h" | 29 #include "native_client/src/trusted/service_runtime/nacl_app.h" |
| 30 #include "native_client/src/trusted/service_runtime/nacl_all_modules.h" | 30 #include "native_client/src/trusted/service_runtime/nacl_all_modules.h" |
| 31 #include "native_client/src/trusted/service_runtime/nacl_debug_init.h" | 31 #include "native_client/src/trusted/service_runtime/nacl_debug_init.h" |
| 32 #include "native_client/src/trusted/service_runtime/nacl_signal.h" | 32 #include "native_client/src/trusted/service_runtime/nacl_signal.h" |
| 33 #include "native_client/src/trusted/service_runtime/nacl_text.h" | |
| 33 #include "native_client/src/trusted/service_runtime/osx/mach_exception_handler.h " | 34 #include "native_client/src/trusted/service_runtime/osx/mach_exception_handler.h " |
| 34 #include "native_client/src/trusted/service_runtime/sel_addrspace.h" | 35 #include "native_client/src/trusted/service_runtime/sel_addrspace.h" |
| 35 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 36 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| 36 #include "native_client/src/trusted/service_runtime/sel_qualify.h" | 37 #include "native_client/src/trusted/service_runtime/sel_qualify.h" |
| 37 #include "native_client/src/trusted/service_runtime/win/exception_patch/ntdll_pa tch.h" | 38 #include "native_client/src/trusted/service_runtime/win/exception_patch/ntdll_pa tch.h" |
| 38 | 39 |
| 39 struct NaClChromeMainArgs *NaClChromeMainArgsCreate(void) { | 40 struct NaClChromeMainArgs *NaClChromeMainArgsCreate(void) { |
| 40 struct NaClChromeMainArgs *args = malloc(sizeof(*args)); | 41 struct NaClChromeMainArgs *args = malloc(sizeof(*args)); |
| 41 if (args == NULL) | 42 if (args == NULL) |
| 42 return NULL; | 43 return NULL; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 } | 275 } |
| 275 | 276 |
| 276 /* | 277 /* |
| 277 * error reporting done; can quit now if there was an error earlier. | 278 * error reporting done; can quit now if there was an error earlier. |
| 278 */ | 279 */ |
| 279 if (LOAD_OK != errcode) { | 280 if (LOAD_OK != errcode) { |
| 280 goto done; | 281 goto done; |
| 281 } | 282 } |
| 282 | 283 |
| 283 /* Load the integrated runtime (IRT) library. */ | 284 /* Load the integrated runtime (IRT) library. */ |
| 284 NaClLoadIrt(nap, args->irt_fd); | 285 /* We check if there is a segment gap before trying to load the IRT. This |
|
Mark Seaborn
2012/06/28 22:05:11
The comment style is
/*
* blah
* blah
*/
Can y
jvoung (off chromium)
2012/06/28 22:41:56
Done.
| |
| 286 * is to support IRT-less / segment-gap-free PNaCl translator nexes. | |
| 287 * We should plumb through a flag from Chrome in such cases, instead of | |
|
Mark Seaborn
2012/06/28 22:05:11
Can you make this: "TODO(mseaborn): Plumb through
jvoung (off chromium)
2012/06/28 22:41:56
Done.
| |
| 288 * looking for the absence of a segment gap, to provide better diagnostics | |
| 289 * when the linker did not create a segment gap! | |
| 290 */ | |
| 291 if (NaClHasSegmentGapForDyncode(nap)) { | |
| 292 NaClLoadIrt(nap, args->irt_fd); | |
| 293 } else { | |
| 294 NaClLog(LOG_WARNING, | |
| 295 "NaCl app doesn't have a segment gap, not loading IRT.\n" | |
|
Mark Seaborn
2012/06/28 22:05:11
'executable' rather than 'app'? "Main executable
jvoung (off chromium)
2012/06/28 22:41:56
Done.
| |
| 296 "This is expected for PNaCl's translator nexes.\n"); | |
| 297 } | |
| 285 | 298 |
| 286 NaClEnvCleanserCtor(&env_cleanser, 1); | 299 NaClEnvCleanserCtor(&env_cleanser, 1); |
| 287 if (!NaClEnvCleanserInit(&env_cleanser, envp, NULL)) { | 300 if (!NaClEnvCleanserInit(&env_cleanser, envp, NULL)) { |
| 288 NaClLog(LOG_FATAL, "Failed to initialise env cleanser\n"); | 301 NaClLog(LOG_FATAL, "Failed to initialise env cleanser\n"); |
| 289 } | 302 } |
| 290 | 303 |
| 291 if (!NaClAppLaunchServiceThreads(nap)) { | 304 if (!NaClAppLaunchServiceThreads(nap)) { |
| 292 fprintf(stderr, "Launch service threads failed\n"); | 305 fprintf(stderr, "Launch service threads failed\n"); |
| 293 goto done; | 306 goto done; |
| 294 } | 307 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 if (LOAD_OK != errcode) { | 345 if (LOAD_OK != errcode) { |
| 333 NaClBlockIfCommandChannelExists(nap); | 346 NaClBlockIfCommandChannelExists(nap); |
| 334 } | 347 } |
| 335 | 348 |
| 336 done_ctor: | 349 done_ctor: |
| 337 | 350 |
| 338 NaClAllModulesFini(); | 351 NaClAllModulesFini(); |
| 339 | 352 |
| 340 NaClExit(ret_code); | 353 NaClExit(ret_code); |
| 341 } | 354 } |
| OLD | NEW |