x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / blackfin / lib / memmove.S
blobe0b78208f1d66f45c8cc086a782562b1580b178a
1 /*
2  * Copyright 2005-2009 Analog Devices Inc.
3  *
4  * Licensed under the Clear BSD license or the GPL-2 (or later)
5  */
7 #include <linux/linkage.h>
9 .align 2
12  * C Library function MEMMOVE
13  * R0 = To Address (leave unchanged to form result)
14  * R1 = From Address
15  * R2 = count
16  * Data may overlap
17  */
19 ENTRY(_memmove)
20         I1 = P3;
21         P0 = R0;                  /* P0 = To address */
22         P3 = R1;                  /* P3 = From Address */
23         P2 = R2;                  /* P2 = count */
24         CC = P2 == 0;             /* Check zero count*/
25         IF CC JUMP .Lfinished;    /* very unlikely */
27         CC = R1 < R0 (IU);        /* From < To */
28         IF !CC JUMP .Lno_overlap;
29         R3 = R1 + R2;
30         CC = R0 <= R3 (IU);       /* (From+len) >= To */
31         IF CC JUMP .Loverlap;
32 .Lno_overlap:
33         R3 = 11;
34         CC = R2 <= R3;
35         IF CC JUMP .Lbytes;
36         R3 = R1 | R0;             /* OR addresses together */
37         R3 <<= 30;                /* check bottom two bits */
38         CC =  AZ;                 /* AZ set if zero.*/
39         IF !CC JUMP .Lbytes;      /* Jump if addrs not aligned.*/
41         I0 = P3;
42         P1 = P2 >> 2;             /* count = n/4 */
43         P1 += -1;
44         R3 =  3;
45         R2 = R2 & R3;             /* remainder */
46         P2 = R2;                  /* set remainder */
47         R1 = [I0++];
49         LSETUP (.Lquad_loops, .Lquad_loope) LC0=P1;
50 #if ANOMALY_05000202
51 .Lquad_loops:
52         [P0++] = R1;
53 .Lquad_loope:
54         R1 = [I0++];
55 #else
56 .Lquad_loops:
57 .Lquad_loope:
58          MNOP || [P0++] = R1 || R1 = [I0++];
59 #endif
60         [P0++] = R1;
62         CC = P2 == 0;             /* any remaining bytes? */
63         P3 = I0;                  /* Amend P3 to updated ptr. */
64         IF !CC JUMP .Lbytes;
65         P3 = I1;
66         RTS;
68 .Lbytes:     LSETUP (.Lbyte2_s, .Lbyte2_e) LC0=P2;
69 .Lbyte2_s:   R1 = B[P3++](Z);
70 .Lbyte2_e:   B[P0++] = R1;
72 .Lfinished:  P3 = I1;
73         RTS;
75 .Loverlap:
76         P2 += -1;
77         P0 = P0 + P2;
78         P3 = P3 + P2;
79         R1 = B[P3--] (Z);
80         CC = P2 == 0;
81         IF CC JUMP .Lno_loop;
82 #if ANOMALY_05000245
83         NOP;
84         NOP;
85 #endif
86         LSETUP (.Lol_s, .Lol_e) LC0 = P2;
87 .Lol_s:    B[P0--] = R1;
88 .Lol_e:    R1 = B[P3--] (Z);
89 .Lno_loop: B[P0] = R1;
90         P3 = I1;
91         RTS;
93 ENDPROC(_memmove)