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/asmacros.h>
38 #include <machine/armreg.h>
40 __FBSDID("$FreeBSD$");
43 #define GET_PCB(tmp) \
44 mrc p15, 0, tmp, c13, c0, 4; \
45 add tmp, tmp, #(PC_CURPCB)
48 .word _C_LABEL(__pcpu) + PC_CURPCB
49 #define GET_PCB(tmp) \
54 * fuword(caddr_t uaddr);
55 * Fetch an int from the user's address space.
68 adr r4, .Lcasuwordfault
69 str r4, [r3, #PCB_ONFAULT]
77 str r1, [r3, #PCB_ONFAULT]
83 * Handle faults from casuword. Clean up and return -1.
88 str r0, [r3, #PCB_ONFAULT]
94 * fuword(caddr_t uaddr);
95 * Fetch an int from the user's address space.
109 str r1, [r2, #PCB_ONFAULT]
114 str r1, [r2, #PCB_ONFAULT]
121 * fusword(caddr_t uaddr);
122 * Fetch a short from the user's address space.
135 str r1, [r2, #PCB_ONFAULT]
140 orr r0, ip, r3, asl #8
142 orr r0, r3, ip, asl #8
145 str r1, [r2, #PCB_ONFAULT]
150 * fuswintr(caddr_t uaddr);
151 * Fetch a short from the user's address space. Can be called during an
156 ldr r2, Lblock_userspace_access
159 mvnne r0, #0x00000000
170 adr r1, _C_LABEL(fusubailout)
171 str r1, [r2, #PCB_ONFAULT]
176 orr r0, ip, r3, asl #8
178 orr r0, r3, ip, asl #8
182 str r1, [r2, #PCB_ONFAULT]
186 Lblock_userspace_access:
187 .word _C_LABEL(block_userspace_access)
191 .global _C_LABEL(block_userspace_access)
192 _C_LABEL(block_userspace_access):
197 * fubyte(caddr_t uaddr);
198 * Fetch a byte from the user's address space.
211 str r1, [r2, #PCB_ONFAULT]
216 str r1, [r2, #PCB_ONFAULT]
222 * Handle faults from [fs]u*(). Clean up and return -1.
227 str r0, [r2, #PCB_ONFAULT]
232 * Handle faults from [fs]u*(). Clean up and return -1. This differs from
233 * fusufault() in that trap() will recognise it and return immediately rather
234 * than trying to page fault.
237 /* label must be global as fault.c references it */
238 .global _C_LABEL(fusubailout)
239 _C_LABEL(fusubailout):
241 str r0, [r2, #PCB_ONFAULT]
247 * Handle earlier faults from [fs]u*(), due to no pcb
252 adr r0, fusupcbfaulttext
256 .asciz "Yikes - no valid PCB during fusuxxx() addr=%08x\n"
261 * suword(caddr_t uaddr, int x);
262 * Store an int in the user's address space.
276 str r3, [r2, #PCB_ONFAULT]
281 str r0, [r2, #PCB_ONFAULT]
287 * suswintr(caddr_t uaddr, short x);
288 * Store a short in the user's address space. Can be called during an
293 ldr r2, Lblock_userspace_access
296 mvnne r0, #0x00000000
307 adr r3, _C_LABEL(fusubailout)
308 str r3, [r2, #PCB_ONFAULT]
320 str r0, [r2, #PCB_ONFAULT]
325 * susword(caddr_t uaddr, short x);
326 * Store a short in the user's address space.
339 str r3, [r2, #PCB_ONFAULT]
351 str r0, [r2, #PCB_ONFAULT]
356 * subyte(caddr_t uaddr, char x);
357 * Store a byte in the user's address space.
371 str r3, [r2, #PCB_ONFAULT]
375 str r0, [r2, #PCB_ONFAULT]