Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/riscv/riscv Remove magic numbers. NFCI.



details:   https://anonhg.NetBSD.org/src/rev/516edb487cf9
branches:  trunk
changeset: 376315:516edb487cf9
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Jun 10 09:18:50 2023 +0000

description:
Remove magic numbers. NFCI.

Copyright maintenance while I'm here.

diffstat:

 sys/arch/riscv/riscv/spl.S |  31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diffs (108 lines):

diff -r df78e9790b57 -r 516edb487cf9 sys/arch/riscv/riscv/spl.S
--- a/sys/arch/riscv/riscv/spl.S        Sat Jun 10 08:17:04 2023 +0000
+++ b/sys/arch/riscv/riscv/spl.S        Sat Jun 10 09:18:50 2023 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: spl.S,v 1.6 2023/05/07 12:41:49 skrll Exp $ */
+/* $NetBSD: spl.S,v 1.7 2023/06/10 09:18:50 skrll Exp $ */
 
 /*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * Copyright (c) 2014,2023 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas of 3am Software Foundry.
+ * by Matt Thomas of 3am Software Foundry, and Nick Hudson.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,7 +32,9 @@
 #include <machine/asm.h>
 #include "assym.h"
 
-__RCSID("$NetBSD: spl.S,v 1.6 2023/05/07 12:41:49 skrll Exp $")
+__RCSID("$NetBSD: spl.S,v 1.7 2023/06/10 09:18:50 skrll Exp $")
+
+#define SZINT  (1 << INT_SCALESHIFT)
 
        .data
        .globl  _C_LABEL(ipl_sie_map)
@@ -55,8 +57,7 @@ ENTRY_NP(splx)
        INT_L   t0, CI_CPL(a3)          // get current IPL
        bge     a0, t0, 2f
 
-
-       sll     t2, a0, 2               // INT_SCALESHIFT
+       sll     t2, a0, INT_SCALESHIFT
        PTR_LA  a1, _C_LABEL(ipl_sie_map)
        add     a1, a1, t2
        INT_L   a1, 0(a1)
@@ -124,51 +125,51 @@ END(spl0)
 
 ENTRY_NP(splsoftclock)
        li      t1, IPL_SOFTCLOCK
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_SOFTCLOCK
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_SOFTCLOCK
        j       _splraise
 END(splsoftclock)
 
 ENTRY_NP(splsoftbio)
        li      t1, IPL_SOFTBIO
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_SOFTBIO
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_SOFTBIO
        j       _splraise
 END(splsoftbio)
 
 ENTRY_NP(splsoftnet)
        li      t1, IPL_SOFTNET
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_SOFTNET
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_SOFTNET
        j       _splraise
 END(splsoftnet)
 
 ENTRY_NP(splsoftserial)
        li      t1, IPL_SOFTSERIAL
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_SOFTSERIAL
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_SOFTSERIAL
        j       _splraise
 END(splsoftserial)
 
 ENTRY_NP(splvm)
        li      t1, IPL_VM
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_VM
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_VM
        j       _splraise
 END(splvm)
 
 ENTRY_NP(splsched)
        li      t1, IPL_SCHED
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_SCHED
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_SCHED
        j       _splraise
 END(splsched)
 
 #if 0
 ENTRY_NP(splddb)
        li      t1, IPL_DDB
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_DDB
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_DDB
        j       _splraise
 END(splddb)
 #endif
 
 ENTRY_NP(splhigh)
        li      t1, IPL_HIGH
-       INT_L   t0, _C_LABEL(ipl_sie_map) + 4 * IPL_HIGH
+       INT_L   t0, _C_LABEL(ipl_sie_map) + SZINT * IPL_HIGH
        j       _splraise
 END(splhigh)
 
@@ -177,7 +178,7 @@ END(splhigh)
 ENTRY_NP(splraise)
        // a0 = new higher IPL
        mv      t1, a0
-       sll     t2, a0, 2               // INT_SCALESHIFT
+       sll     t2, a0, INT_SCALESHIFT
        PTR_LA  a1, _C_LABEL(ipl_sie_map)
        add     a1, a1, t2
        INT_L   t0, 0(a1)



Home | Main Index | Thread Index | Old Index