Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef __ARCH_S390_PERCPU__ |
2 | #define __ARCH_S390_PERCPU__ | |
3 | ||
4 | #include <linux/compiler.h> | |
5 | #include <asm/lowcore.h> | |
6 | ||
1da177e4 LT |
7 | /* |
8 | * s390 uses its own implementation for per cpu data, the offset of | |
9 | * the cpu local data area is cached in the cpu's lowcore memory. | |
10 | * For 64 bit module code s390 forces the use of a GOT slot for the | |
11 | * address of the per cpu variable. This is needed because the module | |
12 | * may be more than 4G above the per cpu area. | |
13 | */ | |
14 | #if defined(__s390x__) && defined(MODULE) | |
15 | ||
f0343474 | 16 | #define SHIFT_PERCPU_PTR(ptr,offset) (({ \ |
a666ecfb | 17 | extern int simple_identifier_##var(void); \ |
632bbfee | 18 | unsigned long *__ptr; \ |
f0343474 | 19 | asm ( "larl %0, %1@GOTENT" \ |
20 | : "=a" (__ptr) : "X" (ptr) ); \ | |
21 | (typeof(ptr))((*__ptr) + (offset)); })) | |
1da177e4 LT |
22 | |
23 | #else | |
24 | ||
f0343474 | 25 | #define SHIFT_PERCPU_PTR(ptr, offset) (({ \ |
a666ecfb | 26 | extern int simple_identifier_##var(void); \ |
632bbfee | 27 | unsigned long __ptr; \ |
f0343474 | 28 | asm ( "" : "=a" (__ptr) : "0" (ptr) ); \ |
29 | (typeof(ptr)) (__ptr + (offset)); })) | |
1da177e4 LT |
30 | |
31 | #endif | |
32 | ||
f0343474 | 33 | #define __my_cpu_offset S390_lowcore.percpu_offset |
1da177e4 | 34 | |
f0343474 | 35 | #include <asm-generic/percpu.h> |
1da177e4 | 36 | |
1da177e4 | 37 | #endif /* __ARCH_S390_PERCPU__ */ |