kolibrios/contrib/sdk/sources/newlib/libc/crt/crt2.c
Sergey Semyonov (Serge) 0b1b135336 newlib: 1)native console support for printf.c() and puts.c()
2)static libc and linking against static libraries

git-svn-id: svn://kolibrios.org@6068 a494cfbc-eb01-0410-851d-a64ba20cac60
2016-01-18 02:22:44 +00:00

25 lines
629 B
C

#include <newlib.h>
void init_reent();
void _exit(int __status) __attribute__((noreturn));
void __attribute__((noreturn))
__thread_startup (int (*entry)(void*), void *param,
void *stacklow, void *stackhigh)
{
int retval;
__asm__ __volatile__( // save stack limits
"movl %0, %%fs:8 \n\t" // use TLS
"movl %1, %%fs:12 \n\t"
::"r"(stacklow), "r"(stackhigh));
init_reent(); // initialize thread reentry structure
retval = entry(param); // call user thread function
_exit(retval);
};