/* SPDX-License-Identifier: GPL-2.0-only */1/*2* User memory copying routines for the Hexagon Kernel3*4* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.5*/67/* The right way to do this involves valignb8* The easy way to do this is only speed up src/dest similar alignment.9*/1011/*12* Copy to/from user are the same, except that for packets with a load and13* a store, I don't know how to tell which kind of exception we got.14* Therefore, we duplicate the function, and handle faulting addresses15* differently for each function16*/1718/*19* copy to user: stores can fault20*/21#define src_sav r1322#define dst_sav r1223#define src_dst_sav r13:1224#define d_dbuf r15:1425#define w_dbuf r152627#define dst r028#define src r129#define bytes r230#define loopcount r53132#define FUNCNAME raw_copy_to_user33#include "copy_user_template.S"3435/* STORE FAULTS from COPY_TO_USER */36.falign371109:382109:394109:40/* Alignment loop. r2 has been updated. Return it. */41{42r0 = r243jumpr r3144}45/* Normal copy loops. Use dst-dst_sav to compute distance */46/* dst holds best write, no need to unwind any loops */47/* X - (A - B) == X + B - A */48.falign498189:508199:514189:524199:532189:542199:551189:561199:57{58r2 += sub(dst_sav,dst)59}60{61r0 = r262jumpr r3163}6465/* COPY TO USER: only stores can fail */66.section __ex_table,"a"67.long 1100b,1109b68.long 2100b,2109b69.long 4100b,4109b70.long 8180b,8189b71.long 8190b,8199b72.long 4180b,4189b73.long 4190b,4199b74.long 2180b,2189b75.long 2190b,2199b76.long 1180b,1189b77.long 1190b,1199b78.previous798081