Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/riscv #define<tab>



details:   https://anonhg.NetBSD.org/src/rev/7d4eaf977883
branches:  trunk
changeset: 371848:7d4eaf977883
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sat Oct 15 06:41:43 2022 +0000

description:
#define<tab>

diffstat:

 sys/arch/riscv/include/cpu_counter.h |    8 +-
 sys/arch/riscv/include/pmap.h        |   78 +++++++++---------
 sys/arch/riscv/include/pte.h         |   38 ++++----
 sys/arch/riscv/include/sysreg.h      |  148 +++++++++++++++++-----------------
 sys/arch/riscv/riscv/pmap_machdep.c  |   10 +-
 sys/arch/riscv/riscv/riscv_machdep.c |   12 +-
 sys/arch/riscv/riscv/trap.c          |    8 +-
 7 files changed, 151 insertions(+), 151 deletions(-)

diffs (truncated from 585 to 300 lines):

diff -r 6dae75ab60e7 -r 7d4eaf977883 sys/arch/riscv/include/cpu_counter.h
--- a/sys/arch/riscv/include/cpu_counter.h      Sat Oct 15 06:07:04 2022 +0000
+++ b/sys/arch/riscv/include/cpu_counter.h      Sat Oct 15 06:41:43 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_counter.h,v 1.1 2014/09/19 17:36:26 matt Exp $     */
+/*     $NetBSD: cpu_counter.h,v 1.2 2022/10/15 06:41:43 simonb Exp $   */
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang.  All rights reserved.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 
-/* $NetBSD: cpu_counter.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
+/* $NetBSD: cpu_counter.h,v 1.2 2022/10/15 06:41:43 simonb Exp $ */
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -56,7 +56,7 @@
  */
 
 #ifndef _RISCV_CPU_COUNTER_H_
-#define _RISCV_CPU_COUNTER_H_
+#define        _RISCV_CPU_COUNTER_H_
 
 /*
  * Machine-specific support for CPU counter.
@@ -67,7 +67,7 @@
 #ifdef _KERNEL
 
 #define        cpu_hascounter()        true
-#define cpu_counter()          cpu_counter32()
+#define        cpu_counter()           cpu_counter32()
 
 static __inline uint32_t
 cpu_counter32(void)
diff -r 6dae75ab60e7 -r 7d4eaf977883 sys/arch/riscv/include/pmap.h
--- a/sys/arch/riscv/include/pmap.h     Sat Oct 15 06:07:04 2022 +0000
+++ b/sys/arch/riscv/include/pmap.h     Sat Oct 15 06:41:43 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.10 2022/09/20 07:18:23 skrll Exp $ */
+/* $NetBSD: pmap.h,v 1.11 2022/10/15 06:41:43 simonb Exp $ */
 
 /*
  * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #ifndef _RISCV_PMAP_H_
-#define _RISCV_PMAP_H_
+#define        _RISCV_PMAP_H_
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -50,57 +50,57 @@
 #include <riscv/pte.h>
 #include <riscv/sysreg.h>
 
-#define PMAP_SEGTABSIZE        NPTEPG
-#define PMAP_PDETABSIZE        NPTEPG
+#define        PMAP_SEGTABSIZE NPTEPG
+#define        PMAP_PDETABSIZE NPTEPG
 
 #ifdef _LP64
-#define PTPSHIFT       3
+#define        PTPSHIFT        3
 /* This is SV48. */
 //#define SEGLENGTH + SEGSHIFT + SEGSHIFT */
 
 /* This is SV39. */
-#define XSEGSHIFT      (SEGSHIFT + SEGLENGTH)
-#define NBXSEG         (1ULL << XSEGSHIFT)
-#define XSEGOFSET      (NBXSEG - 1)            /* byte offset into xsegment */
-#define XSEGLENGTH     (PGSHIFT - 3)
-#define NXSEGPG                (1 << XSEGLENGTH)
+#define        XSEGSHIFT       (SEGSHIFT + SEGLENGTH)
+#define        NBXSEG          (1ULL << XSEGSHIFT)
+#define        XSEGOFSET       (NBXSEG - 1)            /* byte offset into xsegment */
+#define        XSEGLENGTH      (PGSHIFT - 3)
+#define        NXSEGPG         (1 << XSEGLENGTH)
 #else
