Skip to content

Commit

Permalink
powerpc: Add _GLOBAL_TOC for ABIv2 assembly functions exported to mod…
Browse files Browse the repository at this point in the history
…ules

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 <[email protected]>
  • Loading branch information
antonblanchard committed Apr 23, 2014
1 parent 008d7a9 commit 169c7ce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions arch/powerpc/include/asm/ppc_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
.globl name; \
name:

#define _GLOBAL_TOC(name) \
.section ".text"; \
.align 2 ; \
.type name,@function; \
.globl name; \
name: \
0: addis r2,r12,(.TOC.-0b)@ha; \
addi r2,r2,(.TOC.-0b)@l; \
.localentry name,.-name

#define _KPROBE(name) \
.section ".kprobes.text","a"; \
.align 2 ; \
Expand Down Expand Up @@ -235,6 +245,8 @@ name: \
.type GLUE(.,name),@function; \
GLUE(.,name):

#define _GLOBAL_TOC(name) _GLOBAL(name)

#define _KPROBE(name) \
.section ".kprobes.text","a"; \
.align 2 ; \
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/lib/copyuser_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#endif

.align 7
_GLOBAL(__copy_tofrom_user)
_GLOBAL_TOC(__copy_tofrom_user)
BEGIN_FTR_SECTION
nop
FTR_SECTION_ELSE
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/lib/memcpy_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <asm/ppc_asm.h>

.align 7
_GLOBAL(memcpy)
_GLOBAL_TOC(memcpy)
BEGIN_FTR_SECTION
std r3,-STACKFRAMESIZE+STK_REG(R31)(r1) /* save destination pointer for return value */
FTR_SECTION_ELSE
Expand Down

0 comments on commit 169c7ce

Please sign in to comment.