Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#590 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Start with the nvx-time-probe clock subcommand and the print_cpuid function, where the summary line and eax.max_leaf are formatted with {:#x}. Check alternate_hex_width_10, the existing helper for %#010x, to see how the zero-without-prefix formatting is done. The issue depends on a helper proposed in #589, so confirm whether that is merged before adding it. Done means zero prints as 0, nonzero values keep 0x, and a regression test for a CPU without the hypervisor bit matches the C program's output.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

nvx-time-probe clock prints the hypervisor's CPUID fields with Rust's {:#x}, which prints zero as 0x0, where the C program's %#x printed 0. The summary line's hv_max_leaf, hv_features_eax, and hv_features_edx are all zero when the hypervisor bit is clear, and its feature fields are zero under a hypervisor whose leaves end before 0x40000003. The cpuid.0x40000000 line's eax.max_leaf is likewise zero for a hypervisor whose leaf reads zero. Each such valid run differs from the C program's byte-exact output.

Found in the #550 review. The port has differed since its first revision, and #550 leaves the fix to this issue. #589 is the same difference in the MSR values.

Proposal

Print these fields with the helper for C's %#x that #589 proposes, which prints zero without the prefix, as alternate_hex_width_10 already does for %#010x.

Tasks

  • Print zero as 0 in the summary line's hv_max_leaf, hv_features_eax, and hv_features_edx, and in the eax.max_leaf that print_cpuid prints, keeping 0x before nonzero values.
  • Add a regression for the zero-valued summary of a CPU without the hypervisor bit, with the C program's output as the expected result.
Ngôn ngữ chính
Python
Star
380
Fork
24
Merge trung bình
13 giờ 18 phút
Pull request đã merge (30 ngày)
292

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/nvx

Tất cả issue của microsoft/nvx

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.