-#define PTPSHIFT       2
-#define XSEGSHIFT      SEGLENGTH
+#define        PTPSHIFT        2
+#define        XSEGSHIFT       SEGLENGTH
 #endif
 
-#define SEGLENGTH      (PGSHIFT - PTPSHIFT)
-#define SEGSHIFT       (SEGLENGTH + PGSHIFT)
-#define NBSEG          (1 << SEGSHIFT)         /* bytes/segment */
-#define SEGOFSET       (NBSEG - 1)             /* byte offset into segment */
+#define        SEGLENGTH       (PGSHIFT - PTPSHIFT)
+#define        SEGSHIFT        (SEGLENGTH + PGSHIFT)
+#define        NBSEG           (1 << SEGSHIFT)         /* bytes/segment */
+#define        SEGOFSET        (NBSEG - 1)             /* byte offset into segment */
 
-#define KERNEL_PID     0
+#define        KERNEL_PID      0
 
-#define PMAP_HWPAGEWALKER              1
-#define PMAP_TLB_MAX                   1
+#define        PMAP_HWPAGEWALKER               1
+#define        PMAP_TLB_MAX                    1
 #ifdef _LP64
-#define PMAP_INVALID_PDETAB_ADDRESS    ((pmap_pdetab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
-#define PMAP_INVALID_SEGTAB_ADDRESS    ((pmap_segtab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
+#define        PMAP_INVALID_PDETAB_ADDRESS     ((pmap_pdetab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
+#define        PMAP_INVALID_SEGTAB_ADDRESS     ((pmap_segtab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
 #else
-#define PMAP_INVALID_PDETAB_ADDRESS    ((pmap_pdetab_t *)0xdeadbeef)
-#define PMAP_INVALID_SEGTAB_ADDRESS    ((pmap_segtab_t *)0xdeadbeef)
+#define        PMAP_INVALID_PDETAB_ADDRESS     ((pmap_pdetab_t *)0xdeadbeef)
+#define        PMAP_INVALID_SEGTAB_ADDRESS     ((pmap_segtab_t *)0xdeadbeef)
 #endif
-#define PMAP_TLB_NUM_PIDS              (__SHIFTOUT_MASK(SATP_ASID) + 1)
-#define PMAP_TLB_BITMAP_LENGTH          PMAP_TLB_NUM_PIDS
-#define PMAP_TLB_FLUSH_ASID_ON_RESET   false
+#define        PMAP_TLB_NUM_PIDS               (__SHIFTOUT_MASK(SATP_ASID) + 1)
+#define        PMAP_TLB_BITMAP_LENGTH          PMAP_TLB_NUM_PIDS
+#define        PMAP_TLB_FLUSH_ASID_ON_RESET    false
 
-#define pmap_phys_address(x)           (x)
+#define        pmap_phys_address(x)            (x)
 
 #ifndef __BSD_PTENTRY_T__
-#define __BSD_PTENTRY_T__
+#define        __BSD_PTENTRY_T__
 #ifdef _LP64
-#define PRIxPTE         PRIx64
+#define        PRIxPTE         PRIx64
 #else
-#define PRIxPTE         PRIx32
+#define        PRIxPTE         PRIx32
 #endif
 #endif /* __BSD_PTENTRY_T__ */
 
