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/sparc64/src/thread.c

    r941cc8b r2c2295ab  
    3737#include <thread.h>
    3838#include <malloc.h>
     39#include <align.h>
    3940
    4041/*
     
    5758        tcb_t *tcb;
    5859       
    59         *data = malloc(sizeof(tcb_t) + size);
     60        size = ALIGN_UP(size, &_tls_alignment);
     61        *data = memalign(&_tls_alignment, sizeof(tcb_t) + size);
    6062
    6163        tcb = (tcb_t *) (*data + size);
     
    7476void __free_tls_arch(tcb_t *tcb, size_t size)
    7577{
     78        size = ALIGN_UP(size, &_tls_alignment);
    7679        void *start = ((void *) tcb) - size;
    7780        free(start);
Note: See TracChangeset for help on using the changeset viewer.