Changeset 1ea99cc in mainline for uspace/lib/libc/arch/ppc32/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/ppc32/src/tls.c

    r24edc18 r1ea99cc  
    11/*
    22 * Copyright (c) 2006 Ondrej Palkovsky
     3 * Copyright (c) 2008 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    3435
    3536#include <tls.h>
     37#include <align.h>
    3638#include <sys/types.h>
    3739
     
    4648}
    4749
     50static void kputint(unsigned i)
     51{
     52        asm volatile (
     53                "mr %%r3, %0\n"
     54                "li %%r9, 32\n"
     55                "sc\n"
     56                :
     57                : "r" (i)
     58                : "%r3","%r9"
     59        ) ;
     60}
     61
     62typedef struct {
     63        unsigned long int ti_module;
     64        unsigned long int ti_offset;
     65} tls_index;
     66
     67void *__tls_get_addr(tls_index *ti);
     68
     69/* ppc32 uses TLS variant 1 */
     70void *__tls_get_addr(tls_index *ti)
     71{
     72        uint8_t *tls;
     73
     74        /* The TLS section is just after TCB */
     75        tls = (uint8_t *)__tcb_get() + sizeof(tcb_t);
     76
     77        /* Hopefully this is right. No docs found. */
     78        return tls + ti->ti_offset + 32768;
     79}
     80
    4881/** @}
    4982 */
Note: See TracChangeset for help on using the changeset viewer.