-#define PMAP_NEED_PROCWR
+#define        PMAP_NEED_PROCWR
 static inline void
 pmap_procwr(struct proc *p, vaddr_t va, vsize_t len)
 {
@@ -110,12 +110,12 @@
 #include <uvm/pmap/tlb.h>
 #include <uvm/pmap/pmap_tlb.h>
 
-#define PMAP_GROWKERNEL
-#define PMAP_STEAL_MEMORY
+#define        PMAP_GROWKERNEL
+#define        PMAP_STEAL_MEMORY
 
 #ifdef _KERNEL
 
-#define __HAVE_PMAP_MD
+#define        __HAVE_PMAP_MD
 struct pmap_md {
        paddr_t md_ppn;
        pd_entry_t *md_pdetab;
@@ -140,11 +140,11 @@
 
 extern vaddr_t pmap_direct_base;
 extern vaddr_t pmap_direct_end;
-#define PMAP_DIRECT_MAP(pa)    (pmap_direct_base + (pa))
-#define PMAP_DIRECT_UNMAP(va)  ((paddr_t)(va) - pmap_direct_base)
+#define        PMAP_DIRECT_MAP(pa)     (pmap_direct_base + (pa))
+#define        PMAP_DIRECT_UNMAP(va)   ((paddr_t)(va) - pmap_direct_base)
 
-#define MEGAPAGE_TRUNC(x)      ((x) & ~SEGOFSET)
-#define MEGAPAGE_ROUND(x)      MEGAPAGE_TRUNC((x) + SEGOFSET)
+#define        MEGAPAGE_TRUNC(x)       ((x) & ~SEGOFSET)
+#define        MEGAPAGE_ROUND(x)       MEGAPAGE_TRUNC((x) + SEGOFSET)
 
 #ifdef __PMAP_PRIVATE
 
@@ -199,7 +199,7 @@
  * whether we are using modules or not.
  */
 #ifndef __HAVE_VM_PAGE_MD
-#define __HAVE_VM_PAGE_MD
+#define        __HAVE_VM_PAGE_MD
 
 struct vm_page_md {
        uintptr_t mdpg_dummy[3];
diff -r 6dae75ab60e7 -r 7d4eaf977883 sys/arch/riscv/include/pte.h
--- a/sys/arch/riscv/include/pte.h      Sat Oct 15 06:07:04 2022 +0000
+++ b/sys/arch/riscv/include/pte.h      Sat Oct 15 06:41:43 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.8 2022/09/30 06:23:58 skrll Exp $ */
+/* $NetBSD: pte.h,v 1.9 2022/10/15 06:41:43 simonb Exp $ */
 
 /*
  * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
@@ -31,30 +31,30 @@
  */
 
 #ifndef _RISCV_PTE_H_
-#define _RISCV_PTE_H_
+#define        _RISCV_PTE_H_
 
 #ifdef _LP64   /* Sv39 */
-#define PTE_PPN                __BITS(53, 10)
+#define        PTE_PPN         __BITS(53, 10)
 #define        PTE_PPN0        __BITS(18, 10)
 #define        PTE_PPN1        __BITS(27, 19)
 #define        PTE_PPN2        __BITS(53, 28)
 typedef uint64_t pt_entry_t;
 typedef uint64_t pd_entry_t;
-#define atomic_cas_pte atomic_cas_64
+#define        atomic_cas_pte  atomic_cas_64
 #else          /* Sv32 */
-#define PTE_PPN                __BITS(31, 10)
+#define        PTE_PPN         __BITS(31, 10)
 #define        PTE_PPN0        __BITS(19, 10)
 #define        PTE_PPN1        __BITS(31, 20)
 typedef uint32_t pt_entry_t;
 typedef uint32_t pd_entry_t;
-#define atomic_cas_pte atomic_cas_32
+#define        atomic_cas_pte  atomic_cas_32
 #endif
 
-#define PTE_PPN_SHIFT  10
+#define        PTE_PPN_SHIFT   10
 
-#define NPTEPG         (PAGE_SIZE / sizeof(pt_entry_t))
-#define NSEGPG         NPTEPG
-#define NPDEPG         NPTEPG
+#define        NPTEPG          (PAGE_SIZE / sizeof(pt_entry_t))
+#define        NSEGPG          NPTEPG
+#define        NPDEPG          NPTEPG
 
 /* Software PTE bits. */
 #define        PTE_RSW         __BITS(9,8)
@@ -71,13 +71,13 @@
 #define        PTE_R           __BIT(1)        // Read
 #define        PTE_V           __BIT(0)        // Valid
 
-#define PTE_HARDWIRED  (PTE_A | PTE_D)
-#define PTE_KERN       (PTE_V | PTE_G | PTE_A | PTE_D)
-#define PTE_RW         (PTE_R | PTE_W)
-#define PTE_RX         (PTE_R | PTE_X)
+#define        PTE_HARDWIRED   (PTE_A | PTE_D)
+#define        PTE_KERN        (PTE_V | PTE_G | PTE_A | PTE_D)
+#define        PTE_RW          (PTE_R | PTE_W)
+#define        PTE_RX          (PTE_R | PTE_X)
 
-#define PA_TO_PTE(pa)  (((pa) >> PAGE_SHIFT) << PTE_PPN_SHIFT)
-#define PTE_TO_PA(pte) (((pte) >> PTE_PPN_SHIFT) << PAGE_SHIFT)
+#define        PA_TO_PTE(pa)   (((pa) >> PAGE_SHIFT) << PTE_PPN_SHIFT)
+#define        PTE_TO_PA(pte)  (((pte) >> PTE_PPN_SHIFT) << PAGE_SHIFT)
 
 #define        L2_SHIFT        30
 #define        L1_SHIFT        21
@@ -94,9 +94,9 @@
 #define        Ln_ENTRIES      (1 << 9)
 #define        Ln_ADDR_MASK    (Ln_ENTRIES - 1)
 
-#define pl2_i(va)      (((va) >> L2_SHIFT) & Ln_ADDR_MASK)
-#define pl1_i(va)      (((va) >> L1_SHIFT) & Ln_ADDR_MASK)
-#define pl0_i(va)      (((va) >> L0_SHIFT) & Ln_ADDR_MASK)
+#define        pl2_i(va)       (((va) >> L2_SHIFT) & Ln_ADDR_MASK)
+#define        pl1_i(va)       (((va) >> L1_SHIFT) & Ln_ADDR_MASK)
+#define        pl0_i(va)       (((va) >> L0_SHIFT) & Ln_ADDR_MASK)
 
 static inline const size_t
 pte_index(vaddr_t va)
diff -r 6dae75ab60e7 -r 7d4eaf977883 sys/arch/riscv/include/sysreg.h
--- a/sys/arch/riscv/include/sysreg.h   Sat Oct 15 06:07:04 2022 +0000
+++ b/sys/arch/riscv/include/sysreg.h   Sat Oct 15 06:41:43 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.14 2022/09/10 09:28:26 skrll Exp $ */
+/* $NetBSD: sysreg.h,v 1.15 2022/10/15 06:41:43 simonb Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #ifndef _RISCV_SYSREG_H_
-#define _RISCV_SYSREG_H_
+#define        _RISCV_SYSREG_H_
 
 #ifndef _KERNEL
 #include <sys/param.h>
@@ -38,20 +38,20 @@
 
 #include <riscv/reg.h>
 
-#define FCSR_FMASK     0       // no exception bits
-#define FCSR_FRM       __BITS(7,5)
-#define  FCSR_FRM_RNE  0b000   // Round Nearest, ties to Even
-#define  FCSR_FRM_RTZ  0b001   // Round Towards Zero
-#define  FCSR_FRM_RDN  0b010   // Round DowN (-infinity)
-#define  FCSR_FRM_RUP  0b011   // Round UP (+infinity)
-#define  FCSR_FRM_RMM  0b100   // Round to nearest, ties to Max Magnitude
-#define  FCSR_FRM_DYN  0b111   // Dynamic rounding
-#define FCSR_FFLAGS    __BITS(4,0)     // Sticky bits
-#define FCSR_NV                __BIT(4)        // iNValid operation
-#define FCSR_DZ                __BIT(3)        // Divide by Zero
-#define FCSR_OF                __BIT(2)        // OverFlow
-#define FCSR_UF                __BIT(1)        // UnderFlow
-#define FCSR_NX                __BIT(0)        // iNeXact



Home | Main Index | Thread Index | Old Index