blob: 897e11ad8124a0eb977dcbf54eec37254fbb6958 [file] [log] [blame]
GuanXuetao77c93b22011-02-26 18:49:26 +08001/*
2 * linux/arch/unicore32/include/asm/uaccess.h
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Copyright (C) 2001-2010 GUAN Xue-tao
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __UNICORE_UACCESS_H__
13#define __UNICORE_UACCESS_H__
14
15#include <linux/thread_info.h>
16#include <linux/errno.h>
17
18#include <asm/memory.h>
GuanXuetao77c93b22011-02-26 18:49:26 +080019
20#define __copy_from_user __copy_from_user
21#define __copy_to_user __copy_to_user
22#define __strncpy_from_user __strncpy_from_user
23#define __strnlen_user __strnlen_user
24#define __clear_user __clear_user
25
26#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS))
27#define __user_ok(addr, size) (((size) <= TASK_SIZE) \
28 && ((addr) <= TASK_SIZE - (size)))
29#define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size)))
30
31extern unsigned long __must_check
32__copy_from_user(void *to, const void __user *from, unsigned long n);
33extern unsigned long __must_check
34__copy_to_user(void __user *to, const void *from, unsigned long n);
35extern unsigned long __must_check
36__clear_user(void __user *addr, unsigned long n);
37extern unsigned long __must_check
38__strncpy_from_user(char *to, const char __user *from, unsigned long count);
39extern unsigned long
40__strnlen_user(const char __user *s, long n);
41
42#include <asm-generic/uaccess.h>
43
44extern int fixup_exception(struct pt_regs *regs);
45
46#endif /* __UNICORE_UACCESS_H__ */