Subversion Repositories Kolibri OS

Rev

Rev 4874 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #include <newlib.h>
  2.  
  3. void init_reent();
  4.  
  5. void   _exit(int __status) __attribute__((noreturn));
  6.  
  7. void  __attribute__((noreturn))
  8. __thread_startup (int (*entry)(void*), void *param,
  9.                   void *stacklow, void *stackhigh)
  10. {
  11.     int retval;
  12.  
  13.     __asm__ __volatile__(               // save stack limits
  14.     "movl %0, %%fs:8    \n\t"           // use TLS
  15.     "movl %1, %%fs:12    \n\t"
  16.     ::"r"(stacklow), "r"(stackhigh));
  17.  
  18.     init_reent();                       // initialize thread reentry structure
  19.  
  20.     retval = entry(param);              // call user thread function
  21.  
  22.     _exit(retval);
  23. };
  24.  
  25.