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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [linux/] [crt0.c] - Diff between revs 1010 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1010 Rev 1765
/* libc/sys/linux/crt0.c - Run-time initialization */
/* libc/sys/linux/crt0.c - Run-time initialization */
 
 
/* FIXME: This should be rewritten in assembler and
/* FIXME: This should be rewritten in assembler and
          placed in a subdirectory specific to a platform.
          placed in a subdirectory specific to a platform.
          There should also be calls to run constructors. */
          There should also be calls to run constructors. */
 
 
/* Written 2000 by Werner Almesberger */
/* Written 2000 by Werner Almesberger */
 
 
 
 
#include <stdlib.h>
#include <stdlib.h>
 
 
 
 
extern char **environ;
extern char **environ;
 
 
extern int main(int argc,char **argv,char **envp);
extern int main(int argc,char **argv,char **envp);
 
 
 
 
void _start(int args)
void _start(int args)
{
{
    /*
    /*
     * The argument block begins above the current stack frame, because we
     * The argument block begins above the current stack frame, because we
     * have no return address. The calculation assumes that sizeof(int) ==
     * have no return address. The calculation assumes that sizeof(int) ==
     * sizeof(void *). This is okay for i386 user space, but may be invalid in
     * sizeof(void *). This is okay for i386 user space, but may be invalid in
     * other cases.
     * other cases.
     */
     */
    int *params = &args-1;
    int *params = &args-1;
    int argc = *params;
    int argc = *params;
    char **argv = (char **) (params+1);
    char **argv = (char **) (params+1);
 
 
    environ = argv+argc+1;
    environ = argv+argc+1;
    exit(main(argc,argv,environ));
    exit(main(argc,argv,environ));
}
}
 
 

powered by: WebSVN 2.1.0

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