Subversion Repositories HelenOS

Rev

Rev 2927 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2927 Rev 3589
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (c) 2006 Ondrej Palkovsky
2
 * Copyright (c) 2006 Ondrej Palkovsky
-
 
3
 * Copyright (c) 2008 Jiri Svoboda
3
 * All rights reserved.
4
 * All rights reserved.
4
 *
5
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * are met:
Line 31... Line 32...
31
 */
32
 */
32
/** @file
33
/** @file
33
 */
34
 */
34
 
35
 
35
#include <tls.h>
36
#include <tls.h>
-
 
37
#include <align.h>
36
#include <sys/types.h>
38
#include <sys/types.h>
37
 
39
 
38
tcb_t * __alloc_tls(void **data, size_t size)
40
tcb_t * __alloc_tls(void **data, size_t size)
39
{
41
{
40
    return tls_alloc_variant_1(data, size);
42
    return tls_alloc_variant_1(data, size);
Line 43... Line 45...
43
void __free_tls_arch(tcb_t *tcb, size_t size)
45
void __free_tls_arch(tcb_t *tcb, size_t size)
44
{
46
{
45
    tls_free_variant_1(tcb, size);
47
    tls_free_variant_1(tcb, size);
46
}
48
}
47
 
49
 
-
 
50
static 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
 
-
 
62
typedef struct {
-
 
63
    unsigned long int ti_module;
-
 
64
    unsigned long int ti_offset;
-
 
65
} tls_index;
-
 
66
 
-
 
67
void *__tls_get_addr(tls_index *ti);
-
 
68
 
-
 
69
/* ppc32 uses TLS variant 1 */
-
 
70
void *__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
 
48
/** @}
81
/** @}
49
 */
82
 */