Repository navigation
feat(time,syscall): add CMOS RTC wall clock, HPET ns clocks, itimers, and POSIX timers (N2.6b, #66) - #146
Merged
Conversation
… and POSIX timers (N2.6b, #66)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes #66 N2.6 (Signals & Timers) with N2.6b (Timers & Clocks):
getitimer(36),alarm(37),setitimer(38),timer_create(222),timer_settime(223),timer_gettime(224),timer_getoverrun(225),timer_delete(226),clock_getres(229), andclock_nanosleep(230)inkernel/seccomp/syscall_table.rsand wired exhaustiveDispatchedSyscallarms inkernel/kernel_core/syscall/mod.rs.#[repr(C)] ITimerVal(32B),ITimerSpec(32B), andSigEvent(64B) inkernel/kernel_core/syscall/abi.rsand pinned all three inscripts/tools/abi_layout_oracle.py(Leg A/B/C vs native x86_64<time.h>,<sys/time.h>,<signal.h>).read_cmos_rtc_unix_secswith bounded UIP wait, double-read consistency, BCD/binary + 12h/24h decoding, and Howard Hinnant Gregorian-to-Unix epoch conversion) and 64-bit HPET nanosecond counter provider (elapsed_ns,resolution_ns) inkernel/arch/hpet.rs, registered during boot inkernel/src/main.rs.monotonic_ns()(fetch_maxfloor), wall-clockrealtime_ns(), andclock_resolution_ns(coarse)inkernel/kernel_core/time.rs.clock_gettime,gettimeofday, andFUTEX_CLOCK_REALTIME/FUTEX_LOCK_PIabsolute deadlines inkernel/kernel_core/syscall/futex.rsso realtime clocks use wall-clock Unix epoch ns while monotonic clocks stay monotonic uptime ns.clock_getres(229)(including NULLresvalidity query) andclock_nanosleep(230)(relative +TIMER_ABSTIMEacrossCLOCK_REALTIME,CLOCK_MONOTONIC,CLOCK_BOOTTIME, with POSIXremwrite-back on relativeEINTRonly).TimerRegistryinkernel/kernel_core/time.rs(MAX_POSIX_TIMERS_PER_PROCESS = 32, zero bytes added toProcessorThreadGroup) with a lock-free single-loadNEXT_TIMER_EXPIRY_NSIRQ fast path inon_timer_tick()and process-context deferred signal delivery (drain_deferred_process_timers()inkernel/kernel_core/scheduler_hook.rs).alarm(37),getitimer(36),setitimer(38)(ITIMER_REALone-shot & periodicSIGALRM;ITIMER_VIRTUAL/ITIMER_PROFqueryable/disarmable andEOPNOTSUPPon non-zero arm), andtimer_create/timer_settime/timer_gettime/timer_getoverrun/timer_delete(SIGEV_SIGNAL,SIGEV_NONE,SIGEV_THREAD_ID,TIMER_ABSTIME, periodic overrun tracking,SI_TIMER+sigev_valuedelivery).forkdoes not inherit timers,execvedeletes POSIX timers while preservingITIMER_REAL(cleanup_posix_timers_for_exec), and last-live-thread exit reclaims all timers (cleanup_all_timers_for_process).Verification
cargo fmt --all && make fmt-check— PASSmake abi-check— PASS (16 structs, 131 values, 17 tripwires, C-leg: run)make lint— PASSbash scripts/tools/hosted_subcrate_tests.sh— PASS (kernel-core231/231,arch11/11,seccomp20/20,lsm-hook-census5/5,mitigation-mappings5/5)make clippy && make build— PASSZERO_OS_STRICT_TESTS=1 bash scripts/gates/boot/boot_check.sh— STRICT PASS (50/50)ZERO_OS_STRICT_TESTS=1 SMP_CORES=4 bash scripts/gates/boot/kernel_test.sh— STRICT PASS (50/50)make test-ring3-mm— PASSmake test-kcov— PASS (KCOV-E2E PASS)Part of #66