Skip to contentSkip to conversation

sparc64: Convert U3copy_{from,to}_user to accurate exception reporting.

PATCH In review David Miller 2 participants 4 messages Oct 25, 2016 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 9/11 sparc64: Convert U3copy_{from,to}_user to accurate exception reporting.

Report the exact number of bytes which have not been successfully copied when an exception occurs, using the running remaining length.

---
 arch/sparc/lib/U3copy_from_user.S |   8 +-
 arch/sparc/lib/U3copy_to_user.S   |   8 +-
 arch/sparc/lib/U3memcpy.S         | 227 ++++++++++++++++++++++++++------------
 3 files changed, 162 insertions(+), 81 deletions(-)
arch/sparc/lib/U3copy_from_user.S +4 -4
index 1046e2b..db73010 100644
@@ -3,19 +3,19 @@
  * Copyright (C) 1999, 2000, 2004 David S. Miller ([email protected])
  */
 
-#define EX_LD(x)		\
+#define EX_LD(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone;	\
+	.word 98b, y;		\
 	.text;			\
 	.align 4;
 
-#define EX_LD_FP(x)		\
+#define EX_LD_FP(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone_fp;\
+	.word 98b, y##_fp;	\
 	.text;			\
 	.align 4;
 
arch/sparc/lib/U3copy_to_user.S +4 -4
index 032b0c5..c4ee858 100644
@@ -3,19 +3,19 @@
  * Copyright (C) 1999, 2000, 2004 David S. Miller ([email protected])
  */
 
-#define EX_ST(x)		\
+#define EX_ST(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone;	\
+	.word 98b, y;		\
 	.text;			\
 	.align 4;
 
-#define EX_ST_FP(x)		\
+#define EX_ST_FP(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone_fp;\
+	.word 98b, y##_fp;	\
 	.text;			\
 	.align 4;
 
arch/sparc/lib/U3memcpy.S +154 -73

411 lines not on this page · raw message

Signature · 1 line
2.1.2.532.g19b5d50
#1 lore raw

Hi Dave.

One small comment below.
I did not try to build with these patches, but stumbled over this detail.

Quoted 80 lines · David Miller

Report the exact number of bytes which have not been successfully copied when an exception occurs, using the running remaining length.

---
 arch/sparc/lib/U3copy_from_user.S |   8 +-
 arch/sparc/lib/U3copy_to_user.S   |   8 +-
 arch/sparc/lib/U3memcpy.S         | 227 ++++++++++++++++++++++++++------------
 3 files changed, 162 insertions(+), 81 deletions(-)
arch/sparc/lib/U3copy_from_user.S +4 -4
index 1046e2b..db73010 100644
@@ -3,19 +3,19 @@
  * Copyright (C) 1999, 2000, 2004 David S. Miller ([email protected])
  */
 
-#define EX_LD(x)		\
+#define EX_LD(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone;	\
+	.word 98b, y;		\
 	.text;			\
 	.align 4;
 
-#define EX_LD_FP(x)		\
+#define EX_LD_FP(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone_fp;\
+	.word 98b, y##_fp;	\
 	.text;			\
 	.align 4;
 
arch/sparc/lib/U3copy_to_user.S +4 -4
index 032b0c5..c4ee858 100644
@@ -3,19 +3,19 @@
  * Copyright (C) 1999, 2000, 2004 David S. Miller ([email protected])
  */
 
-#define EX_ST(x)		\
+#define EX_ST(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone;	\
+	.word 98b, y;		\
 	.text;			\
 	.align 4;
 
-#define EX_ST_FP(x)		\
+#define EX_ST_FP(x,y)		\
 98:	x;			\
 	.section __ex_table,"a";\
 	.align 4;		\
-	.word 98b, __retl_mone_fp;\
+	.word 98b, y##_fp;	\
 	.text;			\
 	.align 4;
 
arch/sparc/lib/U3memcpy.S +1 -0
index 491ee69..54f9870 100644
@@ -4,6 +4,7 @@
  */
 
 #ifdef __KERNEL__
+#include <linux/linkage.h>
 #include <asm/visasm.h>
 #include <asm/asi.h>
 #define GLOBAL_SPARE	%g7

arch/sparc/lib/U3memcpy.S line 26

Quoted 5 lines
arch/sparc/lib/U3memcpy.S +1 -1
@@ -22,21 +23,17 @@
 #endif
 
 #ifndef EX_LD
-#define EX_LD(x)	x
+#define EX_LD(x,y)	x

The above line will result in following assembelr code fragment:

.word 98b, ;           \
          ^
          empty

Maybe this is just fine - but it looks wrong.
Same goes for other uses of related macros.

Sam

author maintainer
#2 lore raw
In reply to David Miller

From: Sam Ravnborg <[email protected]>
Date: Tue, 25 Oct 2016 20:39:40 +0200

Quoted 1 line

One small comment below.

...

Quoted 8 lines

arch/sparc/lib/U3memcpy.S line 26

Quoted 6 lines
arch/sparc/lib/U3memcpy.S +1 -1
@@ -22,21 +23,17 @@
 #endif
 
 #ifndef EX_LD
-#define EX_LD(x)	x
+#define EX_LD(x,y)	x

The above line will result in following assembelr code fragment:

Quoted 5 lines
.word 98b, ;           \
          ^
          empty

Maybe this is just fine - but it looks wrong.
Same goes for other uses of related macros.

It's a macro definition which just emits the first argument when actually used.

Can you explain in more detail what you think happens?

#3 lore raw
In reply to David Miller
Quoted 19 lines · David Miller

From: Sam Ravnborg <[email protected]>
Date: Tue, 25 Oct 2016 20:39:40 +0200

Quoted 1 line

One small comment below.

...

Quoted 8 lines

arch/sparc/lib/U3memcpy.S line 26

Quoted 6 lines
arch/sparc/lib/U3memcpy.S +1 -1
@@ -22,21 +23,17 @@
 #endif
 
 #ifndef EX_LD
-#define EX_LD(x)	x
+#define EX_LD(x,y)	x

The above line will result in following assembelr code fragment:

Quoted 5 lines
.word 98b, ;           \
          ^
          empty

Maybe this is just fine - but it looks wrong.
Same goes for other uses of related macros.

Quoted 4 lines

It's a macro definition which just emits the first argument when actually used.

Can you explain in more detail what you think happens?

Thats simple - I am wasting your time.

I misread what was going on - and was too quick to reply.

Sam