Rev 3065 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3065 | Rev 3593 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | { |
52 | { |
53 | return NULL; |
53 | return NULL; |
54 | } |
54 | } |
Line 55... | Line 55... | ||
55 | 55 | ||
56 | void __main (){}; |
- | |
57 | void init_reent(); |
- | |
58 | - | ||
59 | void __attribute__((noreturn)) |
- | |
60 | __thread_startup (int (*entry)(void*), void *param, |
- | |
61 | void *stacklow, void *stackhigh) |
- | |
62 | { |
- | |
63 | int retval; |
- | |
64 | - | ||
65 | __asm__ __volatile__( // save stack limits |
- | |
66 | "movl %0, %%fs:4 \n\t" // use TLS |
- | |
67 | "movl %1, %%fs:8 \n\t" |
- | |
68 | ::"r"(stacklow), "r"(stackhigh)); |
- | |
69 | - | ||
70 | init_reent(); // initialize thread reentry structure |
- | |
71 | - | ||
72 | retval = entry(param); // call user thread function |
- | |
73 | - | ||
74 | _exit(retval); |
- | |
Line 75... | Line 56... | ||
75 | }; |
56 | void __main (){}; |
76 | 57 | ||
77 | struct app_hdr |
58 | struct app_hdr |
78 | { |
59 | { |
Line 84... | Line 65... | ||
84 | int stacktop; |
65 | int stacktop; |
85 | char *cmdline; |
66 | char *cmdline; |
86 | char *path; |
67 | char *path; |
87 | }; |
68 | }; |
Line -... | Line 69... | ||
- | 69 | ||
- | 70 | typedef void (*ctp)(); |
|
- | 71 | static void __do_global_ctors () |
|
- | 72 | { |
|
- | 73 | extern int __CTOR_LIST__; |
|
- | 74 | int *c = &__CTOR_LIST__; |
|
- | 75 | c++; |
|
- | 76 | while (*c) |
|
- | 77 | { |
|
- | 78 | ctp d = (ctp)*c; |
|
- | 79 | (d)(); |
|
- | 80 | c++; |
|
- | 81 | } |
|
Line 88... | Line 82... | ||
88 | 82 | } |
|
89 | 83 | ||
90 | void __attribute__((noreturn)) |
84 | void __attribute__((noreturn)) |
91 | __crt_startup (void) |
85 | __crt_startup (void) |
Line 100... | Line 94... | ||
100 | * Initialize floating point unit. |
94 | * Initialize floating point unit. |
101 | */ |
95 | */ |
102 | __cpu_features_init (); /* Do we have SSE, etc.*/ |
96 | __cpu_features_init (); /* Do we have SSE, etc.*/ |
103 | // _fpreset (); /* Supplied by the runtime library. */ |
97 | // _fpreset (); /* Supplied by the runtime library. */ |
Line 104... | Line 98... | ||
104 | 98 | ||
Line 105... | Line 99... | ||
105 | __initPOSIXHandles(); |
99 | __do_global_ctors(); |
106 | 100 | ||
107 | __appcwdlen = strrchr(&__pgmname, '/') - &__pgmname + 1; |
101 | __appcwdlen = strrchr(&__pgmname, '/') - &__pgmname + 1; |
108 | __appcwdlen = __appcwdlen > 1023 ? 1023 : __appcwdlen; |
102 | __appcwdlen = __appcwdlen > 1023 ? 1023 : __appcwdlen; |