Indentation fix, cleanup.
[AROS.git] / arch / arm-native / kernel / tls.h
blobf8f6acf69544c2bd7ce51234545b991b9e8c74a1
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 ULONG ScheduleFlags;
10 BYTE IDNestCnt;
11 BYTE TDNestCnt;
12 } tls_t;
14 #define TLSSF_Quantum (1 << 0)
15 #define TLSSF_Switch (1 << 1)
16 #define TLSSF_Dispatch (1 << 2)
18 #define TLS_OFFSET(name) ((char *)&(((tls_t *)0)->name)-(char *)0)
20 ////
22 #define TLS_PTR_GET() \
23 ({ \
24 tls_t *__tls; \
25 asm volatile("mrc p15, 0, %0, c13, c0, 3":"=r"(__tls)); \
26 __tls; \
29 #define TLS_GET(name) \
30 ({ \
31 tls_t *__tls; \
32 asm volatile("mrc p15, 0, %0, c13, c0, 3":"=r"(__tls)); \
33 typeof(__tls -> name) __ret = (__tls -> name); \
34 __ret; \
37 #define TLS_SET(name, val) \
38 do { \
39 tls_t *__tls; \
40 asm volatile("mrc p15, 0, %0, c13, c0, 3":"=r"(__tls)); \
41 (__tls -> name) = val; \
42 } while(0);
44 #endif