Add related code which make libcareplus can run basic demo on aarch64. Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
44 lines
1.1 KiB
Diff
44 lines
1.1 KiB
Diff
From 0430a8354e988a1a72896844d45b1a5c83743d74 Mon Sep 17 00:00:00 2001
|
|
From: Jiajie Li <lijiajie11@huawei.com>
|
|
Date: Mon, 12 Oct 2020 14:02:50 +0800
|
|
Subject: [PATCH 31/89] kpatch_common.h: Factor out PAGE_SIZE marco
|
|
|
|
Since page size may be different on OS configuration. Let's make a
|
|
change it to get PAGE_SIZE dynamicly accquired from syscall.
|
|
|
|
Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
|
|
Signed-off-by: Ying Fang <fangying1@huawei.com>
|
|
---
|
|
src/include/kpatch_common.h | 17 +++++++++++++++++
|
|
1 file changed, 17 insertions(+)
|
|
|
|
diff --git a/src/include/kpatch_common.h b/src/include/kpatch_common.h
|
|
index c160250..775ea14 100644
|
|
--- a/src/include/kpatch_common.h
|
|
+++ b/src/include/kpatch_common.h
|
|
@@ -41,4 +41,21 @@ int kpatch_close_file(struct kp_file *kpatch);
|
|
# define R_X86_64_GOTPCRELX 0x29
|
|
#endif
|
|
|
|
+static inline int page_shift(int n) {
|
|
+ int res = -1;
|
|
+
|
|
+ while(n) {
|
|
+ res++;
|
|
+ n >>= 1;
|
|
+ }
|
|
+
|
|
+ return res;
|
|
+}
|
|
+
|
|
+#ifndef PAGE_SIZE
|
|
+#define PAGE_SIZE getpagesize()
|
|
+#define PAGE_MASK (~(PAGE_SIZE-1))
|
|
+#define PAGE_SHIFT page_shift(PAGE_SIZE)
|
|
+#endif
|
|
+
|
|
#endif
|
|
--
|
|
2.23.0
|
|
|