[CPU] Implement mftb instruction natively.

When the cvars clock_no_scaling and clock_source_raw are set, tick counts will be directly calculated in the emitted code.
This commit is contained in:
Joel Linn
2019-11-22 03:42:15 +01:00
committed by Rick Gibbed
parent 15d422d988
commit 922f1f220a
3 changed files with 36 additions and 4 deletions

View File

@@ -134,6 +134,11 @@ void Clock::set_guest_time_scalar(double scalar) {
RecomputeGuestTickScalar();
}
std::pair<uint64_t, uint64_t> Clock::guest_tick_ratio() {
std::lock_guard<std::mutex> lock(tick_mutex_);
return guest_tick_ratio_;
}
uint64_t Clock::guest_tick_frequency() { return guest_tick_frequency_; }
void Clock::set_guest_tick_frequency(uint64_t frequency) {

View File

@@ -43,6 +43,8 @@ class Clock {
// Sets the guest time scalar, adjusting tick and wall clock speed.
// Ex: 1x=normal, 2x=double speed, 1/2x=half speed.
static void set_guest_time_scalar(double scalar);
// Get the tick ration between host and guest including time scaling if set.
static std::pair<uint64_t, uint64_t> guest_tick_ratio();
// Guest ticks-per-second.
static uint64_t guest_tick_frequency();
// Sets the guest ticks-per-second.