The legacy GetTime syscall has three implementations in this tree and they do
not agree on what they return.
kernel/src/arch_impl/aarch64/syscall_entry.rs sys_get_time() -- monotonic
nanoseconds (get_monotonic_time_ns() folded to a single u64). This is the
one EL0 reaches: dispatch_syscall_enum routes SyscallNumber::GetTime here.
kernel/src/arch_impl/aarch64/exception.rs, the syscall_nums::GET_TIME arm of
handle_syscall -- milliseconds. Reached only for an SVC issued from EL1;
the EL0 path takes rust_syscall_handler_aarch64 instead.
kernel/src/syscall/handlers.rs sys_get_time() -- milliseconds. Not
reachable from userspace at all: x86 answers SyscallNumber::GetTime with
NoSys in syscall/handler.rs, and the function's only caller in the tree is
an in-kernel diagnostic in main.rs.
So the same syscall number answers in nanoseconds on the live aarch64 path, in
milliseconds on two paths userspace cannot take, and ENOSYS on x86.
Until this round the live implementation also carried the comment "returns ticks
directly" over a body returning nanoseconds -- a third unit, in prose. That
comment is now corrected, which is why this is a divergence rather than a
falsehood, but the divergence itself is untouched.
Nothing decides it from inside the tree: a grep of userspace/ and
libs/libbreenix/ finds no caller of this syscall.
userspace/programs/src/timer_test.rs builds its own get_time_ms() on
clock_gettime. So there is no consumer whose expectation picks the unit, and
changing the returned value is an ABI decision rather than a repair.
Options, roughly:
- Pick milliseconds (matches the syscall's name and both sibling
implementations), change the aarch64 EL0 path, and delete or redirect the EL1
arm so one implementation serves both.
- Pick nanoseconds and correct the siblings.
- Retire
GetTime outright in favour of clock_gettime, which is what the one
in-tree userspace timing program already uses, and make every path answer
NoSys as x86 already does.
Option 3 is probably right -- the arm is already marked deprecated at
exception.rs's GET_TIME constant -- but it is a decision, not a cleanup.
Filed from the #767 review round (finding B5).
The legacy
GetTimesyscall has three implementations in this tree and they donot agree on what they return.
kernel/src/arch_impl/aarch64/syscall_entry.rssys_get_time()-- monotonicnanoseconds (
get_monotonic_time_ns()folded to a single u64). This is theone EL0 reaches:
dispatch_syscall_enumroutesSyscallNumber::GetTimehere.kernel/src/arch_impl/aarch64/exception.rs, thesyscall_nums::GET_TIMEarm ofhandle_syscall-- milliseconds. Reached only for an SVC issued from EL1;the EL0 path takes
rust_syscall_handler_aarch64instead.kernel/src/syscall/handlers.rssys_get_time()-- milliseconds. Notreachable from userspace at all: x86 answers
SyscallNumber::GetTimewithNoSysinsyscall/handler.rs, and the function's only caller in the tree isan in-kernel diagnostic in
main.rs.So the same syscall number answers in nanoseconds on the live aarch64 path, in
milliseconds on two paths userspace cannot take, and ENOSYS on x86.
Until this round the live implementation also carried the comment "returns ticks
directly" over a body returning nanoseconds -- a third unit, in prose. That
comment is now corrected, which is why this is a divergence rather than a
falsehood, but the divergence itself is untouched.
Nothing decides it from inside the tree: a grep of
userspace/andlibs/libbreenix/finds no caller of this syscall.userspace/programs/src/timer_test.rsbuilds its ownget_time_ms()onclock_gettime. So there is no consumer whose expectation picks the unit, andchanging the returned value is an ABI decision rather than a repair.
Options, roughly:
implementations), change the aarch64 EL0 path, and delete or redirect the EL1
arm so one implementation serves both.
GetTimeoutright in favour ofclock_gettime, which is what the onein-tree userspace timing program already uses, and make every path answer
NoSysas x86 already does.Option 3 is probably right -- the arm is already marked deprecated at
exception.rs'sGET_TIMEconstant -- but it is a decision, not a cleanup.Filed from the #767 review round (finding B5).