Add RISC-V time retrieval in timeStamp.cpp #804
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.
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.