1 /* $NetBSD: bcopyinout.S,v 1.11 2003/10/13 21:22:40 scw Exp $ */
2
3 /*-
4 * Copyright (c) 2002 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Allen Briggs for Wasabi Systems, Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed for the NetBSD Project by
20 * Wasabi Systems, Inc.
21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 * or promote products derived from this software without specific prior
23 * written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38
39 #include "assym.inc"
40
41 #include <machine/asm.h>
42 #include <sys/errno.h>
43
44 .L_arm_memcpy:
45 .word _C_LABEL(_arm_memcpy)
46 .L_min_memcpy_size:
47 .word _C_LABEL(_min_memcpy_size)
48
49 __FBSDID("$FreeBSD$");
50 #include <arm/arm/bcopyinout_xscale.S>
51
52 /*
53 * int badaddr_read_1(const uint8_t *src, uint8_t *dest)
54 *
55 * Copies a single 8-bit value from src to dest, returning 0 on success,
56 * else EFAULT if a page fault occurred.
57 */
58 ENTRY(badaddr_read_1)
59 GET_PCB(r2)
60 ldr r2, [r2]
61
62 ldr ip, [r2, #PCB_ONFAULT]
63 adr r3, 1f
64 str r3, [r2, #PCB_ONFAULT]
65 nop
66 nop
67 nop
68 ldrb r3, [r0]
69 nop
70 nop
71 nop
72 strb r3, [r1]
73 mov r0, #0 /* No fault */
74 1: str ip, [r2, #PCB_ONFAULT]
75 RET
76 END(badaddr_read_1)
77
78 /*
79 * int badaddr_read_2(const uint16_t *src, uint16_t *dest)
80 *
81 * Copies a single 16-bit value from src to dest, returning 0 on success,
82 * else EFAULT if a page fault occurred.
83 */
84 ENTRY(badaddr_read_2)
85 GET_PCB(r2)
86 ldr r2, [r2]
87
88 ldr ip, [r2, #PCB_ONFAULT]
89 adr r3, 1f
90 str r3, [r2, #PCB_ONFAULT]
91 nop
92 nop
93 nop
94 ldrh r3, [r0]
95 nop
96 nop
97 nop
98 strh r3, [r1]
99 mov r0, #0 /* No fault */
100 1: str ip, [r2, #PCB_ONFAULT]
101 RET
102 END(badaddr_read_2)
103
104 /*
105 * int badaddr_read_4(const uint32_t *src, uint32_t *dest)
106 *
107 * Copies a single 32-bit value from src to dest, returning 0 on success,
108 * else EFAULT if a page fault occurred.
109 */
110 ENTRY(badaddr_read_4)
111 GET_PCB(r2)
112 ldr r2, [r2]
113
114 ldr ip, [r2, #PCB_ONFAULT]
115 adr r3, 1f
116 str r3, [r2, #PCB_ONFAULT]
117 nop
118 nop
119 nop
120 ldr r3, [r0]
121 nop
122 nop
123 nop
124 str r3, [r1]
125 mov r0, #0 /* No fault */
126 1: str ip, [r2, #PCB_ONFAULT]
127 RET
128 END(badaddr_read_4)
129
Cache object: 6bbb004400d2860e9ede5b9f4ae1a9f1
|