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 * casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp,
60 EENTRY_NP(casueword32)
61 stmfd sp!, {r4, r5, r6}
63 ldr r4, =(VM_MAXUSER_ADDRESS-3)
73 ldmfdeq sp!, {r4, r5, r6}
77 adr r4, .Lcasuwordfault
78 str r4, [r6, #PCB_ONFAULT]
92 str r0, [r6, #PCB_ONFAULT]
97 ldmfd sp!, {r4, r5, r6}
103 * Handle faults from casuword. Clean up and return -1.
108 str r0, [r6, #PCB_ONFAULT]
110 ldmfd sp!, {r4, r5, r6}
114 * fueword(caddr_t uaddr, long *val);
115 * Fetch an int from the user's address space.
120 ldr r3, =(VM_MAXUSER_ADDRESS-3)
134 str r3, [r2, #PCB_ONFAULT]
140 str r0, [r2, #PCB_ONFAULT]
146 * fusword(caddr_t uaddr);
147 * Fetch a short from the user's address space.
151 ldr r3, =(VM_MAXUSER_ADDRESS-1)
165 str r1, [r2, #PCB_ONFAULT]
170 orr r0, ip, r3, asl #8
172 orr r0, r3, ip, asl #8
175 str r1, [r2, #PCB_ONFAULT]
180 * fubyte(caddr_t uaddr);
181 * Fetch a byte from the user's address space.
185 ldr r3, =VM_MAXUSER_ADDRESS
199 str r1, [r2, #PCB_ONFAULT]
204 str r1, [r2, #PCB_ONFAULT]
210 * Handle faults from [fs]u*(). Clean up and return -1.
215 str r0, [r2, #PCB_ONFAULT]
221 * Handle earlier faults from [fs]u*(), due to no pcb
226 adr r0, fusupcbfaulttext
230 .asciz "Yikes - no valid PCB during fusuxxx() addr=%08x\n"
235 * suword(caddr_t uaddr, int x);
236 * Store an int in the user's address space.
241 ldr r3, =(VM_MAXUSER_ADDRESS-3)
255 str r3, [r2, #PCB_ONFAULT]
260 str r0, [r2, #PCB_ONFAULT]
266 * susword(caddr_t uaddr, short x);
267 * Store a short in the user's address space.
271 ldr r3, =(VM_MAXUSER_ADDRESS-1)
285 str r3, [r2, #PCB_ONFAULT]
297 str r0, [r2, #PCB_ONFAULT]
302 * subyte(caddr_t uaddr, char x);
303 * Store a byte in the user's address space.
307 ldr r3, =VM_MAXUSER_ADDRESS
322 str r3, [r2, #PCB_ONFAULT]
326 str r0, [r2, #PCB_ONFAULT]