Skip to content

Commit

Permalink
clock: Simplify subr_ticks and rename
Browse files Browse the repository at this point in the history
- 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:		6b82130 ("clock: Add a long ticks variable, ticksl")
Differential Revision:	https://reviews.freebsd.org/D48420
  • Loading branch information
markjdb committed Jan 10, 2025
1 parent f021e35 commit b2b974f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sys/conf/files
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 7 additions & 15 deletions sys/kern/subr_ticks.s → sys/kern/subr_ticks.S
Original file line number Diff line number Diff line change
Expand Up @@ -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__

0 comments on commit b2b974f

Please sign in to comment.