Can somebody expalin the __copy_user?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everybody,

I want to know how memory copying from and to user space worked.
When I come to the __copy_user,

 #define __copy_user(to,from,size)     \
do {         \
 int __d0, __d1;       \
 __asm__ __volatile__(      \
  "0: rep; movsl\n"     \
  " movl %3,%0\n"     \
  "1: rep; movsb\n"     \
  "2:\n"       \
  ".section .fixup,\"ax\"\n"    \
  "3: lea 0(%3,%0,4),%0\n"    \
  " jmp 2b\n"     \
  ".previous\n"      \
  ".section __ex_table,\"a\"\n"    \
  " .align 4\n"     \
  " .long 0b,3b\n"     \
  " .long 1b,2b\n"     \
  ".previous"      \
  : "=&c"(size), "=&D" (__d0), "=&S" (__d1)  \
  : "r"(size & 3), "0"(size / 4), "1"(to), "2"(from) \
  : "memory");      \
} while (0)

The first three asm lines are easy to understand, but what the rest mean?
Especially what's the meaning of ".previous" and what's usage
of the section named ".fixup"?

Thanks in advance.

Yours Sincerely,
Jim Chen


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux