FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/libiram/bzero.S @ 871:a5c8f48003cd
rvinterf: client programs can now selectively stop receiving packets of a
particular RVTMUX type
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Fri, 29 May 2015 06:29:38 +0000 |
parents | cbc49d533b7d |
children |
rev | line source |
---|---|
860
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This ARM implementation of bzero() has been derived from: |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * linux/arch/arm/lib/memzero.S |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * Copyright (C) 1995-2000 Russell King |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License version 2 as |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 * published by the Free Software Foundation. |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 */ |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 .text |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 .code 32 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 .globl bzero |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 /* |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 * Align the pointer in r0. r3 contains the number of bytes that we are |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 * mis-aligned by, and r1 is the number of bytes. If r1 < 4, then we |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 * don't bother; we use byte stores instead. |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 */ |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 1: subs r1, r1, #4 @ 1 do we have enough |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 blt 5f @ 1 bytes to align with? |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 cmp r3, #2 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 strltb r2, [r0], #1 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 strleb r2, [r0], #1 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 strb r2, [r0], #1 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 add r1, r1, r3 @ 1 (r1 = r1 - (4 - r3)) |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 /* |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 * The pointer is now aligned and the length is adjusted. Try doing the |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 * bzero again. |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 */ |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 bzero: |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 mov r2, #0 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 ands r3, r0, #3 @ 1 unaligned? |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 bne 1b @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 /* |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary. |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 */ |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 3: subs r1, r1, #4 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 strge r2, [r0], #4 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 bgt 3b @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 bxeq lr @ 1/2 quick exit |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 /* |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 * No need to correct the count; we're only testing bits from now on |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 * |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 * When we get here, we've got less than 4 bytes to zero. We |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 * may have an unaligned pointer as well. |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 */ |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 5: tst r1, #2 @ 1 2 bytes or more? |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 strneb r2, [r0], #1 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 strneb r2, [r0], #1 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 tst r1, #1 @ 1 a byte left over |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 strneb r2, [r0], #1 @ 1 |
cbc49d533b7d
gsm-fw: new implementation of bzero() and some specialized bcopy variants
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 bx lr @ 1 |