Rev 5198 | Rev 6074 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5198 | Rev 6068 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | /* |
|
- | 2 | * crtdll.c |
|
- | 3 | * This file has no copyright assigned and is placed in the Public Domain. |
|
- | 4 | * This file is a part of the mingw-runtime package. |
|
- | 5 | * No warranty is given; refer to the file DISCLAIMER within the package. |
|
- | 6 | * |
|
- | 7 | * Source code for the shared libc startup proceedures. This code is compiled |
|
- | 8 | * to make libc.dll, which should be located in the library path. |
|
- | 9 | * |
|
- | 10 | */ |
|
Line 1... | Line 11... | ||
1 | #include <_ansi.h> |
11 | |
2 | #include |
12 | #include <_ansi.h> |
3 | #include |
13 | #include |
4 | #include |
14 | #include |
Line 36... | Line 46... | ||
36 | int __appenv_size; |
46 | char* __appenv; |
37 | 47 | int __appenv_size; |
|
Line 38... | Line 48... | ||
38 | extern char _tls_map[128]; |
48 | |
Line 39... | Line -... | ||
39 | - | ||
40 | void __attribute__((noreturn)) |
- | |
41 | __thread_startup (int (*entry)(void*), void *param, |
- | |
42 | void *stacklow, void *stackhigh) |
- | |
43 | { |
- | |
44 | int retval; |
- | |
45 | - | ||
46 | // asm volatile ( "xchgw %bx, %bx"); |
- | |
47 | - | ||
48 | __asm__ __volatile__( // save stack limits |
- | |
49 | "movl %0, %%fs:8 \n\t" // use TLS |
- | |
50 | "movl %1, %%fs:12 \n\t" |
- | |
51 | ::"r"(stacklow), "r"(stackhigh)); |
- | |
52 | - | ||
53 | init_reent(); // initialize thread reentry structure |
- | |
54 | - | ||
55 | retval = entry(param); // call user thread function |
- | |
56 | - | ||
57 | _exit(retval); |
- | |
58 | }; |
- | |
59 | 49 | extern char _tls_map[128]; |
|
60 | char * __libc_getenv(const char *name) |
50 | |
61 | { |
51 | char * __libc_getenv(const char *name) |
62 | return NULL; |
52 | { |
Line 190... | Line 180... | ||
190 | memset(_tls_map, 0xFF, 32*4); |
180 | |
191 | _tls_map[0] = 0xE0; |
181 | memset(_tls_map, 0xFF, 32*4); |
192 | init_reent(); |
182 | _tls_map[0] = 0xE0; |
193 | init_stdio(); |
183 | init_reent(); |
- | 184 | init_stdio(); |
|
Line 194... | Line 185... | ||
194 | 185 | __do_global_ctors(); |
|
Line 195... | Line 186... | ||
195 | // __appenv = load_file("/sys/system.env", &__appenv_size); |
186 | |
Line 219... | Line 210... | ||
219 | done: |
210 | retval = header->main(argc, argv, NULL); |
220 | exit (retval); |
211 | done: |
221 | } |
212 | exit (retval); |
222 | 213 | } |
|
Line 223... | Line -... | ||
223 | - |