Changeset c880421 in mainline for uspace/lib/c/generic/thread/tls.c


Ignore:
Timestamp:
2025-01-25T21:22:04Z (11 days ago)
Author:
Matěj Volf <git@…>
Parents:
4ef27eb
Message:

fix comments based on improved understanding

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/thread/tls.c

    r4ef27eb rc880421  
    104104        assert(tls_align <= PAGE_SIZE);
    105105
     106        /*
     107         * FIXME: the calculation of alloc_size shouldn't include the alignment
     108         * of tcb_t (at least in Variant II)
     109         * See https://github.com/HelenOS/helenos/pull/240/files/4ef27ebf98a0656e09889b7d00efdec03343f1aa#r1929592924
     110         * (you will also need to fix _tcb_data_offset)
     111         */
     112
    106113#ifdef CONFIG_TLS_VARIANT_1
    107114        size_t alloc_size =
     
    132139        uintptr_t bias = elf_get_bias(elf);
    133140
    134         /*
    135          * FIXME: I couldn't convince myself this is correct, but I couldn't
    136          * find a case where it breaks either: if the actual alloc_size is
    137          * bigger than the requested size (tls->p_memsz), the alignment padding
    138          * will be placed at the beginning (because TLS is (at least sometimes?)
    139          * indexed with negative offsets from the TCB pointer).
    140          *
    141          * Now we will copy the initialization data to a position at the start of
    142          * the allocation, so if the padding has nonzero size, if think the initialization
    143          * data is now incorrectly offset by its size?
    144          *
    145          * Maybe a diagram helps explaining this?
    146          * |    allocation   |     |
    147          * | paddding | data | tcb |
    148          *   ^
    149          *   +--- we will copy the initialization data here
    150          *              ^
    151          *              +--- but the data should be actually here?
    152          */
    153 
    154141        /* Copy thread local data from the initialization image. */
    155142        memcpy(data, (void *)(tls->p_vaddr + bias), tls->p_filesz);
Note: See TracChangeset for help on using the changeset viewer.