mirror of
https://github.com/torvalds/linux.git
synced 2026-12-02 11:34:58 +00:00
The include/linux/pgtable.h is going to be the home of generic page table manipulation functions. Start with moving asm-generic/pgtable.h to include/linux/pgtable.h and make the latter include asm/pgtable.h. Signed-off-by: Mike Rapoport <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Cain <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Chris Zankel <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Greg Ungerer <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Guo Ren <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Helge Deller <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ley Foon Tan <[email protected]> Cc: Mark Salter <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Matt Turner <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Simek <[email protected]> Cc: Nick Hu <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Rich Felker <[email protected]> Cc: Russell King <[email protected]> Cc: Stafford Horne <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: Vincent Chen <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yoshinori Sato <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
/*
|
|
* Support for user memory access from kernel. This will
|
|
* probably be inlined for performance at some point, but
|
|
* for ease of debug, and to a lesser degree for code size,
|
|
* we implement here as subroutines.
|
|
*/
|
|
#include <linux/types.h>
|
|
#include <linux/uaccess.h>
|
|
#include <linux/pgtable.h>
|
|
|
|
/*
|
|
* For clear_user(), exploit previously defined copy_to_user function
|
|
* and the fact that we've got a handy zero page defined in kernel/head.S
|
|
*
|
|
* dczero here would be even faster.
|
|
*/
|
|
__kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count)
|
|
{
|
|
long uncleared;
|
|
|
|
while (count > PAGE_SIZE) {
|
|
uncleared = raw_copy_to_user(dest, &empty_zero_page, PAGE_SIZE);
|
|
if (uncleared)
|
|
return count - (PAGE_SIZE - uncleared);
|
|
count -= PAGE_SIZE;
|
|
dest += PAGE_SIZE;
|
|
}
|
|
if (count)
|
|
count = raw_copy_to_user(dest, &empty_zero_page, count);
|
|
|
|
return count;
|
|
}
|
|
|
|
unsigned long clear_user_hexagon(void __user *dest, unsigned long count)
|
|
{
|
|
if (!access_ok(dest, count))
|
|
return count;
|
|
else
|
|
return __clear_user_hexagon(dest, count);
|
|
}
|