Skip to contentSkip to conversation

Blackfin arch: sync with uClibc no functional changes

PATCH In review Wu, Bryan 1 participant 3 messages Apr 4, 2007 – Apr 5, 2007

lore
Share & tools
lore

Wu, Bryan

author
#0 lore raw

PATCH 1/1 Blackfin arch: sync with uClibc no functional changes

---
 arch/blackfin/lib/memchr.S  |   31 +++++++++++++++++-----------
 arch/blackfin/lib/memcmp.S  |   46 ++++++++++++++++++++++--------------------
 arch/blackfin/lib/memcpy.S  |   24 +++++++++++++++-------
 arch/blackfin/lib/memmove.S |   12 ++++++----
 arch/blackfin/lib/memset.S  |    2 +
 5 files changed, 68 insertions(+), 47 deletions(-)
arch/blackfin/lib/memchr.S +19 -12
index c4f1aab..3adee9e 100644
@@ -29,24 +29,27 @@
 
 #include <linux/linkage.h>
 
-.align 2
-
-/*
- * C Library function MEMCHR
- * R0 = address
- * R1 = sought byte
- * R2 = count
+/* void *memchr(const void *s, int c, size_t n);
+ * R0 = address (s)
+ * R1 = sought byte (c)
+ * R2 = count (n)
+ *
  * Returns pointer to located character.
  */
 
+.text
+
+.align 2
+
 ENTRY(_memchr)
-	P0 = R0 ;             /* P0 = address */
-	P2 = R2 ;             /* P2 = count */
+	P0 = R0;             // P0 = address
+	P2 = R2;             // P2 = count
 	R1 = R1.B(Z);
 	CC = R2 == 0;
 	IF CC JUMP .Lfailed;
 
-.Lbytes: LSETUP (.Lbyte_loop_s , .Lbyte_loop_e) LC0=P2;
+.Lbytes:
+	LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
 
 .Lbyte_loop_s:
 	R3 = B[P0++](Z);
@@ -55,9 +58,13 @@ ENTRY(_memchr)
 .Lbyte_loop_e:
 	NOP;
 
-.Lfailed: R0=0;
+.Lfailed:
+	R0=0;
 	RTS;
 
-.Lfound: R0 = P0;
+.Lfound:
+	R0 = P0;
 	R0 += -1;
 	RTS;
+
+.size _memchr,.-_memchr
arch/blackfin/lib/memcmp.S +24 -22

87 lines not on this page · raw message

arch/blackfin/lib/memcpy.S +16 -8
index f757e1d..c1e00ef 100644
@@ -35,6 +35,14 @@
 
 #include <linux/linkage.h>
 
+/* void *memcpy(void *dest, const void *src, size_t n);
+ * R0 = To Address (dest) (leave unchanged to form result)
+ * R1 = From Address (src)
+ * R2 = count
+ *
+ * Note: Favours word alignment
+ */
+
 #ifdef CONFIG_MEMCPY_L1
 .section .l1.text
 #else
@@ -44,8 +52,8 @@
 .align 2
 
 ENTRY(_memcpy)
-	CC = R2 <=  0;	/* length not positive?*/
-	IF CC JUMP  .L_P1L2147483647;	/* Nothing to do */
+	CC = R2 <=  0;	/* length not positive? */
+	IF CC JUMP .L_P1L2147483647;	/* Nothing to do */
 
 	P0 = R0 ;	/* dst*/
 	P1 = R1 ;	/* src*/
@@ -104,7 +112,7 @@ ENTRY(_memcpy)
 .Lbytes_left:	P2 = R3;
 .Lnot_aligned:
 	/* From here, we're copying byte-by-byte. */
-	LSETUP (.Lbyte_start , .Lbyte_end) LC0=P2;
+	LSETUP (.Lbyte_start, .Lbyte_end) LC0=P2;
 	R0 = R1;	/* Save src address for return */
 .Lbyte_start:
 	R1 = B[P1++] (X);
@@ -115,11 +123,11 @@ ENTRY(_memcpy)
 	RTS;
 
 .Lhas_overlap:
-/* Need to reverse the copying, because the
- * dst would clobber the src.
- * Don't bother to work out alignment for
- * the reverse case.
- */
+	/* Need to reverse the copying, because the
+	 * dst would clobber the src.
+	 * Don't bother to work out alignment for
+	 * the reverse case.
+	 */
 	R0 = R1;	/* save src for later. */
 	P0 = P0 + P2;
 	P0 += -1;
arch/blackfin/lib/memmove.S +7 -5
index 4d4c48a..2e5fb7f 100644
@@ -43,7 +43,7 @@ ENTRY(_memmove)
 	I1 = P3;
 	P0 = R0;                  /* P0 = To address */
 	P3 = R1;                  /* P3 = From Address */
