2005-11-07 03:58:50 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
|
2008-02-05 01:31:14 -05:00
|
|
|
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
2005-11-07 03:58:50 -05:00
|
|
|
* Licensed under the GPL
|
|
|
|
*/
|
|
|
|
|
2008-02-05 01:31:14 -05:00
|
|
|
/*
|
|
|
|
* These are here rather than tt/uaccess.c because skas mode needs them in
|
2005-11-07 03:58:50 -05:00
|
|
|
* order to do SIGBUS recovery when a tmpfs mount runs out of room.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include "os.h"
|
|
|
|
|
2008-07-24 00:28:49 -04:00
|
|
|
static void __do_copy(void *to, const void *from, int n)
|
2005-11-07 03:58:50 -05:00
|
|
|
{
|
|
|
|
memcpy(to, from, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int __do_copy_to_user(void *to, const void *from, int n,
|
2007-10-16 04:27:05 -04:00
|
|
|
void **fault_addr, jmp_buf **fault_catcher)
|
2005-11-07 03:58:50 -05:00
|
|
|
{
|
|
|
|
unsigned long fault;
|
|
|
|
int faulted;
|
|
|
|
|
|
|
|
fault = __do_user_copy(to, from, n, fault_addr, fault_catcher,
|
|
|
|
__do_copy, &faulted);
|
2008-02-05 01:31:14 -05:00
|
|
|
if (!faulted)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return n - (fault - (unsigned long) to);
|
2005-11-07 03:58:50 -05:00
|
|
|
}
|