Skip to content

Conversation

gyx47
Copy link

@gyx47 gyx47 commented Aug 28, 2025

description

The timestamp.cpp file uses the x86-specific CPU instruction __rdtsc (Read Time-Stamp Counter). This instruction is used to obtain the CPU's high-precision cycle counter. It does not exist in non-x86 architecture (RISC-V) compilation environments, causing compilation failure.

environment

version fceux 2.6.6
Platform: RISC-V 64 bit

patch

When choosing a replacement for rdtsc on RISC-V, I initially considered rdcycle and rdtime. Although rdcycle is closer in functionality to the original intention of rdtsc (measuring CPU workload), we chose to use rdtime based on the latest Linux kernel developments. https://gitlab.com/gromacs/gromacs/-/merge_requests/4040/diffs?commit_id=9124df970d1109fa672bc4f1ebba941517955763 The rdcycle instruction is being converted to a privileged instruction and will not be directly usable from user space in the future.

The timestamp.cpp file uses the x86-specific CPU instruction __rdtsc (Read Time-Stamp Counter). This instruction is used to obtain the CPU's high-precision cycle counter. It does not exist in non-x86 architecture (RISC-V) compilation environments, causing compilation failure.
When choosing a replacement for rdtsc on RISC-V, I initially considered rdcycle and rdtime. Although rdcycle is closer in functionality to the original intention of rdtsc (measuring CPU workload), we chose to use rdtime based on the latest Linux kernel developments.
https://gitlab.com/gromacs/gromacs/-/merge_requests/4040/diffs?commit_id=9124df970d1109fa672bc4f1ebba941517955763
The rdcycle instruction is being converted to a privileged instruction and will not be directly usable from user space in the future.
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.

1 participant