Skip to content

Commit b72961f

Browse files
FreeFlyingSheepchenhuacai
authored andcommitted
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>
1 parent e14dd07 commit b72961f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/loongarch/include/asm/setup.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define _LOONGARCH_SETUP_H
88

99
#include <linux/types.h>
10+
#include <asm/sections.h>
1011
#include <uapi/asm/setup.h>
1112

1213
#define VECSIZE 0x200
@@ -37,4 +38,9 @@ extern void * __init relocate_kernel(void);
3738

3839
#endif
3940

41+
static inline unsigned long kaslr_offset(void)
42+
{
43+
return (unsigned long)&_text - VMLINUX_LOAD_ADDRESS;
44+
}
45+
4046
#endif /* __SETUP_H */

0 commit comments

Comments
 (0)