OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [linux/] [crt0.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
/* libc/sys/linux/crt0.c - Run-time initialization */
2
 
3
/* FIXME: This should be rewritten in assembler and
4
          placed in a subdirectory specific to a platform.
5
          There should also be calls to run constructors. */
6
 
7
/* Written 2000 by Werner Almesberger */
8
 
9
 
10
#include <stdlib.h>
11
 
12
 
13
extern char **environ;
14
 
15
extern int main(int argc,char **argv,char **envp);
16
 
17
 
18
void _start(int args)
19
{
20
    /*
21
     * The argument block begins above the current stack frame, because we
22
     * have no return address. The calculation assumes that sizeof(int) ==
23
     * sizeof(void *). This is okay for i386 user space, but may be invalid in
24
     * other cases.
25
     */
26
    int *params = &args-1;
27
    int argc = *params;
28
    char **argv = (char **) (params+1);
29
 
30
    environ = argv+argc+1;
31
    exit(main(argc,argv,environ));
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.