1 /* copy_in_user.S: Copy from userspace to userspace.
3 * Copyright (C) 1999, 2000, 2004 David S. Miller (davem@redhat.com)
16 .section __ex_table,"a";\
22 .register %g2,#scratch
23 .register %g3,#scratch
28 /* Don't try to get too fancy here, just nice and
29 * simple. This is predominantly used for well aligned
30 * small copies in the compat layer. It is also used
31 * to copy register windows around during thread cloning.
34 .globl ___copy_in_user
35 .type ___copy_in_user,#function
36 ___copy_in_user: /* %o0=dst, %o1=src, %o2=len */
37 /* Writing to %asi is _expensive_ so we hardcode it.
38 * Reading %asi to check for KERNEL_DS is comparatively
43 bne,pn %icc, memcpy_user_stub
60 1: subcc %o4, 0x8, %o4
61 EX(ldxa [%o1] %asi, %o5)
62 EX(stxa %o5, [%o1 + %o3] ASI_AIUS)
69 EX(lduwa [%o1] %asi, %o5)
70 EX(stwa %o5, [%o1 + %o3] ASI_AIUS)
78 80: /* 0 < len <= 16 */
85 EX(lduwa [%o1] %asi, %g1)
86 EX(stwa %g1, [%o1 + %o3] ASI_AIUS)
96 EX(lduba [%o1] %asi, %g1)
97 EX(stba %g1, [%o1 + %o3] ASI_AIUS)
103 .size ___copy_in_user, .-___copy_in_user
105 /* Act like copy_{to,in}_user(), ie. return zero instead
106 * of original destination pointer. This is invoked when
107 * copy_{to,in}_user() finds that %asi is kernel space.
109 .globl memcpy_user_stub
110 .type memcpy_user_stub,#function
118 restore %g0, %g0, %o0
119 .size memcpy_user_stub, .-memcpy_user_stub