summaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/uaccess.c
blob: dd33f040c52631bb1c5b5dd1a0b659b8e9693f4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
 * Licensed under the GPL
 */

/*
 * These are here rather than tt/uaccess.c because skas mode needs them in
 * order to do SIGBUS recovery when a tmpfs mount runs out of room.
 */

#include <linux/string.h>
#include "os.h"

static void __do_copy(void *to, const void *from, int n)
{
	memcpy(to, from, n);
}


int __do_copy_to_user(void *to, const void *from, int n,
		      void **fault_addr, jmp_buf **fault_catcher)
{
	unsigned long fault;
	int faulted;

	fault = __do_user_copy(to, from, n, fault_addr, fault_catcher,
			       __do_copy, &faulted);
	if (!faulted)
		return 0;
	else
		return n - (fault - (unsigned long) to);
}