diff options
author | Anton Blanchard <anton@samba.org> | 2014-04-03 01:01:11 -0400 |
---|---|---|
committer | Anton Blanchard <anton@samba.org> | 2014-04-22 20:05:32 -0400 |
commit | 169c7cee3131cdf5e2f2d2a6c722c7db0283bcd5 (patch) | |
tree | a9804c62b8090d719337159fd98294b9282209cf | |
parent | 008d7a914efee6ee5afe59bcc46d3d6b60657598 (diff) |
powerpc: Add _GLOBAL_TOC for ABIv2 assembly functions exported to modules
If an assembly function that calls back into c code is exported to
modules, we need to ensure r2 is setup correctly. There are only
two places crazy enough to do it (two of which are my fault).
Signed-off-by: Anton Blanchard <anton@samba.org>
-rw-r--r-- | arch/powerpc/include/asm/ppc_asm.h | 12 | ||||
-rw-r--r-- | arch/powerpc/lib/copyuser_64.S | 2 | ||||
-rw-r--r-- | arch/powerpc/lib/memcpy_64.S | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 2cc2511ff076..6400f1814fe8 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h | |||
@@ -207,6 +207,16 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) | |||
207 | .globl name; \ | 207 | .globl name; \ |
208 | name: | 208 | name: |
209 | 209 | ||
210 | #define _GLOBAL_TOC(name) \ | ||
211 | .section ".text"; \ | ||
212 | .align 2 ; \ | ||
213 | .type name,@function; \ | ||
214 | .globl name; \ | ||
215 | name: \ | ||
216 | 0: addis r2,r12,(.TOC.-0b)@ha; \ | ||
217 | addi r2,r2,(.TOC.-0b)@l; \ | ||
218 | .localentry name,.-name | ||
219 | |||
210 | #define _KPROBE(name) \ | 220 | #define _KPROBE(name) \ |
211 | .section ".kprobes.text","a"; \ | 221 | .section ".kprobes.text","a"; \ |
212 | .align 2 ; \ | 222 | .align 2 ; \ |
@@ -235,6 +245,8 @@ name: \ | |||
235 | .type GLUE(.,name),@function; \ | 245 | .type GLUE(.,name),@function; \ |
236 | GLUE(.,name): | 246 | GLUE(.,name): |
237 | 247 | ||
248 | #define _GLOBAL_TOC(name) _GLOBAL(name) | ||
249 | |||
238 | #define _KPROBE(name) \ | 250 | #define _KPROBE(name) \ |
239 | .section ".kprobes.text","a"; \ | 251 | .section ".kprobes.text","a"; \ |
240 | .align 2 ; \ | 252 | .align 2 ; \ |
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S index 596a285c0755..0860ee46013c 100644 --- a/arch/powerpc/lib/copyuser_64.S +++ b/arch/powerpc/lib/copyuser_64.S | |||
@@ -18,7 +18,7 @@ | |||
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | .align 7 | 20 | .align 7 |
21 | _GLOBAL(__copy_tofrom_user) | 21 | _GLOBAL_TOC(__copy_tofrom_user) |
22 | BEGIN_FTR_SECTION | 22 | BEGIN_FTR_SECTION |
23 | nop | 23 | nop |
24 | FTR_SECTION_ELSE | 24 | FTR_SECTION_ELSE |
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S index 9d3960c16fde..bc9a2ca591c3 100644 --- a/arch/powerpc/lib/memcpy_64.S +++ b/arch/powerpc/lib/memcpy_64.S | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <asm/ppc_asm.h> | 10 | #include <asm/ppc_asm.h> |
11 | 11 | ||
12 | .align 7 | 12 | .align 7 |
13 | _GLOBAL(memcpy) | 13 | _GLOBAL_TOC(memcpy) |
14 | BEGIN_FTR_SECTION | 14 | BEGIN_FTR_SECTION |
15 | std r3,-STACKFRAMESIZE+STK_REG(R31)(r1) /* save destination pointer for return value */ | 15 | std r3,-STACKFRAMESIZE+STK_REG(R31)(r1) /* save destination pointer for return value */ |
16 | FTR_SECTION_ELSE | 16 | FTR_SECTION_ELSE |