Last change
on this file since 612 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
910 bytes
|
Line | |
---|
1 | /** 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 | #include "arm.h" |
---|
12 | |
---|
13 | static int _main(int argc, char *argv[]) __attribute__((noreturn)); |
---|
14 | |
---|
15 | #if __thumb__ && !defined(PREFER_THUMB) |
---|
16 | asm("\n" |
---|
17 | ".code 32\n" |
---|
18 | ".global _start\n" |
---|
19 | ".type _start, %function\n" |
---|
20 | "_start:\n" |
---|
21 | "\tldr r0, .LC0\n" |
---|
22 | "\tbx r0\n" |
---|
23 | ".LC0:\n" |
---|
24 | "\t.word _start_thumb\n" |
---|
25 | ".size _start, .-_start\n"); |
---|
26 | |
---|
27 | __attribute__((naked, used)) |
---|
28 | static void _start_thumb(void) |
---|
29 | #else |
---|
30 | __attribute__((naked)) |
---|
31 | void _start(void) |
---|
32 | #endif |
---|
33 | { |
---|
34 | register int *sp asm("sp"); |
---|
35 | _main(*sp, (char **)(sp + 1)); |
---|
36 | } |
---|
37 | |
---|
38 | static int _main(int argc, char *argv[]) |
---|
39 | { |
---|
40 | environ = argv + argc + 1; |
---|
41 | exit(main(argc, argv, environ)); |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.