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: src/untrusted/nacl/start.c

Issue 7276050: Change startup ABI for untrusted code to be C-compatible (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: disable bogus stack_frame.cc test for now Created 9 years, 5 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
« no previous file with comments | « src/untrusted/nacl/pthread_initialize_minimal.c ('k') | src/untrusted/stubs/crt1.x » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
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
4 * found in the LICENSE file.
5 */
6
7 #include <unistd.h>
8
9 #include "native_client/src/include/elf32.h"
10 #include "native_client/src/untrusted/nacl/nacl_irt.h"
11 #include "native_client/src/untrusted/nacl/nacl_startup.h"
12
13
14 void __libc_init_array(void);
15 void __libc_fini_array(void);
16
17 void __pthread_initialize(void);
18 void __pthread_shutdown(void);
19
20 int main(int argc, char **argv, char **envp);
21
22 /*
23 * This is the true entry point for untrusted code.
24 * See nacl_startup.h for the layout at the argument pointer.
25 */
26 void _start(uint32_t *info) {
27 void (*fini)(void) = nacl_startup_fini(info);
28 int argc = nacl_startup_argc(info);
29 char **argv = nacl_startup_argv(info);
30 char **envp = nacl_startup_envp(info);
31 Elf32_auxv_t *auxv = nacl_startup_auxv(info);
32
33 environ = envp;
34
35 __libnacl_irt_init(auxv);
36
37 /*
38 * If we were started by a dynamic linker, then it passed its finalizer
39 * function here. For static linking, this is always NULL.
40 */
41 if (fini != NULL)
42 atexit(fini);
43
44 atexit(&__libc_fini_array);
45
46 __pthread_initialize();
47 atexit(&__pthread_shutdown);
48
49 __libc_init_array();
50
51 exit(main(argc, argv, envp));
52
53 /*NOTREACHED*/
54 while (1) *(volatile int *) 0; /* Crash. */
55 }
OLDNEW
« no previous file with comments | « src/untrusted/nacl/pthread_initialize_minimal.c ('k') | src/untrusted/stubs/crt1.x » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698