1570af302Sopenharmony_ci#include <string.h> 2570af302Sopenharmony_ci#include "pthread_impl.h" 3570af302Sopenharmony_ci#include "libc.h" 4570af302Sopenharmony_ci 5570af302Sopenharmony_civoid __reset_tls() 6570af302Sopenharmony_ci{ 7570af302Sopenharmony_ci pthread_t self = __pthread_self(); 8570af302Sopenharmony_ci struct tls_module *p; 9570af302Sopenharmony_ci size_t i, n = self->dtv[0]; 10570af302Sopenharmony_ci if (n) for (p=libc.tls_head, i=1; i<=n; i++, p=p->next) { 11570af302Sopenharmony_ci char *mem = (char *)(self->dtv[i] - DTP_OFFSET); 12570af302Sopenharmony_ci memcpy(mem, p->image, p->len); 13570af302Sopenharmony_ci memset(mem+p->len, 0, p->size - p->len); 14570af302Sopenharmony_ci } 15570af302Sopenharmony_ci} 16