diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h index 68d92a22f..4b601d26c 100644 --- a/arch/arm/include/asm/types.h +++ b/arch/arm/include/asm/types.h @@ -6,6 +6,7 @@ #include #include "protobuf/core.pb-c.h" +#include "asm-generic/page.h" #include "asm/bitops.h" #include "asm/int.h" @@ -92,14 +93,6 @@ struct user_vfp_exc { #define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0) #define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0) -#ifndef PAGE_SIZE -# define PAGE_SIZE 4096 -#endif - -#ifndef PAGE_MASK -# define PAGE_MASK (~(PAGE_SIZE - 1)) -#endif - #define REG_RES(regs) ((regs).ARM_r0) #define REG_IP(regs) ((regs).ARM_pc) #define REG_SYSCALL_NR(regs) ((regs).ARM_r7) diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h index b0e541111..e056570c7 100644 --- a/arch/x86/include/asm/types.h +++ b/arch/x86/include/asm/types.h @@ -4,6 +4,7 @@ #include #include +#include "asm-generic/page.h" #include "asm/bitops.h" #include "asm/int.h" #include "asm/prlimit.h" @@ -108,14 +109,6 @@ typedef struct { #define ASSIGN_TYPED(a, b) do { a = (typeof(a))b; } while (0) #define ASSIGN_MEMBER(a,b,m) do { ASSIGN_TYPED((a)->m, (b)->m); } while (0) -#ifndef PAGE_SIZE -# define PAGE_SIZE 4096 -#endif - -#ifndef PAGE_MASK -# define PAGE_MASK (~(PAGE_SIZE - 1)) -#endif - #define TASK_SIZE ((1UL << 47) - PAGE_SIZE) typedef u64 auxv_t; diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h new file mode 100644 index 000000000..02d90b528 --- /dev/null +++ b/include/asm-generic/page.h @@ -0,0 +1,18 @@ +#ifndef __CR_ASM_GENERIC_PAGE_H__ +#define __CR_ASM_GENERIC_PAGE_H__ + +#ifndef PAGE_SHIFT +# define PAGE_SHIFT 12 +#endif + +#ifndef PAGE_SIZE +# define PAGE_SIZE (1UL << PAGE_SHIFT) +#endif + +#ifndef PAGE_MASK +# define PAGE_MASK (~(PAGE_SIZE - 1)) +#endif + +#define PAGE_PFN(addr) ((addr) / PAGE_SIZE) + +#endif /* __CR_ASM_GENERIC_PAGE_H__ */