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:		6b82130e6c ("clock: Add a long ticks variable, ticksl")
Differential Revision:	https://reviews.freebsd.org/D48420
This commit is contained in:
Mark Johnston 2025-01-10 23:59:47 +00:00
parent f021e35735
commit b2b974f7ef
2 changed files with 8 additions and 16 deletions

View file

@ -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

View file

@ -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__