Changeset 1ea99cc in mainline for uspace/lib/libc/arch/ia32/src/tls.c


Ignore:
Timestamp:
2009-08-20T20:47:35Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b50b5af2
Parents:
24edc18
Message:

Merge changes from original Subversion dynload branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/arch/ia32/src/tls.c

    r24edc18 r1ea99cc  
    3737#include <tls.h>
    3838#include <sys/types.h>
     39#include <align.h>
    3940
    4041tcb_t * __alloc_tls(void **data, size_t size)
     
    4849}
    4950
     51//#ifdef __SHARED__
     52
     53typedef struct {
     54        unsigned long int ti_module;
     55        unsigned long int ti_offset;
     56} tls_index;
     57
     58void __attribute__ ((__regparm__ (1)))
     59    *___tls_get_addr(tls_index *ti);
     60
     61void __attribute__ ((__regparm__ (1)))
     62    *___tls_get_addr(tls_index *ti)
     63{
     64        size_t tls_size;
     65        uint8_t *tls;
     66
     67        /* Calculate size of TLS block */
     68        tls_size = ALIGN_UP(&_tbss_end - &_tdata_start, &_tls_alignment);
     69
     70        /* The TLS block is just before TCB */
     71        tls = (uint8_t *)__tcb_get() - tls_size;
     72
     73        return tls + ti->ti_offset;
     74}
     75
     76//#endif
     77
    5078/** @}
    5179 */
Note: See TracChangeset for help on using the changeset viewer.