-	P2 = R2 ;                 /* P2 = count */
+	P2 = R2;                  /* P2 = count */
 	CC = P2 == 0;             /* Check zero count*/
 	IF CC JUMP .Lfinished;    /* very unlikely */
 
@@ -55,11 +55,11 @@ ENTRY(_memmove)
 .Lno_overlap:
 	R3 = 11;
 	CC = R2 <= R3;
-	IF CC JUMP  .Lbytes;
+	IF CC JUMP .Lbytes;
 	R3 = R1 | R0;             /* OR addresses together */
 	R3 <<= 30;                /* check bottom two bits */
 	CC =  AZ;                 /* AZ set if zero.*/
-	IF !CC JUMP  .Lbytes ;    /* Jump if addrs not aligned.*/
+	IF !CC JUMP .Lbytes;      /* Jump if addrs not aligned.*/
 
 	I0 = P3;
 	P1 = P2 >> 2;             /* count = n/4 */
@@ -69,7 +69,7 @@ ENTRY(_memmove)
 	P2 = R2;                  /* set remainder */
 	R1 = [I0++];
 
-	LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
+	LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
 .Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
 	[P0++] = R1;
 
@@ -79,7 +79,7 @@ ENTRY(_memmove)
 	P3 = I1;
 	RTS;
 
-.Lbytes:     LSETUP (.Lbyte2_s , .Lbyte2_e) LC0=P2;
+.Lbytes:     LSETUP (.Lbyte2_s, .Lbyte2_e) LC0=P2;
 .Lbyte2_s:   R1 = B[P3++](Z);
 .Lbyte2_e:   B[P0++] = R1;
 
@@ -99,3 +99,5 @@ ENTRY(_memmove)
 .Lno_loop: B[P0] = R1;
 	P3 = I1;
 	RTS;
+
+.size _memmove,.-_memmove
arch/blackfin/lib/memset.S +2 -0
index 7d46fca..ba6d047 100644
@@ -105,3 +105,5 @@ ENTRY(_memset)
 	B[P0++] = R1;
 	B[P0++] = R1;
 	JUMP .Laligned;
+
+.size _memset,.-_memset
Signature · 1 line
1.5.0.5
author
#1 lore raw

arch/blackfin/lib/memchr.S line 46

Quoted 10 lines

+.text

arch/blackfin/lib/memchr.S +5 -2
+
+.align 2
+
 ENTRY(_memchr)
-	P0 = R0 ;             /* P0 = address */
-	P2 = R2 ;             /* P2 = count */
+	P0 = R0;             // P0 = address
+	P2 = R2;             // P2 = count

Sorry for introducing wrong coding style source.
A updated one will be posted later.

Thanks Robin and Mike.
-Bryan

author
#2 lore raw

PATCH 1/1 Blackfin arch: sync with uClibc no functional changes

In reply to Wu, Bryan
---
 arch/blackfin/lib/memchr.S  |   31 +++++++++++++++++-----------
 arch/blackfin/lib/memcmp.S  |   46
++++++++++++++++++++++--------------------
 arch/blackfin/lib/memcpy.S  |   24 +++++++++++++++-------
 arch/blackfin/lib/memmove.S |   12 ++++++----
 arch/blackfin/lib/memset.S  |    2 +
 5 files changed, 68 insertions(+), 47 deletions(-)
arch/blackfin/lib/memchr.S +19 -12
index c4f1aab..4981222 100644
@@ -29,24 +29,27 @@
 
 #include <linux/linkage.h>
 
-.align 2
-
-/*
- * C Library function MEMCHR
- * R0 = address
- * R1 = sought byte
- * R2 = count
+/* void *memchr(const void *s, int c, size_t n);
+ * R0 = address (s)
+ * R1 = sought byte (c)
+ * R2 = count (n)
+ *
  * Returns pointer to located character.
  */
 
+.text
+
+.align 2
+
 ENTRY(_memchr)
-	P0 = R0 ;             /* P0 = address */
-	P2 = R2 ;             /* P2 = count */
+	P0 = R0;		/* P0 = address */
+	P2 = R2;		/* P2 = count */
 	R1 = R1.B(Z);
 	CC = R2 == 0;
 	IF CC JUMP .Lfailed;
 
-.Lbytes: LSETUP (.Lbyte_loop_s , .Lbyte_loop_e) LC0=P2;
+.Lbytes:
+	LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
 
 .Lbyte_loop_s:
 	R3 = B[P0++](Z);
@@ -55,9 +58,13 @@ ENTRY(_memchr)
 .Lbyte_loop_e:
 	NOP;
 
-.Lfailed: R0=0;
+.Lfailed:
+	R0=0;
 	RTS;
 
