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$");
44 #define GET_PCB(tmp) \
45 mrc p15, 0, tmp, c13, c0, 4; \
46 add tmp, tmp, #(TD_PCB)
49 .word _C_LABEL(__pcpu) + PC_CURPCB
50 #define GET_PCB(tmp) \
55 * fuword(caddr_t uaddr);
56 * Fetch an int from the user's address space.
69 adr r4, .Lcasuwordfault
70 str r4, [r3, #PCB_ONFAULT]
94 str r1, [r3, #PCB_ONFAULT]
100 * Handle faults from casuword. Clean up and return -1.
105 str r0, [r3, #PCB_ONFAULT]
111 * fuword(caddr_t uaddr);
112 * Fetch an int from the user's address space.
126 str r1, [r2, #PCB_ONFAULT]
131 str r1, [r2, #PCB_ONFAULT]
138 * fusword(caddr_t uaddr);
139 * Fetch a short from the user's address space.
152 str r1, [r2, #PCB_ONFAULT]
157 orr r0, ip, r3, asl #8
159 orr r0, r3, ip, asl #8
162 str r1, [r2, #PCB_ONFAULT]
167 * fuswintr(caddr_t uaddr);
168 * Fetch a short from the user's address space. Can be called during an
173 ldr r2, Lblock_userspace_access
176 mvnne r0, #0x00000000
187 adr r1, _C_LABEL(fusubailout)
188 str r1, [r2, #PCB_ONFAULT]
193 orr r0, ip, r3, asl #8
195 orr r0, r3, ip, asl #8
199 str r1, [r2, #PCB_ONFAULT]
203 Lblock_userspace_access:
204 .word _C_LABEL(block_userspace_access)
208 .global _C_LABEL(block_userspace_access)
209 _C_LABEL(block_userspace_access):
214 * fubyte(caddr_t uaddr);
215 * Fetch a byte from the user's address space.
228 str r1, [r2, #PCB_ONFAULT]
233 str r1, [r2, #PCB_ONFAULT]
239 * Handle faults from [fs]u*(). Clean up and return -1.
244 str r0, [r2, #PCB_ONFAULT]
249 * Handle faults from [fs]u*(). Clean up and return -1. This differs from
250 * fusufault() in that trap() will recognise it and return immediately rather
251 * than trying to page fault.
254 /* label must be global as fault.c references it */
255 .global _C_LABEL(fusubailout)
256 _C_LABEL(fusubailout):
258 str r0, [r2, #PCB_ONFAULT]
264 * Handle earlier faults from [fs]u*(), due to no pcb
269 adr r0, fusupcbfaulttext
273 .asciz "Yikes - no valid PCB during fusuxxx() addr=%08x\n"
278 * suword(caddr_t uaddr, int x);
279 * Store an int in the user's address space.
293 str r3, [r2, #PCB_ONFAULT]
298 str r0, [r2, #PCB_ONFAULT]
304 * suswintr(caddr_t uaddr, short x);
305 * Store a short in the user's address space. Can be called during an
310 ldr r2, Lblock_userspace_access
313 mvnne r0, #0x00000000
324 adr r3, _C_LABEL(fusubailout)
325 str r3, [r2, #PCB_ONFAULT]
337 str r0, [r2, #PCB_ONFAULT]
342 * susword(caddr_t uaddr, short x);
343 * Store a short in the user's address space.
356 str r3, [r2, #PCB_ONFAULT]
368 str r0, [r2, #PCB_ONFAULT]
373 * subyte(caddr_t uaddr, char x);
374 * Store a byte in the user's address space.
388 str r3, [r2, #PCB_ONFAULT]
392 str r0, [r2, #PCB_ONFAULT]