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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [libgloss/] [arm/] [linux-crt0.c] - Blame information for rev 295

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/** Linux startup code for the ARM processor.
2
 * Written by Shaun Jackman <sjackman@gmail.com>.
3
 * Copyright 2006 Pathway Connectivity
4
 *
5
 * Permission to use, copy, modify, and distribute this software
6
 * is freely granted, provided that this notice is preserved.
7
 */
8
 
9
#include <stdlib.h>
10
#include <unistd.h>
11
 
12
static int _main(int argc, char *argv[]) __attribute__((noreturn));
13
 
14
#if __thumb__ && !__thumb2__
15
asm("\n"
16
        ".code 32\n"
17
        ".global _start\n"
18
        ".type _start, %function\n"
19
        "_start:\n"
20
        "\tadr r0, _start_thumb+1\n"
21
        "\tbx r0\n"
22
        ".size _start, .-_start\n");
23
 
24
__attribute__((naked, used))
25
static void _start_thumb(void)
26
#else
27
__attribute__((naked))
28
void _start(void)
29
#endif
30
{
31
        register int *sp asm("sp");
32
        _main(*sp, (char **)(sp + 1));
33
}
34
 
35
static int _main(int argc, char *argv[])
36
{
37
        environ = argv + argc + 1;
38
        exit(main(argc, argv, environ));
39
}

powered by: WebSVN 2.1.0

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