[PATCH 1/3] powerpc: Add a #define for aligning to a long-sized boundary

Subsystems: the rest

STALE6590d

7 messages, 2 authors, 2008-07-17 · open the first message on its own page

[PATCH 1/3] powerpc: Add a #define for aligning to a long-sized boundary

From: Michael Ellerman <hidden>
Date: 2008-07-17 07:17:51

Add a #define for aligning to a long-sized boundary. It would be nice
to use sizeof(long) for this, but that requires generating the value
with asm-offsets.c, and asm-offsets.c includes asm-compat.h and we
descend into some sort of recursive include hell.

Signed-off-by: Michael Ellerman <redacted>
---
 include/asm-powerpc/asm-compat.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index 8ec2e1d..8f0fe79 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -22,6 +22,7 @@
 #define PPC_STL		stringify_in_c(std)
 #define PPC_LCMPI	stringify_in_c(cmpdi)
 #define PPC_LONG	stringify_in_c(.llong)
+#define PPC_LONG_ALIGN	stringify_in_c(.balign 8)
 #define PPC_TLNEI	stringify_in_c(tdnei)
 #define PPC_LLARX	stringify_in_c(ldarx)
 #define PPC_STLCX	stringify_in_c(stdcx.)
@@ -43,6 +44,7 @@
 #define PPC_STL		stringify_in_c(stw)
 #define PPC_LCMPI	stringify_in_c(cmpwi)
 #define PPC_LONG	stringify_in_c(.long)
+#define PPC_LONG_ALIGN	stringify_in_c(.balign 4)
 #define PPC_TLNEI	stringify_in_c(twnei)
 #define PPC_LLARX	stringify_in_c(lwarx)
 #define PPC_STLCX	stringify_in_c(stwcx.)
-- 
1.5.5

[PATCH 2/3] powerpc: Use PPC_LONG_ALIGN in uaccess.h

From: Michael Ellerman <hidden>
Date: 2008-07-17 07:17:52

Signed-off-by: Michael Ellerman <redacted>
---
 include/asm-powerpc/uaccess.h |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
index 1a0736f..bd0fb84 100644
--- a/include/asm-powerpc/uaccess.h
+++ b/include/asm-powerpc/uaccess.h
@@ -6,6 +6,7 @@
 
 #include <linux/sched.h>
 #include <linux/errno.h>
+#include <asm/asm-compat.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 
@@ -141,12 +142,11 @@ extern long __put_user_bad(void);
 		"	b 2b\n"					\
 		".previous\n"					\
 		".section __ex_table,\"a\"\n"			\
-		"	.balign %5\n"				\
+			PPC_LONG_ALIGN "\n"			\
 			PPC_LONG "1b,3b\n"			\
 		".previous"					\
 		: "=r" (err)					\
-		: "r" (x), "b" (addr), "i" (-EFAULT), "0" (err),\
-		  "i"(sizeof(unsigned long)))
+		: "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
 
 #ifdef __powerpc64__
 #define __put_user_asm2(x, ptr, retval)				\
@@ -162,13 +162,12 @@ extern long __put_user_bad(void);
 		"	b 3b\n"					\
 		".previous\n"					\
 		".section __ex_table,\"a\"\n"			\
-		"	.balign %5\n"				\
+			PPC_LONG_ALIGN "\n"			\
 			PPC_LONG "1b,4b\n"			\
 			PPC_LONG "2b,4b\n"			\
 		".previous"					\
 		: "=r" (err)					\
-		: "r" (x), "b" (addr), "i" (-EFAULT), "0" (err),\
-		  "i"(sizeof(unsigned long)))
+		: "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
 #endif /* __powerpc64__ */
 
 #define __put_user_size(x, ptr, size, retval)			\
@@ -226,12 +225,11 @@ extern long __get_user_bad(void);
 		"	b 2b\n"				\
 		".previous\n"				\
 		".section __ex_table,\"a\"\n"		\
-		"	.balign %5\n"			\
+			PPC_LONG_ALIGN "\n"		\
 			PPC_LONG "1b,3b\n"		\
 		".previous"				\
 		: "=r" (err), "=r" (x)			\
-		: "b" (addr), "i" (-EFAULT), "0" (err),	\
-		  "i"(sizeof(unsigned long)))
+		: "b" (addr), "i" (-EFAULT), "0" (err))
 
 #ifdef __powerpc64__
 #define __get_user_asm2(x, addr, err)			\
@@ -249,13 +247,12 @@ extern long __get_user_bad(void);
 		"	b 3b\n"				\
 		".previous\n"				\
 		".section __ex_table,\"a\"\n"		\
