Subversion Repositories HelenOS

Rev

Rev 2333 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2333 Rev 2335
Line 39... Line 39...
39
 
39
 
40
#define THREAD_INITIAL_STACK_PAGES_NO 1
40
#define THREAD_INITIAL_STACK_PAGES_NO 1
41
 
41
 
42
typedef struct {
42
typedef struct {
43
    void *pst_data;
43
    void *pst_data;
44
    /* TODO */
-
 
45
} tcb_t;
44
} tcb_t;
46
 
45
 
47
static inline void __tcb_set(tcb_t *tcb)
46
static inline void __tcb_set(tcb_t *tcb)
48
{
47
{
49
    void* tmp = (void*)tcb + sizeof(tcb_t);
48
    void *tls = (void *)tcb + sizeof(tcb_t);
50
    asm(
49
    asm volatile (
51
        "mov r9, %0"
50
        "mov r9, %0"
52
        :
51
        :
53
        : "r"(tmp)
52
        : "r"(tls)
54
    );
53
    );
55
}
54
}
56
 
55
 
57
static inline tcb_t *__tcb_get(void)
56
static inline tcb_t *__tcb_get(void)
58
{
57
{
59
    void* ret;
58
    void *ret;
60
    asm(
59
    asm volatile (
61
        "mov %0, r9"
60
        "mov %0, r9"
62
        : "=r"(ret)
61
        : "=r"(ret)
63
    );
62
    );
64
    ret -= sizeof(tcb_t);
63
    ret -= sizeof(tcb_t);
65
    return (tcb_t*)ret;
64
    return (tcb_t *)ret;
66
}
65
}
67
 
66
 
68
#endif
67
#endif
69
 
68
 
70
/** @}
69
/** @}