1 /* $NetBSD: fusu.S,v 1.10 2003/12/01 13:34:44 rearnsha Exp $ */
4 * Copyright (c) 1996-1998 Mark Brinicombe.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Mark Brinicombe
18 * 4. The name of the company nor the name of the author may be used to
19 * endorse or promote products derived from this software without specific
20 * prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include <machine/asm.h>
37 #include <machine/armreg.h>
39 __FBSDID("$FreeBSD$");
42 #define GET_PCB(tmp) \
43 mrc p15, 0, tmp, c13, c0, 4; \
44 add tmp, tmp, #(TD_PCB)
47 .word _C_LABEL(__pcpu) + PC_CURPCB
48 #define GET_PCB(tmp) \
53 * fuword(caddr_t uaddr);
54 * Fetch an int from the user's address space.
67 adr r4, .Lcasuwordfault
68 str r4, [r3, #PCB_ONFAULT]
92 str r1, [r3, #PCB_ONFAULT]
98 * Handle faults from casuword. Clean up and return -1.
103 str r0, [r3, #PCB_ONFAULT]
109 * fuword(caddr_t uaddr);
110 * Fetch an int from the user's address space.
124 str r1, [r2, #PCB_ONFAULT]
129 str r1, [r2, #PCB_ONFAULT]
136 * fusword(caddr_t uaddr);
137 * Fetch a short from the user's address space.
150 str r1, [r2, #PCB_ONFAULT]
155 orr r0, ip, r3, asl #8
157 orr r0, r3, ip, asl #8
160 str r1, [r2, #PCB_ONFAULT]
165 * fuswintr(caddr_t uaddr);
166 * Fetch a short from the user's address space. Can be called during an
171 ldr r2, Lblock_userspace_access
174 mvnne r0, #0x00000000
185 adr r1, _C_LABEL(fusubailout)
186 str r1, [r2, #PCB_ONFAULT]
191 orr r0, ip, r3, asl #8
193 orr r0, r3, ip, asl #8
197 str r1, [r2, #PCB_ONFAULT]
201 Lblock_userspace_access:
202 .word _C_LABEL(block_userspace_access)
206 .global _C_LABEL(block_userspace_access)
207 _C_LABEL(block_userspace_access):
212 * fubyte(caddr_t uaddr);
213 * Fetch a byte from the user's address space.
226 str r1, [r2, #PCB_ONFAULT]
231 str r1, [r2, #PCB_ONFAULT]
237 * Handle faults from [fs]u*(). Clean up and return -1.
242 str r0, [r2, #PCB_ONFAULT]
247 * Handle faults from [fs]u*(). Clean up and return -1. This differs from
248 * fusufault() in that trap() will recognise it and return immediately rather
249 * than trying to page fault.
252 /* label must be global as fault.c references it */
253 .global _C_LABEL(fusubailout)
254 _C_LABEL(fusubailout):
256 str r0, [r2, #PCB_ONFAULT]
262 * Handle earlier faults from [fs]u*(), due to no pcb
267 adr r0, fusupcbfaulttext
271 .asciz "Yikes - no valid PCB during fusuxxx() addr=%08x\n"
276 * suword(caddr_t uaddr, int x);
277 * Store an int in the user's address space.
291 str r3, [r2, #PCB_ONFAULT]
296 str r0, [r2, #PCB_ONFAULT]
302 * suswintr(caddr_t uaddr, short x);
303 * Store a short in the user's address space. Can be called during an
308 ldr r2, Lblock_userspace_access
311 mvnne r0, #0x00000000
322 adr r3, _C_LABEL(fusubailout)
323 str r3, [r2, #PCB_ONFAULT]
335 str r0, [r2, #PCB_ONFAULT]
340 * susword(caddr_t uaddr, short x);
341 * Store a short in the user's address space.
354 str r3, [r2, #PCB_ONFAULT]
366 str r0, [r2, #PCB_ONFAULT]
371 * subyte(caddr_t uaddr, char x);
372 * Store a byte in the user's address space.
386 str r3, [r2, #PCB_ONFAULT]
390 str r0, [r2, #PCB_ONFAULT]