Skip to content

guest: match C hexadecimal output for zero clock values - #631

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
microsoft:devfrom
gezerui888:fix/clock-zero-hex
Oct 20, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
microsoft:devfrom
gezerui888:fix/clock-zero-hex

Conversation

@gezerui888

@gezerui888 Zerui Ge (gezerui888) commented Oct 20, 2026 •

Copy link
Copy Markdown

Fixes #589
Fixes #590

nvx-time-probe clock printed zero MSR values and hypervisor CPUID fields as 0x0. The C tool uses %#x, which prints zero as 0. This change prints zero as 0 and keeps the 0x prefix for nonzero values. The CPUID max leaf and summary fields now use the same rule.

Validation

  • Added regression tests for zero, nonzero and maximum values, and for distinct EAX/EDX fields.
  • Passed: rustfmt, Clippy, default tests, rustdoc, Rust 1.89 MSRV, macOS cross-check, artifact bundling and the static musl guest build.
  • Passed: 551 all-feature library tests, 282 musl library tests and the debug guest-tool tests.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 08:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The localized formatting changes address both issues with targeted regression coverage and no identified defects.

No open issues 🎉

What changed in this PR

Fixes #589 and #590 by matching C’s alternate hexadecimal formatting in nvx-time-probe clock.

Changes:

  • Prints zero MSR and hypervisor CPUID values as 0, preserving 0x for nonzero values.
  • Adds regressions for zero, nonzero, maximum values, and distinct feature registers.
File Description
nvx-rs/​src/​guest/​time_probe/​clock.rs Shares C-compatible hexadecimal formatting across affected output paths and adds regression tests.

Review effort: Balanced

@gezerui888

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@ppenna
Pedro Henrique Penna (ppenna) merged commit 776aa38 into microsoft:dev Oct 20, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nvx-rs: print zero CPUID fields in nvx-time-probe clock as C's %#x does nvx-rs: print zero MSR values in nvx-time-probe clock --msr as C's %#x does

3 participants