2 * Copyright (c) 2022, Netflix, Inc.
4 * SPDX-License-Identifier: BSD-2-Clause
8 * MI part of the C startup code. We take a long * pointer (we assume long is
9 * the same size as a pointer, as the Linux world is wont to do). We get a
10 * pointer to the stack with the main args on it. We don't bother decoding the
11 * aux vector, but may need to do so in the future.
13 * The long *p points to:
15 * +--------------------+
16 * | argc | Small address
17 * +--------------------+
19 * +--------------------+
21 * +--------------------+
23 * +--------------------+
24 * | NULL | &argv[argc]
25 * +--------------------+
27 * +--------------------+
29 * +--------------------+
31 * +--------------------+
33 * +--------------------+
34 * | aux type | AT_xxxx
35 * +--------------------+
37 * +--------------------+
38 * | aux type | AT_xxxx
39 * +--------------------+
41 * +--------------------+
42 * | aux type | AT_xxxx
43 * +--------------------+
45 * +--------------------+
47 * +--------------------+
49 * +--------------------+
51 * The AUX vector contains additional information for the process to know from
52 * the kernel (not parsed currently). AT_xxxx constants are small (< 50).
55 extern void _start_c(long *);
56 extern int main(int, const char **, char **);
58 #include "start_arch.h"
68 argv = (const char **)(p + 1);
69 envp = (char **)argv + argc + 1;
71 /* Note: we don't ensure that fd 0, 1, and 2 are sane at this level */
72 /* Also note: we expect main to exit, not return off the end */
73 main(argc, argv, envp);