Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 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 <assert.h> | 7 #include <assert.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include "native_client/src/include/elf32.h" | 10 #include "native_client/src/include/elf32.h" |
| 11 #include "native_client/src/include/elf_auxv.h" | 11 #include "native_client/src/include/elf_auxv.h" |
| 12 #include "native_client/src/shared/ppapi_proxy/ppruntime.h" | |
| 12 #include "native_client/src/untrusted/irt/irt_interfaces.h" | 13 #include "native_client/src/untrusted/irt/irt_interfaces.h" |
| 13 #include "native_client/src/untrusted/nacl/nacl_irt.h" | 14 #include "native_client/src/untrusted/nacl/nacl_irt.h" |
| 14 #include "native_client/src/untrusted/nacl/nacl_startup.h" | 15 #include "native_client/src/untrusted/nacl/nacl_startup.h" |
| 15 | 16 |
| 16 void __libc_init_array(void) __attribute__((weak)); | 17 void __libc_init_array(void) __attribute__((weak)); |
| 17 void _init(void) __attribute__((weak)); | 18 void _init(void) __attribute__((weak)); |
| 18 | 19 |
| 19 void __pthread_initialize(void); | 20 void __pthread_initialize(void); |
| 20 | 21 |
| 21 /* | 22 /* |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 } | 62 } |
| 62 void (*user_start)(uint32_t *) = (void (*)(uint32_t *)) entry->a_un.a_val; | 63 void (*user_start)(uint32_t *) = (void (*)(uint32_t *)) entry->a_un.a_val; |
| 63 | 64 |
| 64 /* | 65 /* |
| 65 * The user application does not need to see the AT_ENTRY item. | 66 * The user application does not need to see the AT_ENTRY item. |
| 66 * Reuse the auxv slot and overwrite it with the IRT query function. | 67 * Reuse the auxv slot and overwrite it with the IRT query function. |
| 67 */ | 68 */ |
| 68 entry->a_type = AT_SYSINFO; | 69 entry->a_type = AT_SYSINFO; |
| 69 entry->a_un.a_val = (uintptr_t) nacl_irt_interface; | 70 entry->a_un.a_val = (uintptr_t) nacl_irt_interface; |
| 70 | 71 |
| 72 #ifdef IRT_PPAPI | |
| 73 if (PpapiPluginPreInit()) { | |
|
Roland McGrath
2011/08/12 16:44:56
Don't do this here. It could be in a constructor
halyavin
2011/08/15 10:35:52
I implemented this as a constructor.
| |
| 74 static const char fatal_msg[] = | |
| 75 "ppapi initialization (PpapiPluginPreInit) failed.\n"; | |
| 76 write(2, fatal_msg, sizeof(fatal_msg) - 1); | |
| 77 _exit(-1); | |
| 78 } | |
| 79 #endif | |
| 80 | |
| 71 /* | 81 /* |
| 72 * Call the user entry point function. It should not return. | 82 * Call the user entry point function. It should not return. |
| 73 */ | 83 */ |
| 74 (*user_start)(info); | 84 (*user_start)(info); |
| 75 | 85 |
| 76 /* | 86 /* |
| 77 * But just in case it does... | 87 * But just in case it does... |
| 78 */ | 88 */ |
| 79 _exit(0); | 89 _exit(0); |
| 80 } | 90 } |
| 81 | 91 |
| 82 /* | 92 /* |
| 83 * This is never actually called, but there is an artificial undefined | 93 * This is never actually called, but there is an artificial undefined |
| 84 * reference to it. | 94 * reference to it. |
| 85 */ | 95 */ |
| 86 int main(void) { | 96 int main(void) { |
| 87 } | 97 } |
| OLD | NEW |