Changeset 74359c6 in mainline


Ignore:
Timestamp:
2006-12-30T13:36:13Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
33c0c649
Parents:
66eb2c8
Message:

Improve comments and fix formatting in (sparc64) TLS implementation.
Improve some comments and formatting in sparc64 uspace thread library
code.

Update required msim version.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/doc/arch/mips32

    r66eb2c8 r74359c6  
    1515
    1616EMULATORS AND VIRTUALIZERS
    17         o msim 1.2.8
     17        o msim 1.2.12
    1818        o gxemul - both big and little endian
    1919        o simics 2.2.19
  • uspace/libc/arch/sparc64/include/thread.h

    r66eb2c8 r74359c6  
    3434 * @file
    3535 * @brief       sparc64 TLS functions.
    36  *
    37  * The implementation is based on the IA-32 implementation which was also
    38  * designed by Sun and is virtually the same, except the TCB is stored in
    39  * %g7 (of the normal set).
    4036 */
    4137
  • uspace/libc/arch/sparc64/src/psthread.S

    r66eb2c8 r74359c6  
    2929#include <libarch/context_offset.h>
    3030
    31 /**
    32  * Both context_save_arch() and context_restore_arch() are
    33  * leaf-optimized procedures. This kind of optimization
    34  * is very important and prevents any implicit window
    35  * spill/fill/clean traps in these very core kernel
    36  * functions.
    37  */
    38        
    3931.text   
    4032
  • uspace/libc/arch/sparc64/src/thread.c

    r66eb2c8 r74359c6  
    3838#include <malloc.h>
    3939
    40 /** Allocate TLS & TCB for initial module threads
     40/*
     41 * sparc64 uses thread-local storage data structures, variant II, as described
     42 * in:
     43 *      Drepper U.: ELF Handling For Thread-Local Storage, 2005
     44 */
     45
     46/** Allocate TLS variant II data structures for a thread.
    4147 *
    42  * @param data Start of data section
    43  * @return pointer to tcb_t structure
     48 * Only static model is supported.
     49 *
     50 * @param data Pointer to pointer to thread local data. This is actually an
     51 *      output argument.
     52 * @param size Size of thread local data.
     53 * @return Pointer to TCB structure.
    4454 */
    4555tcb_t * __alloc_tls(void **data, size_t size)
     
    5565}
    5666
     67/** Free TLS variant II data structures of a thread.
     68 *
     69 * Only static model is supported.
     70 *
     71 * @param tcb Pointer to TCB structure.
     72 * @param size Size of thread local data.
     73 */
    5774void __free_tls_arch(tcb_t *tcb, size_t size)
    5875{
    59         void *start = ((void *)tcb) - size;
     76        void *start = ((void *) tcb) - size;
    6077        free(start);
    6178}
  • uspace/libc/generic/thread.c

    r66eb2c8 r74359c6  
    5656extern char _tbss_end;
    5757
    58 /** Create Thread Local storage area, return pointer to TCB(ThreadControlBlock)
     58/** Create TLS (Thread Local Storage) data structures.
    5959 *
    60  * !! The code requires, that sections .tdata and .tbss are adjacent.
    61  *    It may be changed in the future.
     60 * The code requires, that sections .tdata and .tbss are adjacent. It may be
     61 * changed in the future.
     62 *
     63 * @return Pointer to TCB.
    6264 */
    63 tcb_t * __make_tls(void)
     65tcb_t *__make_tls(void)
    6466{
    6567        void *data;
     
    6971        tcb = __alloc_tls(&data, tls_size);
    7072       
     73        /*
     74         * Copy thread local data from the initialization image.
     75         */
    7176        memcpy(data, &_tdata_start, &_tdata_end - &_tdata_start);
    72         memset(data + (&_tbss_start-&_tdata_start), 0, &_tbss_end-&_tbss_start);
     77        /*
     78         * Zero out the thread local uninitialized data.
     79         */
     80        memset(data + (&_tbss_start - &_tdata_start), 0, &_tbss_end -
     81                &_tbss_start);
     82
    7383        return tcb;
    7484}
     
    8898 *
    8999 * @param uarg Pointer to userspace argument structure.
    90  *
    91  * TODO: Thread stack pages memory leak
    92100 */
    93101void __thread_main(uspace_arg_t *uarg)
     
    125133        uspace_arg_t *uarg;
    126134
    127         stack = (char *) malloc(getpagesize()*THREAD_INITIAL_STACK_PAGES_NO);
     135        stack = (char *) malloc(getpagesize() * THREAD_INITIAL_STACK_PAGES_NO);
    128136        if (!stack)
    129137                return -1;
Note: See TracChangeset for help on using the changeset viewer.