diff options
author | Feiyang Chen <chenfeiyang@loongson.cn> | 2023-09-06 22:53:55 +0800 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-09-06 22:53:55 +0800 |
commit | b72961f847c0f0df113ae2d6ac9fd6b1e6bdeaf2 (patch) | |
tree | 2e634908afe44d5ae479b2f570f69ee8284079d6 /arch | |
parent | e14dd076964ef11e9d6e3b06a2f1c6bb7d034133 (diff) | |
download | lwn-b72961f847c0f0df113ae2d6ac9fd6b1e6bdeaf2.tar.gz lwn-b72961f847c0f0df113ae2d6ac9fd6b1e6bdeaf2.zip |
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.h | 6 |
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 */ |