uaccess.h (26509034bef198525d5936c116cbd0c3fa491c0b) uaccess.h (12700c17fc286149324f92d6d380bc48e43f253d)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __M68K_UACCESS_H
3#define __M68K_UACCESS_H
4
5#ifdef CONFIG_MMU
6
7/*
8 * User space memory access functions
9 */
10#include <linux/compiler.h>
11#include <linux/types.h>
12#include <asm/extable.h>
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __M68K_UACCESS_H
3#define __M68K_UACCESS_H
4
5#ifdef CONFIG_MMU
6
7/*
8 * User space memory access functions
9 */
10#include <linux/compiler.h>
11#include <linux/types.h>
12#include <asm/extable.h>
13#include <asm-generic/access_ok.h>
13
14
14/* We let the MMU do all checking */
15static inline int access_ok(const void __user *ptr,
16 unsigned long size)
17{
18 unsigned long limit = TASK_SIZE;
19 unsigned long addr = (unsigned long)ptr;
20
21 if (IS_ENABLED(CONFIG_CPU_HAS_ADDRESS_SPACES) ||
22 !IS_ENABLED(CONFIG_MMU))
23 return 1;
24
25 return (size <= limit) && (addr <= (limit - size));
26}
27
28/*
29 * Not all varients of the 68k family support the notion of address spaces.
30 * The traditional 680x0 parts do, and they use the sfc/dfc registers and
31 * the "moves" instruction to access user space from kernel space. Other
32 * family members like ColdFire don't support this, and only have a single
33 * address space, and use the usual "move" instruction for user space access.
34 *
35 * Outside of this difference the user space access functions are the same.

--- 430 unchanged lines hidden ---
15/*
16 * Not all varients of the 68k family support the notion of address spaces.
17 * The traditional 680x0 parts do, and they use the sfc/dfc registers and
18 * the "moves" instruction to access user space from kernel space. Other
19 * family members like ColdFire don't support this, and only have a single
20 * address space, and use the usual "move" instruction for user space access.
21 *
22 * Outside of this difference the user space access functions are the same.

--- 430 unchanged lines hidden ---