source: mainline/kernel/arch/arm32/src/asm.S@ 55896b6

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 55896b6 was cb4f078, checked in by Martin Decky <martin@…>, 14 years ago

unify kernel byte string implementations

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 2007 Michal Kebrt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29.text
30
31.global memcpy_from_uspace
32.global memcpy_to_uspace
33.global memcpy_from_uspace_failover_address
34.global memcpy_to_uspace_failover_address
35.global early_putchar
36
37memcpy_from_uspace:
38memcpy_to_uspace:
39 add r3, r1, #3
40 bic r3, r3, #3
41 cmp r1, r3
42 stmdb sp!, {r4, r5, lr}
43 mov r5, r0 /* save dst */
44 beq 4f
45
46 1:
47 cmp r2, #0
48 movne ip, #0
49 beq 3f
50
51 2:
52 ldrb r3, [ip, r1]
53 strb r3, [ip, r0]
54 add ip, ip, #1
55 cmp ip, r2
56 bne 2b
57
58 3:
59 mov r0, r5
60 ldmia sp!, {r4, r5, pc}
61
62 4:
63 add r3, r0, #3
64 bic r3, r3, #3
65 cmp r0, r3
66 bne 1b
67 movs r4, r2, lsr #2
68 moveq lr, r4
69 beq 6f
70 mov lr, #0
71 mov ip, lr
72
73 5:
74 ldr r3, [ip, r1]
75 add lr, lr, #1
76 cmp lr, r4
77 str r3, [ip, r0]
78 add ip, ip, #4
79 bne 5b
80
81 6:
82 ands r4, r2, #3
83 beq 3b
84 mov r3, lr, lsl #2
85 add r0, r3, r0
86 add ip, r3, r1
87 mov r2, #0
88
89 7:
90 ldrb r3, [r2, ip]
91 strb r3, [r2, r0]
92 add r2, r2, #1
93 cmp r2, r4
94 bne 7b
95 b 3b
96
97memcpy_from_uspace_failover_address:
98memcpy_to_uspace_failover_address:
99 mov r0, #0
100 ldmia sp!, {r4, r5, pc}
101
102early_putchar:
103 mov pc, lr
Note: See TracBrowser for help on using the repository browser.