Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#590 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Python
Stelle
380
Fork
24
Merge medio
13h 18m
PR unite (30g)
292

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/nvx

Tutte le issue di microsoft/nvx

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.