Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/riscv/include Note some SV39 PTE bits defined in ex...



details:   https://anonhg.NetBSD.org/src/rev/848b5b9e7aa3
branches:  trunk
changeset: 372309:848b5b9e7aa3
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Nov 12 07:34:18 2022 +0000

description:
Note some SV39 PTE bits defined in extensions.

Fix pte_nv_entry for the kernel.

Fix pte_pde_ptpage. PTE.{X,W,R} must be zero for pointer to next level.

diffstat:

 sys/arch/riscv/include/pte.h |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r bb44fd760ef1 -r 848b5b9e7aa3 sys/arch/riscv/include/pte.h
--- a/sys/arch/riscv/include/pte.h      Sat Nov 12 07:05:40 2022 +0000
+++ b/sys/arch/riscv/include/pte.h      Sat Nov 12 07:34:18 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.10 2022/10/18 06:44:43 skrll Exp $ */
+/* $NetBSD: pte.h,v 1.11 2022/11/12 07:34:18 skrll Exp $ */
 
 /*
  * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
@@ -56,8 +56,14 @@
 #define        NSEGPG          NPTEPG
 #define        NPDEPG          NPTEPG
 
+
+/* HardWare PTE bits SV39 */
+#define PTE_N          __BIT(63)       // Svnapot
+#define PTE_PBMT       __BITS(62, 61)  // Svpbmt
+#define PTE_reserved0  __BITS(60, 54)  //
+
 /* Software PTE bits. */
-#define        PTE_RSW         __BITS(9,8)
+#define        PTE_RSW         __BITS(9, 8)
 #define        PTE_WIRED       __BIT(9)
 
 /* Hardware PTE bits. */
@@ -155,7 +161,7 @@
 static inline pt_entry_t
 pte_nv_entry(bool kernel_p)
 {
-       return kernel_p ? PTE_G : 0;
+       return 0;
 }
 
 static inline pt_entry_t
@@ -265,7 +271,7 @@
 static inline pd_entry_t
 pte_pde_ptpage(paddr_t pa, bool kernel_p)
 {
-       return PTE_V | PTE_X | PTE_W | PTE_R | (pa >> PAGE_SHIFT) << PTE_PPN_SHIFT;
+       return PTE_V | (pa >> PAGE_SHIFT) << PTE_PPN_SHIFT;
 }
 
 static inline bool



Home | Main Index | Thread Index | Old Index