[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <cf8585177e6798095b1af02f28dad5a3271a761e.1584352425.git.zong.li@sifive.com>
Date: Tue, 24 Mar 2020 15:30:46 +0800
From: Zong Li <zong.li@...ive.com>
To: palmer@...belt.com, paul.walmsley@...ive.com, alex@...ti.fr,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: Zong Li <zong.li@...ive.com>
Subject: [PATCH RFC 1/8] riscv/kaslr: add interface to get kaslr offset
Add interface to get the random offset.
Signed-off-by: Zong Li <zong.li@...ive.com>
---
arch/riscv/include/asm/page.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 92848e172a40..e2c2020f0a8d 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -101,6 +101,11 @@ extern unsigned long kernel_virt_addr;
extern unsigned long max_low_pfn;
extern unsigned long min_low_pfn;
+static inline unsigned long get_kaslr_offset(void)
+{
+ return kernel_virt_addr - PAGE_OFFSET;
+}
+
#define __pa_to_va_nodebug(x) ((void *)((unsigned long) (x) + va_pa_offset))
#define __va_to_pa_nodebug(x) ((unsigned long)(x) - va_pa_offset)
--
2.25.1
Powered by blists - more mailing lists