[PATCH] asm-generic: Introduce page.h
Cyrill Gorcunov
gorcunov at openvz.org
Thu Feb 20 06:00:50 PST 2014
At the moment we are using 4K pages all the time,
so instead of copying code over all archs we're
supporting -- add asm-generic/page.h header.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
arch/arm/include/asm/types.h | 9 +--------
arch/x86/include/asm/types.h | 9 +--------
include/asm-generic/page.h | 18 ++++++++++++++++++
3 files changed, 20 insertions(+), 16 deletions(-)
create mode 100644 include/asm-generic/page.h
diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
index 68d92a22f949..4b601d26c4bd 100644
--- a/arch/arm/include/asm/types.h
+++ b/arch/arm/include/asm/types.h
@@ -6,6 +6,7 @@
#include <signal.h>
#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 b0e541111833..e056570c7e47 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <signal.h>
+#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 000000000000..02d90b5289ce
--- /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__ */
--
1.8.3.1
--HcAYCG3uE/tztfnV--
More information about the CRIU
mailing list