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; \
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 ___copy_in_user: /* %o0=dst, %o1=src, %o2=len */
36 /* Writing to %asi is _expensive_ so we hardcode it.
37 * Reading %asi to check for KERNEL_DS is comparatively
42 bne,pn %icc, memcpy_user_stub
59 1: subcc %o4, 0x8, %o4
60 EX(ldxa [%o1] %asi, %o5)
61 EX(stxa %o5, [%o1 + %o3] ASI_AIUS)
68 EX(lduwa [%o1] %asi, %o5)
69 EX(stwa %o5, [%o1 + %o3] ASI_AIUS)
77 80: /* 0 < len <= 16 */
84 EX(lduwa [%o1] %asi, %g1)
85 EX(stwa %g1, [%o1 + %o3] ASI_AIUS)
95 EX(lduba [%o1] %asi, %g1)
96 EX(stba %g1, [%o1 + %o3] ASI_AIUS)
102 /* Act like copy_{to,in}_user(), ie. return zero instead
103 * of original destination pointer. This is invoked when
104 * copy_{to,in}_user() finds that %asi is kernel space.
106 .globl memcpy_user_stub
114 restore %g0, %g0, %o0