Deleted Added
full compact
copyinout.c (214749) copyinout.c (223485)
1/*-
2 * Copyright (C) 2002 Benno Rice
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 40 unchanged lines hidden (view full) ---

49 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
50 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
51 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
52 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */
55
56#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 2002 Benno Rice
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 40 unchanged lines hidden (view full) ---

49 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
50 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
51 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
52 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */
55
56#include <sys/cdefs.h>
57__FBSDID("$FreeBSD: head/sys/powerpc/aim/copyinout.c 214749 2010-11-03 16:21:47Z nwhitehorn $");
57__FBSDID("$FreeBSD: head/sys/powerpc/aim/copyinout.c 223485 2011-06-23 22:21:28Z nwhitehorn $");
58
59#include <sys/param.h>
60#include <sys/lock.h>
61#include <sys/mutex.h>
62#include <sys/systm.h>
63#include <sys/proc.h>
64
65#include <vm/vm.h>

--- 71 unchanged lines hidden (view full) ---

137{
138 struct thread *td;
139 pmap_t pm;
140 faultbuf env;
141 const char *kp;
142 char *up, *p;
143 size_t l;
144
58
59#include <sys/param.h>
60#include <sys/lock.h>
61#include <sys/mutex.h>
62#include <sys/systm.h>
63#include <sys/proc.h>
64
65#include <vm/vm.h>

--- 71 unchanged lines hidden (view full) ---

137{
138 struct thread *td;
139 pmap_t pm;
140 faultbuf env;
141 const char *kp;
142 char *up, *p;
143 size_t l;
144
145 td = PCPU_GET(curthread);
145 td = curthread;
146 pm = &td->td_proc->p_vmspace->vm_pmap;
147
148 if (setfault(env)) {
149 td->td_pcb->pcb_onfault = NULL;
150 return (EFAULT);
151 }
152
153 kp = kaddr;

--- 24 unchanged lines hidden (view full) ---

178{
179 struct thread *td;
180 pmap_t pm;
181 faultbuf env;
182 const char *up;
183 char *kp, *p;
184 size_t l;
185
146 pm = &td->td_proc->p_vmspace->vm_pmap;
147
148 if (setfault(env)) {
149 td->td_pcb->pcb_onfault = NULL;
150 return (EFAULT);
151 }
152
153 kp = kaddr;

--- 24 unchanged lines hidden (view full) ---

178{
179 struct thread *td;
180 pmap_t pm;
181 faultbuf env;
182 const char *up;
183 char *kp, *p;
184 size_t l;
185
186 td = PCPU_GET(curthread);
186 td = curthread;
187 pm = &td->td_proc->p_vmspace->vm_pmap;
188
189 if (setfault(env)) {
190 td->td_pcb->pcb_onfault = NULL;
191 return (EFAULT);
192 }
193
194 kp = kaddr;

--- 25 unchanged lines hidden (view full) ---

220 struct thread *td;
221 pmap_t pm;
222 faultbuf env;
223 const char *up;
224 char *kp;
225 size_t l;
226 int rv, c;
227
187 pm = &td->td_proc->p_vmspace->vm_pmap;
188
189 if (setfault(env)) {
190 td->td_pcb->pcb_onfault = NULL;
191 return (EFAULT);
192 }
193
194 kp = kaddr;

--- 25 unchanged lines hidden (view full) ---

220 struct thread *td;
221 pmap_t pm;
222 faultbuf env;
223 const char *up;
224 char *kp;
225 size_t l;
226 int rv, c;
227
228 td = PCPU_GET(curthread);
228 td = curthread;
229 pm = &td->td_proc->p_vmspace->vm_pmap;
230
231 if (setfault(env)) {
232 td->td_pcb->pcb_onfault = NULL;
233 return (EFAULT);
234 }
235
236 kp = kaddr;

--- 25 unchanged lines hidden (view full) ---

262int
263subyte(void *addr, int byte)
264{
265 struct thread *td;
266 pmap_t pm;
267 faultbuf env;
268 char *p;
269
229 pm = &td->td_proc->p_vmspace->vm_pmap;
230
231 if (setfault(env)) {
232 td->td_pcb->pcb_onfault = NULL;
233 return (EFAULT);
234 }
235
236 kp = kaddr;

--- 25 unchanged lines hidden (view full) ---

262int
263subyte(void *addr, int byte)
264{
265 struct thread *td;
266 pmap_t pm;
267 faultbuf env;
268 char *p;
269
270 td = PCPU_GET(curthread);
270 td = curthread;
271 pm = &td->td_proc->p_vmspace->vm_pmap;
272 p = (char *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
273
274 if (setfault(env)) {
275 td->td_pcb->pcb_onfault = NULL;
276 return (-1);
277 }
278

--- 9 unchanged lines hidden (view full) ---

288int
289suword32(void *addr, int word)
290{
291 struct thread *td;
292 pmap_t pm;
293 faultbuf env;
294 int *p;
295
271 pm = &td->td_proc->p_vmspace->vm_pmap;
272 p = (char *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
273
274 if (setfault(env)) {
275 td->td_pcb->pcb_onfault = NULL;
276 return (-1);
277 }
278

--- 9 unchanged lines hidden (view full) ---

288int
289suword32(void *addr, int word)
290{
291 struct thread *td;
292 pmap_t pm;
293 faultbuf env;
294 int *p;
295
296 td = PCPU_GET(curthread);
296 td = curthread;
297 pm = &td->td_proc->p_vmspace->vm_pmap;
298 p = (int *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
299
300 if (setfault(env)) {
301 td->td_pcb->pcb_onfault = NULL;
302 return (-1);
303 }
304

--- 9 unchanged lines hidden (view full) ---

314int
315suword(void *addr, long word)
316{
317 struct thread *td;
318 pmap_t pm;
319 faultbuf env;
320 long *p;
321
297 pm = &td->td_proc->p_vmspace->vm_pmap;
298 p = (int *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
299
300 if (setfault(env)) {
301 td->td_pcb->pcb_onfault = NULL;
302 return (-1);
303 }
304

--- 9 unchanged lines hidden (view full) ---

314int
315suword(void *addr, long word)
316{
317 struct thread *td;
318 pmap_t pm;
319 faultbuf env;
320 long *p;
321
322 td = PCPU_GET(curthread);
322 td = curthread;
323 pm = &td->td_proc->p_vmspace->vm_pmap;
324 p = (long *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
325
326 if (setfault(env)) {
327 td->td_pcb->pcb_onfault = NULL;
328 return (-1);
329 }
330

--- 23 unchanged lines hidden (view full) ---

354fubyte(const void *addr)
355{
356 struct thread *td;
357 pmap_t pm;
358 faultbuf env;
359 u_char *p;
360 int val;
361
323 pm = &td->td_proc->p_vmspace->vm_pmap;
324 p = (long *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
325
326 if (setfault(env)) {
327 td->td_pcb->pcb_onfault = NULL;
328 return (-1);
329 }
330

--- 23 unchanged lines hidden (view full) ---

354fubyte(const void *addr)
355{
356 struct thread *td;
357 pmap_t pm;
358 faultbuf env;
359 u_char *p;
360 int val;
361
362 td = PCPU_GET(curthread);
362 td = curthread;
363 pm = &td->td_proc->p_vmspace->vm_pmap;
364 p = (u_char *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
365
366 if (setfault(env)) {
367 td->td_pcb->pcb_onfault = NULL;
368 return (-1);
369 }
370

--- 9 unchanged lines hidden (view full) ---

380int32_t
381fuword32(const void *addr)
382{
383 struct thread *td;
384 pmap_t pm;
385 faultbuf env;
386 int32_t *p, val;
387
363 pm = &td->td_proc->p_vmspace->vm_pmap;
364 p = (u_char *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
365
366 if (setfault(env)) {
367 td->td_pcb->pcb_onfault = NULL;
368 return (-1);
369 }
370

--- 9 unchanged lines hidden (view full) ---

380int32_t
381fuword32(const void *addr)
382{
383 struct thread *td;
384 pmap_t pm;
385 faultbuf env;
386 int32_t *p, val;
387
388 td = PCPU_GET(curthread);
388 td = curthread;
389 pm = &td->td_proc->p_vmspace->vm_pmap;
390 p = (int32_t *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
391
392 if (setfault(env)) {
393 td->td_pcb->pcb_onfault = NULL;
394 return (-1);
395 }
396

--- 9 unchanged lines hidden (view full) ---

406long
407fuword(const void *addr)
408{
409 struct thread *td;
410 pmap_t pm;
411 faultbuf env;
412 long *p, val;
413
389 pm = &td->td_proc->p_vmspace->vm_pmap;
390 p = (int32_t *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
391
392 if (setfault(env)) {
393 td->td_pcb->pcb_onfault = NULL;
394 return (-1);
395 }
396

--- 9 unchanged lines hidden (view full) ---

406long
407fuword(const void *addr)
408{
409 struct thread *td;
410 pmap_t pm;
411 faultbuf env;
412 long *p, val;
413
414 td = PCPU_GET(curthread);
414 td = curthread;
415 pm = &td->td_proc->p_vmspace->vm_pmap;
416 p = (long *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
417
418 if (setfault(env)) {
419 td->td_pcb->pcb_onfault = NULL;
420 return (-1);
421 }
422

--- 16 unchanged lines hidden (view full) ---

439uint32_t
440casuword32(volatile uint32_t *addr, uint32_t old, uint32_t new)
441{
442 struct thread *td;
443 pmap_t pm;
444 faultbuf env;
445 uint32_t *p, val;
446
415 pm = &td->td_proc->p_vmspace->vm_pmap;
416 p = (long *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
417
418 if (setfault(env)) {
419 td->td_pcb->pcb_onfault = NULL;
420 return (-1);
421 }
422

--- 16 unchanged lines hidden (view full) ---

439uint32_t
440casuword32(volatile uint32_t *addr, uint32_t old, uint32_t new)
441{
442 struct thread *td;
443 pmap_t pm;
444 faultbuf env;
445 uint32_t *p, val;
446
447 td = PCPU_GET(curthread);
447 td = curthread;
448 pm = &td->td_proc->p_vmspace->vm_pmap;
449 p = (uint32_t *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
450
451 set_user_sr(pm,(const void *)(vm_offset_t)addr);
452
453 if (setfault(env)) {
454 td->td_pcb->pcb_onfault = NULL;
455 return (-1);

--- 28 unchanged lines hidden (view full) ---

484u_long
485casuword(volatile u_long *addr, u_long old, u_long new)
486{
487 struct thread *td;
488 pmap_t pm;
489 faultbuf env;
490 u_long *p, val;
491
448 pm = &td->td_proc->p_vmspace->vm_pmap;
449 p = (uint32_t *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
450
451 set_user_sr(pm,(const void *)(vm_offset_t)addr);
452
453 if (setfault(env)) {
454 td->td_pcb->pcb_onfault = NULL;
455 return (-1);

--- 28 unchanged lines hidden (view full) ---

484u_long
485casuword(volatile u_long *addr, u_long old, u_long new)
486{
487 struct thread *td;
488 pmap_t pm;
489 faultbuf env;
490 u_long *p, val;
491
492 td = PCPU_GET(curthread);
492 td = curthread;
493 pm = &td->td_proc->p_vmspace->vm_pmap;
494 p = (u_long *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
495
496 set_user_sr(pm,(const void *)(vm_offset_t)addr);
497
498 if (setfault(env)) {
499 td->td_pcb->pcb_onfault = NULL;
500 return (-1);

--- 22 unchanged lines hidden ---
493 pm = &td->td_proc->p_vmspace->vm_pmap;
494 p = (u_long *)(USER_ADDR + ((uintptr_t)addr & ~SEGMENT_MASK));
495
496 set_user_sr(pm,(const void *)(vm_offset_t)addr);
497
498 if (setfault(env)) {
499 td->td_pcb->pcb_onfault = NULL;
500 return (-1);

--- 22 unchanged lines hidden ---