@@ -115,6 +115,15 @@ x_tmp .req x8
9998:
.endm
+ .macro clock_gettime_return, shift=0
+ .if \shift == 1
+ lsr x11, x11, x12
+ .endif
+ stp x10, x11, [x1, #TSPEC_TV_SEC]
+ mov x0, xzr
+ ret
+ .endm
+
.macro jump_slot jumptable, index, label
.if (. - \jumptable) != 4 * (\index)
.error "Jump slot index mismatch"
@@ -180,6 +189,7 @@ ENTRY(__kernel_clock_gettime)
add x_tmp, x_tmp, w0, uxtw #2
br x_tmp
+ ALIGN
jumptable:
jump_slot jumptable, CLOCK_REALTIME, realtime
jump_slot jumptable, CLOCK_MONOTONIC, monotonic
@@ -193,6 +203,7 @@ jumptable:
.error "Wrong jumptable size"
.endif
+ ALIGN
realtime:
seqcnt_acquire
syscall_check fail=syscall
@@ -209,9 +220,9 @@ realtime:
get_clock_shifted_nsec res=x15, cycle_last=x10, mult=x11
get_ts_realtime res_sec=x10, res_nsec=x11, \
clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
+ clock_gettime_return, shift=1
- b shift_store
-
+ ALIGN
monotonic:
seqcnt_acquire
syscall_check fail=syscall
@@ -232,9 +243,9 @@ monotonic:
clock_nsec=x15, xtime_sec=x13, xtime_nsec=x14, nsec_to_sec=x9
add_ts sec=x10, nsec=x11, ts_sec=x3, ts_nsec=x4, nsec_to_sec=x9
+ clock_gettime_return, shift=1
- b shift_store
-
+ ALIGN
monotonic_raw:
seqcnt_acquire
syscall_check fail=syscall
@@ -254,16 +265,16 @@ monotonic_raw:
clock_nsec=x15, nsec_to_sec=x9
add_ts sec=x10, nsec=x11, ts_sec=x13, ts_nsec=x14, nsec_to_sec=x9
+ clock_gettime_return, shift=1
- b shift_store
-
+ ALIGN
realtime_coarse:
seqcnt_acquire
ldp x10, x11, [vdso_data, #VDSO_XTIME_CRS_SEC]
seqcnt_check fail=realtime_coarse
+ clock_gettime_return
- b store
-
+ ALIGN
monotonic_coarse:
seqcnt_acquire
ldp x10, x11, [vdso_data, #VDSO_XTIME_CRS_SEC]
@@ -273,16 +284,9 @@ monotonic_coarse:
/* Computations are done in (non-shifted) nsecs. */
get_nsec_per_sec res=x9
add_ts sec=x10, nsec=x11, ts_sec=x13, ts_nsec=x14, nsec_to_sec=x9
+ clock_gettime_return
- b store
-
-shift_store:
- lsr x11, x11, x12
-store:
- stp x10, x11, [x1, #TSPEC_TV_SEC]
- mov x0, xzr
- ret
-
+ ALIGN
syscall: /* Syscall fallback. */
mov x8, #__NR_clock_gettime
svc #0