x86: page.h: unify page copying and clearing
# HG changeset patch # User Jeremy Fitzhardinge <jeremy@xensource.com> # Date 1199317362 28800 # Node ID 4d9a413a0f4c1d98dbea704f0366457b5117045d # Parent ba0ec40a50a7aef1a3153cea124c35e261f5a2df x86: page.h: unify page copying and clearing Move, and to some extent unify, the various page copying and clearing functions. The only unification here is that both architectures use the same function for copying/clearing user and kernel pages. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
83a5101bf2
commit
345b904c3f
|
@ -70,6 +70,11 @@
|
||||||
#define KERNEL_TEXT_SIZE (40*1024*1024)
|
#define KERNEL_TEXT_SIZE (40*1024*1024)
|
||||||
#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
|
#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
void clear_page(void *page);
|
||||||
|
void copy_page(void *to, void *from);
|
||||||
|
#endif /* !__ASSEMBLY__ */
|
||||||
|
|
||||||
#endif /* CONFIG_X86_64 */
|
#endif /* CONFIG_X86_64 */
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
|
@ -98,6 +103,34 @@
|
||||||
#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
|
#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
#ifdef CONFIG_X86_USE_3DNOW
|
||||||
|
#include <asm/mmx.h>
|
||||||
|
|
||||||
|
static inline void clear_page(void *page)
|
||||||
|
{
|
||||||
|
mmx_clear_page(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void copy_page(void *to, void *from)
|
||||||
|
{
|
||||||
|
mmx_copy_page(to, from);
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_X86_USE_3DNOW */
|
||||||
|
#include <linux/string.h>
|
||||||
|
|
||||||
|
static inline void clear_page(void *page)
|
||||||
|
{
|
||||||
|
memset(page, 0, PAGE_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void copy_page(void *to, void *from)
|
||||||
|
{
|
||||||
|
memcpy(to, from, PAGE_SIZE);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_X86_3DNOW */
|
||||||
|
#endif /* !__ASSEMBLY__ */
|
||||||
|
|
||||||
#endif /* CONFIG_X86_32 */
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
|
#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
|
||||||
|
@ -107,6 +140,28 @@
|
||||||
VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
|
VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
struct page;
|
||||||
|
|
||||||
|
static void inline clear_user_page(void *page, unsigned long vaddr,
|
||||||
|
struct page *pg)
|
||||||
|
{
|
||||||
|
clear_page(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void inline copy_user_page(void *to, void *from, unsigned long vaddr,
|
||||||
|
struct page *topage)
|
||||||
|
{
|
||||||
|
copy_page(to, from);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
|
||||||
|
alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
|
||||||
|
#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
# include "page_32.h"
|
# include "page_32.h"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -4,59 +4,6 @@
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
#include <linux/string.h>
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_USE_3DNOW
|
|
||||||
|
|
||||||
#include <asm/mmx.h>
|
|
||||||
|
|
||||||
static inline void clear_page(void *page)
|
|
||||||
{
|
|
||||||
mmx_clear_page(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void copy_page(void *to, void *from)
|
|
||||||
{
|
|
||||||
mmx_copy_page(to, from);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/*
|
|
||||||
* On older X86 processors it's not a win to use MMX here it seems.
|
|
||||||
* Maybe the K6-III ?
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline void clear_page(void *page)
|
|
||||||
{
|
|
||||||
memset(page, 0, PAGE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void copy_page(void *to, void *from)
|
|
||||||
{
|
|
||||||
memcpy(to, from, PAGE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct page;
|
|
||||||
|
|
||||||
static void inline clear_user_page(void *page, unsigned long vaddr,
|
|
||||||
struct page *pg)
|
|
||||||
{
|
|
||||||
clear_page(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void inline copy_user_page(void *to, void *from, unsigned long vaddr,
|
|
||||||
struct page *topage)
|
|
||||||
{
|
|
||||||
copy_page(to, from);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
|
|
||||||
alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
|
|
||||||
#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are used to make use of C type-checking..
|
* These are used to make use of C type-checking..
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,26 +7,6 @@
|
||||||
extern unsigned long end_pfn;
|
extern unsigned long end_pfn;
|
||||||
extern unsigned long end_pfn_map;
|
extern unsigned long end_pfn_map;
|
||||||
|
|
||||||
void clear_page(void *page);
|
|
||||||
void copy_page(void *to, void *from);
|
|
||||||
|
|
||||||
struct page;
|
|
||||||
|
|
||||||
static void inline clear_user_page(void *page, unsigned long vaddr,
|
|
||||||
struct page *pg)
|
|
||||||
{
|
|
||||||
clear_page(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void inline copy_user_page(void *to, void *from, unsigned long vaddr,
|
|
||||||
struct page *topage)
|
|
||||||
{
|
|
||||||
copy_page(to, from);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
|
|
||||||
alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
|
|
||||||
#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
|
|
||||||
/*
|
/*
|
||||||
* These are used to make use of C type-checking..
|
* These are used to make use of C type-checking..
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue