// SPDX-License-Identifier: GPL-2.0-only1/*2* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.3*/45/*6* Support for user memory access from kernel. This will7* probably be inlined for performance at some point, but8* for ease of debug, and to a lesser degree for code size,9* we implement here as subroutines.10*/11#include <linux/types.h>12#include <linux/uaccess.h>13#include <linux/pgtable.h>1415/*16* For clear_user(), exploit previously defined copy_to_user function17* and the fact that we've got a handy zero page defined in kernel/head.S18*19* dczero here would be even faster.20*/21__kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count)22{23long uncleared;2425while (count > PAGE_SIZE) {26uncleared = raw_copy_to_user(dest, &empty_zero_page, PAGE_SIZE);27if (uncleared)28return count - (PAGE_SIZE - uncleared);29count -= PAGE_SIZE;30dest += PAGE_SIZE;31}32if (count)33count = raw_copy_to_user(dest, &empty_zero_page, count);3435return count;36}373839