git: b2b974f7ef4c - main - clock: Simplify subr_ticks and rename

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sat, 11 Jan 2025 00:00:29 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b2b974f7ef4cddff251d0de69d8da13232b25e4d

commit b2b974f7ef4cddff251d0de69d8da13232b25e4d
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-01-10 23:59:47 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-01-10 23:59:47 +0000

    clock: Simplify subr_ticks and rename
    
    - We can use builtin constants for the size of int and long to simplify
      definitions.
    - The file should have a .S prefix since we want to run it through the
      preprocessor, though apparently this happens anyway with .s...
    - Move ticks and ticksl from .data to .bss.
    
    Reported by:    jrtc27
    Reviewed by:    jrtc27, kib, emaste
    Fixes:          6b82130e6c9a ("clock: Add a long ticks variable, ticksl")
    Differential Revision:  https://reviews.freebsd.org/D48420
---
 sys/conf/files                          |  2 +-
 sys/kern/{subr_ticks.s => subr_ticks.S} | 22 +++++++---------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index a630d9dd72bc..fc9108b5e10f 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3932,7 +3932,7 @@ kern/subr_stack.c		optional ddb | stack | ktr
 kern/subr_stats.c		optional stats
 kern/subr_taskqueue.c		standard
 kern/subr_terminal.c		optional vt
-kern/subr_ticks.s		standard
+kern/subr_ticks.S		standard
 kern/subr_trap.c		standard
 kern/subr_turnstile.c		standard
 kern/subr_uio.c			standard
diff --git a/sys/kern/subr_ticks.s b/sys/kern/subr_ticks.S
similarity index 62%
rename from sys/kern/subr_ticks.s
rename to sys/kern/subr_ticks.S
index 6565ba424137..52435b194c4f 100644
--- a/sys/kern/subr_ticks.s
+++ b/sys/kern/subr_ticks.S
@@ -16,29 +16,21 @@
 GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
 #endif
 
-#ifdef _ILP32
-#define	SIZEOF_TICKSL	4
-#define	TICKSL_INIT	.long 0
-#else
-#define	SIZEOF_TICKSL	8
-#define	TICKSL_INIT	.quad 0
-#endif
-
-#if defined(_ILP32) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #define	TICKS_OFFSET	0
 #else
-#define	TICKS_OFFSET	4
+#define	TICKS_OFFSET	(__SIZEOF_LONG__ - __SIZEOF_INT__)
 #endif
 
-	.data
+	.bss
 
 	.global ticksl
 	.type ticksl, %object
-	.align SIZEOF_TICKSL
-ticksl:	TICKSL_INIT
-	.size ticksl, SIZEOF_TICKSL
+	.align __SIZEOF_LONG__
+ticksl:	.zero __SIZEOF_LONG__
+	.size ticksl, __SIZEOF_LONG__
 
 	.global ticks
 	.type ticks, %object
 ticks	=ticksl + TICKS_OFFSET
-	.size ticks, 4
+	.size ticks, __SIZEOF_INT__