summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorFeiyang Chen <chenfeiyang@loongson.cn>2023-09-06 17:53:55 +0300
committerHuacai Chen <chenhuacai@loongson.cn>2023-09-06 17:53:55 +0300
commitb72961f847c0f0df113ae2d6ac9fd6b1e6bdeaf2 (patch)
tree2e634908afe44d5ae479b2f570f69ee8284079d6 /arch
parente14dd076964ef11e9d6e3b06a2f1c6bb7d034133 (diff)
downloadlinux-b72961f847c0f0df113ae2d6ac9fd6b1e6bdeaf2.tar.xz
LoongArch: Provide kaslr_offset() to get kernel offset
Provide kaslr_offset() to get the kernel offset when KASLR is enabled. Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch')
-rw-r--r--arch/loongarch/include/asm/setup.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/loongarch/include/asm/setup.h b/arch/loongarch/include/asm/setup.h
index be05c0e706a2..7c68b4365a4d 100644
--- a/arch/loongarch/include/asm/setup.h
+++ b/arch/loongarch/include/asm/setup.h
@@ -7,6 +7,7 @@
#define _LOONGARCH_SETUP_H
#include <linux/types.h>
+#include <asm/sections.h>
#include <uapi/asm/setup.h>
#define VECSIZE 0x200
@@ -37,4 +38,9 @@ extern void * __init relocate_kernel(void);
#endif
+static inline unsigned long kaslr_offset(void)
+{
+ return (unsigned long)&_text - VMLINUX_LOAD_ADDRESS;
+}
+
#endif /* __SETUP_H */