1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2011 Texas Instruments Incorporated
4 * Author: Mark Salter <msalter@redhat.com>
6 #ifndef _ASM_C6X_UACCESS_H
7 #define _ASM_C6X_UACCESS_H
9 #include <linux/types.h>
10 #include <linux/compiler.h>
11 #include <linux/string.h>
14 * C6X supports unaligned 32 and 64 bit loads and stores.
16 static inline __must_check
unsigned long
17 raw_copy_from_user(void *to
, const void __user
*from
, unsigned long n
)
22 if (__builtin_constant_p(n
)) {
25 *(u8
*)to
= *(u8 __force
*)from
;
28 asm volatile ("ldnw .d1t1 *%2,%0\n"
36 asm volatile ("ldndw .d1t1 *%2,%0\n"
38 "stndw .d1t1 %0,*%1\n"
48 memcpy(to
, (const void __force
*)from
, n
);
52 static inline __must_check
unsigned long
53 raw_copy_to_user(void __user
*to
, const void *from
, unsigned long n
)
58 if (__builtin_constant_p(n
)) {
61 *(u8 __force
*)to
= *(u8
*)from
;
64 asm volatile ("ldnw .d1t1 *%2,%0\n"
72 asm volatile ("ldndw .d1t1 *%2,%0\n"
74 "stndw .d1t1 %0,*%1\n"
84 memcpy((void __force
*)to
, from
, n
);
87 #define INLINE_COPY_FROM_USER
88 #define INLINE_COPY_TO_USER
90 extern int _access_ok(unsigned long addr
, unsigned long size
);
91 #ifdef CONFIG_ACCESS_CHECK
92 #define __access_ok _access_ok
95 #include <asm-generic/uaccess.h>
97 #endif /* _ASM_C6X_UACCESS_H */