linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: benh@kernel.crashing.org, paulus@samba.org,
	rusty@rustcorp.com.au, ulrich.weigand@de.ibm.com,
	amodra@gmail.com, mikey@neuling.org, mjw@linux.vnet.ibm.com,
	rostedt@goodmis.org, philippe.bergheaud@fr.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 1/7] powerpc: Add _GLOBAL_TOC for ABIv2 assembly functions exported to modules
Date: Fri,  4 Apr 2014 17:09:04 +1100	[thread overview]
Message-ID: <1396591750-8203-2-git-send-email-anton@samba.org> (raw)
In-Reply-To: <1396591750-8203-1-git-send-email-anton@samba.org>

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>
---
 arch/powerpc/include/asm/ppc_asm.h | 12 ++++++++++++
 arch/powerpc/lib/copyuser_64.S     |  2 +-
 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 2cc2511..6400f18 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)
 	.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 ; \
@@ -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 ; \
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index 596a285..0860ee4 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -18,7 +18,7 @@
 #endif
 
 	.align	7
-_GLOBAL(__copy_tofrom_user)
+_GLOBAL_TOC(__copy_tofrom_user)
 BEGIN_FTR_SECTION
 	nop
 FTR_SECTION_ELSE
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index 9d3960c..bc9a2ca 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -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
-- 
1.8.3.2

  reply	other threads:[~2014-04-04  6:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04  6:09 [PATCH 0/7] Build ppc64le kernel using ABIv2, supplemental patches Anton Blanchard
2014-04-04  6:09 ` Anton Blanchard [this message]
2014-04-04  6:09 ` [PATCH 2/7] powerpc: ftrace_caller, _mcount is exported to modules so needs _GLOBAL_TOC() Anton Blanchard
2014-04-04  6:09 ` [PATCH 3/7] powerpc/kprobes: Fix ABIv2 issues with kprobe_lookup_name Anton Blanchard
2014-04-04  6:09 ` [PATCH 4/7] powerpc/modules: Create is_module_trampoline() Anton Blanchard
2014-04-04  6:09 ` [PATCH 5/7] powerpc/modules: Create module_trampoline_target() Anton Blanchard
2014-04-04  6:09 ` [PATCH 6/7] powerpc/ftrace: Use module loader helpers to parse trampolines Anton Blanchard
2014-04-22  6:58   ` Rusty Russell
2014-04-04  6:09 ` [PATCH 7/7] powerpc/ftrace: Fix ABIv2 issues with __ftrace_make_call Anton Blanchard
2014-04-04  6:19 ` [PATCH 0/7] Build ppc64le kernel using ABIv2, supplemental patches Michael Neuling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396591750-8203-2-git-send-email-anton@samba.org \
    --to=anton@samba.org \
    --cc=amodra@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mjw@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=philippe.bergheaud@fr.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=ulrich.weigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).