-.Lfound: R0 = P0;
+.Lfound:
+	R0 = P0;
 	R0 += -1;
 	RTS;
+
+.size _memchr,.-_memchr
arch/blackfin/lib/memcmp.S +24 -22

87 lines not on this page · raw message

arch/blackfin/lib/memcpy.S +16 -8
index f757e1d..c1e00ef 100644
@@ -35,6 +35,14 @@
 
 #include <linux/linkage.h>
 
+/* void *memcpy(void *dest, const void *src, size_t n);
+ * R0 = To Address (dest) (leave unchanged to form result)
+ * R1 = From Address (src)
+ * R2 = count
+ *
+ * Note: Favours word alignment
+ */
+
 #ifdef CONFIG_MEMCPY_L1
 .section .l1.text
 #else
@@ -44,8 +52,8 @@
 .align 2
 
 ENTRY(_memcpy)
-	CC = R2 <=  0;	/* length not positive?*/
-	IF CC JUMP  .L_P1L2147483647;	/* Nothing to do */
+	CC = R2 <=  0;	/* length not positive? */
+	IF CC JUMP .L_P1L2147483647;	/* Nothing to do */
 
 	P0 = R0 ;	/* dst*/
 	P1 = R1 ;	/* src*/
@@ -104,7 +112,7 @@ ENTRY(_memcpy)
 .Lbytes_left:	P2 = R3;
 .Lnot_aligned:
 	/* From here, we're copying byte-by-byte. */
-	LSETUP (.Lbyte_start , .Lbyte_end) LC0=P2;
+	LSETUP (.Lbyte_start, .Lbyte_end) LC0=P2;
 	R0 = R1;	/* Save src address for return */
 .Lbyte_start:
 	R1 = B[P1++] (X);
@@ -115,11 +123,11 @@ ENTRY(_memcpy)
 	RTS;
 
 .Lhas_overlap:
-/* Need to reverse the copying, because the
- * dst would clobber the src.
- * Don't bother to work out alignment for
- * the reverse case.
- */
+	/* Need to reverse the copying, because the
+	 * dst would clobber the src.
+	 * Don't bother to work out alignment for
+	 * the reverse case.
+	 */
 	R0 = R1;	/* save src for later. */
 	P0 = P0 + P2;
 	P0 += -1;
arch/blackfin/lib/memmove.S +7 -5
index 4d4c48a..2e5fb7f 100644
@@ -43,7 +43,7 @@ ENTRY(_memmove)
 	I1 = P3;
 	P0 = R0;                  /* P0 = To address */
 	P3 = R1;                  /* P3 = From Address */
-	P2 = R2 ;                 /* P2 = count */
+	P2 = R2;                  /* P2 = count */
 	CC = P2 == 0;             /* Check zero count*/
 	IF CC JUMP .Lfinished;    /* very unlikely */
 
@@ -55,11 +55,11 @@ ENTRY(_memmove)
 .Lno_overlap:
 	R3 = 11;
 	CC = R2 <= R3;
-	IF CC JUMP  .Lbytes;
+	IF CC JUMP .Lbytes;
 	R3 = R1 | R0;             /* OR addresses together */
 	R3 <<= 30;                /* check bottom two bits */
 	CC =  AZ;                 /* AZ set if zero.*/
-	IF !CC JUMP  .Lbytes ;    /* Jump if addrs not aligned.*/
+	IF !CC JUMP .Lbytes;      /* Jump if addrs not aligned.*/
 
 	I0 = P3;
 	P1 = P2 >> 2;             /* count = n/4 */
@@ -69,7 +69,7 @@ ENTRY(_memmove)
 	P2 = R2;                  /* set remainder */
 	R1 = [I0++];
 
-	LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
+	LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
 .Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
 	[P0++] = R1;
 
@@ -79,7 +79,7 @@ ENTRY(_memmove)
 	P3 = I1;
 	RTS;
 
-.Lbytes:     LSETUP (.Lbyte2_s , .Lbyte2_e) LC0=P2;
+.Lbytes:     LSETUP (.Lbyte2_s, .Lbyte2_e) LC0=P2;
 .Lbyte2_s:   R1 = B[P3++](Z);
 .Lbyte2_e:   B[P0++] = R1;
 
@@ -99,3 +99,5 @@ ENTRY(_memmove)
 .Lno_loop: B[P0] = R1;
 	P3 = I1;
 	RTS;
+
+.size _memmove,.-_memmove
arch/blackfin/lib/memset.S +2 -0
index 7d46fca..ba6d047 100644
@@ -105,3 +105,5 @@ ENTRY(_memset)
 	B[P0++] = R1;
 	B[P0++] = R1;
 	JUMP .Laligned;
+
+.size _memset,.-_memset
Signature · 1 line
1.5.0.5