-		"	.balign %5\n"			\
+			PPC_LONG_ALIGN "\n"		\
 			PPC_LONG "1b,4b\n"		\
 			PPC_LONG "2b,4b\n"		\
 		".previous"				\
 		: "=r" (err), "=&r" (x)			\
-		: "b" (addr), "i" (-EFAULT), "0" (err),	\
-		  "i"(sizeof(unsigned long)))
+		: "b" (addr), "i" (-EFAULT), "0" (err))
 #endif /* __powerpc64__ */
 
 #define __get_user_size(x, ptr, size, retval)			\
-- 
1.5.5

Re: [PATCH 2/3] powerpc: Use PPC_LONG_ALIGN in uaccess.h

From: Kumar Gala <hidden>
Date: 2008-07-17 12:28:38

On Jul 17, 2008, at 2:17 AM, Michael Ellerman wrote:
Signed-off-by: Michael Ellerman <redacted>
---
include/asm-powerpc/uaccess.h |   21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
What's the reason for the change?

- k

Re: [PATCH 2/3] powerpc: Use PPC_LONG_ALIGN in uaccess.h

From: Kumar Gala <hidden>
Date: 2008-07-17 12:40:17

On Jul 17, 2008, at 7:28 AM, Kumar Gala wrote:
On Jul 17, 2008, at 2:17 AM, Michael Ellerman wrote:
quoted
Signed-off-by: Michael Ellerman <redacted>
---
include/asm-powerpc/uaccess.h |   21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
What's the reason for the change?
ignore me.. when I look closer its obvious.

- k

[PATCH 3/3] powerpc: Use PPC_LONG and PPC_LONG_ALIGN in lib/string.S

From: Michael Ellerman <hidden>
Date: 2008-07-17 07:17:52

No change to the generated code.

Signed-off-by: Michael Ellerman <redacted>
---
 arch/powerpc/lib/string.S |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S
index 49eb1f1..64e2e49 100644
--- a/arch/powerpc/lib/string.S
+++ b/arch/powerpc/lib/string.S
@@ -13,13 +13,7 @@
 #include <asm/ppc_asm.h>
 
 	.section __ex_table,"a"
-#ifdef CONFIG_PPC64
-	.align	3
-#define EXTBL	.llong
-#else
-	.align	2
-#define EXTBL	.long
-#endif
+	PPC_LONG_ALIGN
 	.text
 	
 _GLOBAL(strcpy)
@@ -160,9 +154,9 @@ _GLOBAL(__clear_user)
 	blr
 
 	.section __ex_table,"a"
-	EXTBL	11b,90b
-	EXTBL	1b,91b
-	EXTBL	8b,92b
+	PPC_LONG	11b,90b
+	PPC_LONG	1b,91b
+	PPC_LONG	8b,92b
 	.text
 
 _GLOBAL(__strncpy_from_user)
@@ -183,7 +177,7 @@ _GLOBAL(__strncpy_from_user)
 	blr
 
 	.section __ex_table,"a"
-	EXTBL	1b,99b
+	PPC_LONG	1b,99b
 	.text
 
 /* r3 = str, r4 = len (> 0), r5 = top (highest addr) */
@@ -208,4 +202,4 @@ _GLOBAL(__strnlen_user)
 	blr
 
 	.section __ex_table,"a"
-	EXTBL	1b,99b
+	PPC_LONG	1b,99b
-- 
1.5.5

Re: [PATCH 3/3] powerpc: Use PPC_LONG and PPC_LONG_ALIGN in lib/string.S

From: Kumar Gala <hidden>
Date: 2008-07-17 12:28:44

On Jul 17, 2008, at 2:17 AM, Michael Ellerman wrote:
No change to the generated code.

Signed-off-by: Michael Ellerman <redacted>
---
arch/powerpc/lib/string.S |   18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)

What's the reason for the change?

- k

Re: [PATCH 3/3] powerpc: Use PPC_LONG and PPC_LONG_ALIGN in lib/string.S

From: Kumar Gala <hidden>
Date: 2008-07-17 12:40:27

On Jul 17, 2008, at 7:28 AM, Kumar Gala wrote:
On Jul 17, 2008, at 2:17 AM, Michael Ellerman wrote:
quoted
No change to the generated code.

Signed-off-by: Michael Ellerman <redacted>
---
arch/powerpc/lib/string.S |   18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)

What's the reason for the change?

ignore me.. when I look closer its obvious.

- k
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help