uaccess.c 746 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
  3. * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
  4. * Licensed under the GPL
  5. */
  6. /* These are here rather than tt/uaccess.c because skas mode needs them in
  7. * order to do SIGBUS recovery when a tmpfs mount runs out of room.
  8. */
  9. #include <linux/string.h>
  10. #include "os.h"
  11. void __do_copy(void *to, const void *from, int n)
  12. {
  13. memcpy(to, from, n);
  14. }
  15. int __do_copy_to_user(void *to, const void *from, int n,
  16. void **fault_addr, void **fault_catcher)
  17. {
  18. unsigned long fault;
  19. int faulted;
  20. fault = __do_user_copy(to, from, n, fault_addr, fault_catcher,
  21. __do_copy, &faulted);
  22. if(!faulted) return(0);
  23. else return(n - (fault - (unsigned long) to));
  24. }