Merge remote-tracking branch 'battery/master'
[linux-2.6/next.git] / arch / um / os-Linux / uaccess.c
blob087ed74ffca55081ab7052d51d74103f34d3c7f5
1 /*
2 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
7 #include <stddef.h>
8 #include "longjmp.h"
10 unsigned long __do_user_copy(void *to, const void *from, int n,
11 void **fault_addr, jmp_buf **fault_catcher,
12 void (*op)(void *to, const void *from,
13 int n), int *faulted_out)
15 unsigned long *faddrp = (unsigned long *) fault_addr, ret;
17 jmp_buf jbuf;
18 *fault_catcher = &jbuf;
19 if (UML_SETJMP(&jbuf) == 0) {
20 (*op)(to, from, n);
21 ret = 0;
22 *faulted_out = 0;
24 else {
25 ret = *faddrp;
26 *faulted_out = 1;
28 *fault_addr = NULL;
29 *fault_catcher = NULL;
30 return ret;