wip commit.
[AROS.git] / arch / arm-native / kernel / tls.h
blobe409a939547dadc5d918bbc8ed04aea385b566ff
1 #ifndef ASM_TLS_H
2 #define ASM_TLS_H
4 typedef struct tls
6 struct ExecBase *SysBase;
7 void * *KernelBase; /* Base of kernel.resource */
8 struct Task *ThisTask; /* Currently running task on this core */
9 } tls_t;
11 #define TLS_OFFSET(name) ((char *)&(((tls_t *)0)->name)-(char *)0)
13 ////
15 #define TLS_PTR_GET() \
16 ({ \
17 tls_t *__tls; \
18 asm volatile("mrc p15, 0, %0, c13, c0, 3":"=r"(__tls)); \
19 __tls; \
22 #define TLS_GET(name) \
23 ({ \
24 tls_t *__tls; \
25 asm volatile("mrc p15, 0, %0, c13, c0, 3":"=r"(__tls)); \
26 typeof(__tls -> name) __ret = (__tls -> name); \
27 __ret; \
30 #define TLS_SET(name, val) \
31 do { \
32 tls_t *__tls; \
33 asm volatile("mrc p15, 0, %0, c13, c0, 3":"=r"(__tls)); \
34 (__tls -> name) = val; \
35 } while(0);
37 #endif