Ignore:
Timestamp:
2007-10-28T21:03:02Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8ecba18b
Parents:
941cc8b
Message:

For architectures that make use of TLS variant II (i.e. amd64, ia32 and
sparc64), fix the way TLS and TCB is allocated. Now, TLS is allocated using
memalign() with the alignment specified in _tls_alignment. Size of TLS data
itself is rounded up to be a multiple of _tls_alignment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/arch/amd64/src/thread.c

    r941cc8b r2c2295ab  
    3737#include <thread.h>
    3838#include <malloc.h>
     39#include <align.h>
    3940
    4041/** Allocate TLS & TCB for initial module threads
     
    4748        tcb_t *tcb;
    4849       
    49         *data = malloc(sizeof(tcb_t) + size);
     50        size = ALIGN_UP(size, &_tls_alignment);
     51        *data = memalign(&_tls_alignment, sizeof(tcb_t) + size);
    5052
    5153        tcb = (tcb_t *) (*data + size);
     
    5759void __free_tls_arch(tcb_t *tcb, size_t size)
    5860{
     61        size = ALIGN_UP(size, &_tls_alignment);
    5962        void *start = ((void *)tcb) - size;
    6063        free(start);
Note: See TracChangeset for help on using the changeset viewer.