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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [linux/] [machine/] [i386/] [crt0.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* 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
#include <time.h>
12
#include <string.h>
13
 
14
 
15
extern char **environ;
16
 
17
extern int main(int argc,char **argv,char **envp);
18
 
19
extern char _end;
20
extern char __bss_start;
21
 
22
void _start(int args)
23
{
24
    /*
25
     * The argument block begins above the current stack frame, because we
26
     * have no return address. The calculation assumes that sizeof(int) ==
27
     * sizeof(void *). This is okay for i386 user space, but may be invalid in
28
     * other cases.
29
     */
30
    int *params = &args-1;
31
    int argc = *params;
32
    char **argv = (char **) (params+1);
33
 
34
    environ = argv+argc+1;
35
 
36
    /* Note: do not clear the .bss section.  When running with shared
37
     *       libraries, certain data items such __mb_cur_max or environ
38
     *       may get placed in the .bss, even though they are initialized
39
     *       to non-zero values.  Clearing the .bss will end up zeroing
40
     *       out their initial values.  The .bss is already initialized
41
     *       by this time by Linux.  */
42
 
43
    tzset(); /* initialize timezone info */
44
    exit(main(argc,argv,environ));
45
}

powered by: WebSVN 2.1.0

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