annotate target-utils/libc/bzero.S @ 752:c79aaed75bd8

compile-fc-batt: allow possible third field in source lines Battery tables maintained in the fc-battery-conf repository will now have a third field added, defining thresholds for the battery bars icon, and there will be a new utility to compile them into the new /etc/batterytab2 file read by the FC Tourmaline version of our FCHG driver. For backward compatibility with the original Magnetite version of FCHG, compile-fc-batt remains the tool for compiling the original /etc/batterytab file format, and it needs to ignore the newly added third field in battery table sources.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 05 Nov 2020 20:37:55 +0000
parents bfed7a5c21a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This ARM implementation of bzero() has been derived from:
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * linux/arch/arm/lib/memzero.S
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 *
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * Copyright (C) 1995-2000 Russell King
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 * it under the terms of the GNU General Public License version 2 as
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * published by the Free Software Foundation.
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 */
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 .text
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 .code 32
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 .globl bzero
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 /*
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 * Align the pointer in r0. r3 contains the number of bytes that we are
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 * mis-aligned by, and r1 is the number of bytes. If r1 < 4, then we
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 * don't bother; we use byte stores instead.
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 */
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 1: subs r1, r1, #4 @ 1 do we have enough
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 blt 5f @ 1 bytes to align with?
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 cmp r3, #2 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 strltb r2, [r0], #1 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 strleb r2, [r0], #1 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 strb r2, [r0], #1 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 add r1, r1, r3 @ 1 (r1 = r1 - (4 - r3))
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 /*
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 * The pointer is now aligned and the length is adjusted. Try doing the
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 * bzero again.
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 */
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 bzero:
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 mov r2, #0 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 ands r3, r0, #3 @ 1 unaligned?
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 bne 1b @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /*
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 */
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 3: subs r1, r1, #4
92
bfed7a5c21a6 target-utils/libc/bzero.S: changed signed conditions to unsigned
Mychaela Falconia <falcon@freecalypso.org>
parents: 88
diff changeset
42 strcs r2, [r0], #4
bfed7a5c21a6 target-utils/libc/bzero.S: changed signed conditions to unsigned
Mychaela Falconia <falcon@freecalypso.org>
parents: 88
diff changeset
43 bhi 3b @ 1
88
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 bxeq lr @ 1/2 quick exit
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 /*
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 * No need to correct the count; we're only testing bits from now on
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 *
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 * When we get here, we've got less than 4 bytes to zero. We
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 * may have an unaligned pointer as well.
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 */
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 5: tst r1, #2 @ 1 2 bytes or more?
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 strneb r2, [r0], #1 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 strneb r2, [r0], #1 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 tst r1, #1 @ 1 a byte left over
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 strneb r2, [r0], #1 @ 1
4f3843165014 target-utils/libc: bzero imported from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 bx lr @ 1