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$");
43 #define GET_PCB(tmp) \
44 mrc p15, 0, tmp, c13, c0, 4; \
45 add tmp, tmp, #(TD_PCB)
48 * casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp,
53 EENTRY_NP(casueword32)
54 stmfd sp!, {r4, r5, r6}
56 ldr r4, =(VM_MAXUSER_ADDRESS-3)
66 ldmfdeq sp!, {r4, r5, r6}
70 adr r4, .Lcasuwordfault
71 str r4, [r6, #PCB_ONFAULT]
79 str r0, [r6, #PCB_ONFAULT]
82 ldmfd sp!, {r4, r5, r6}
88 * Handle faults from casuword. Clean up and return -1.
93 str r0, [r6, #PCB_ONFAULT]
95 ldmfd sp!, {r4, r5, r6}
99 * fueword(caddr_t uaddr, long *val);
100 * Fetch an int from the user's address space.
105 ldr r3, =(VM_MAXUSER_ADDRESS-3)
119 str r3, [r2, #PCB_ONFAULT]
125 str r0, [r2, #PCB_ONFAULT]
131 * fusword(caddr_t uaddr);
132 * Fetch a short from the user's address space.
136 ldr r3, =(VM_MAXUSER_ADDRESS-1)
150 str r1, [r2, #PCB_ONFAULT]
154 orr r0, r3, ip, asl #8
156 str r1, [r2, #PCB_ONFAULT]
161 * fubyte(caddr_t uaddr);
162 * Fetch a byte from the user's address space.
166 ldr r3, =VM_MAXUSER_ADDRESS
180 str r1, [r2, #PCB_ONFAULT]
185 str r1, [r2, #PCB_ONFAULT]
191 * Handle faults from [fs]u*(). Clean up and return -1.
196 str r0, [r2, #PCB_ONFAULT]
202 * Handle earlier faults from [fs]u*(), due to no pcb
207 adr r0, fusupcbfaulttext
211 .asciz "Yikes - no valid PCB during fusuxxx() addr=%08x\n"
216 * suword(caddr_t uaddr, int x);
217 * Store an int in the user's address space.
222 ldr r3, =(VM_MAXUSER_ADDRESS-3)
236 str r3, [r2, #PCB_ONFAULT]
241 str r0, [r2, #PCB_ONFAULT]
247 * susword(caddr_t uaddr, short x);
248 * Store a short in the user's address space.
252 ldr r3, =(VM_MAXUSER_ADDRESS-1)
266 str r3, [r2, #PCB_ONFAULT]
273 str r0, [r2, #PCB_ONFAULT]
278 * subyte(caddr_t uaddr, char x);
279 * Store a byte in the user's address space.
283 ldr r3, =VM_MAXUSER_ADDRESS
298 str r3, [r2, #PCB_ONFAULT]
302 str r0, [r2, #PCB_ONFAULT]