summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Linn <jl@conductive.de>2019-11-20 18:47:34 +0100
committerRick Gibbed <rick@gibbed.us>2019-12-01 17:11:58 -0600
commit7e244e0488858e710a20a7e85837eda331e5c528 (patch)
treefc82c05aec76d563159db4be730233f9cd03839c
parentd6ce72ddc90a18b5b0944b9be92bc8004d1ebc96 (diff)
[Base] Clock state now unaltered by threading.
- Removed tick and time values from ThreadSavedState. - Removed affiliated get/set code from Save and Restore. - Removed dangerous SetGuestTickCount method.
-rw-r--r--src/xenia/base/clock.cc7
-rw-r--r--src/xenia/base/clock.h6
-rw-r--r--src/xenia/kernel/xthread.cc14
3 files changed, 3 insertions, 24 deletions
diff --git a/src/xenia/base/clock.cc b/src/xenia/base/clock.cc
index 5eeec31a4..d226d95af 100644
--- a/src/xenia/base/clock.cc
+++ b/src/xenia/base/clock.cc
@@ -126,13 +126,6 @@ uint32_t Clock::QueryGuestUptimeMillis() {
std::numeric_limits<uint32_t>::max()));
}
-void Clock::SetGuestTickCount(uint64_t tick_count) {
- std::lock_guard<std::mutex> lock(tick_mutex_);
-
- last_host_tick_count_ = Clock::QueryHostTickCount();
- last_guest_tick_count_ = tick_count;
-}
-
void Clock::SetGuestSystemTime(uint64_t system_time) {
// Query the filetime offset to calculate a new base time.
auto guest_system_time_offset = QueryGuestSystemTimeOffset();
diff --git a/src/xenia/base/clock.h b/src/xenia/base/clock.h
index fba845c92..8ca6aea83 100644
--- a/src/xenia/base/clock.h
+++ b/src/xenia/base/clock.h
@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
- * Copyright 2015 Ben Vanik. All rights reserved. *
+ * Copyright 2019 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -47,9 +47,7 @@ class Clock {
// Queries the milliseconds since the guest began, accounting for scaling.
static uint32_t QueryGuestUptimeMillis();
- // Sets the guest tick count for the current thread.
- static void SetGuestTickCount(uint64_t tick_count);
- // Sets the system time for the current thread.
+ // Sets the system time of the guest.
static void SetGuestSystemTime(uint64_t system_time);
// Scales a time duration in milliseconds, from guest time.
diff --git a/src/xenia/kernel/xthread.cc b/src/xenia/kernel/xthread.cc
index a1e6007a2..4028765a8 100644
--- a/src/xenia/kernel/xthread.cc
+++ b/src/xenia/kernel/xthread.cc
@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
- * Copyright 2013 Ben Vanik. All rights reserved. *
+ * Copyright 2019 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -821,10 +821,6 @@ struct ThreadSavedState {
bool is_main_thread; // Is this the main thread?
bool is_running;
- // Clock settings (invalid if not running)
- uint64_t tick_count_;
- uint64_t system_time_;
-
uint32_t apc_head;
uint32_t tls_static_address;
uint32_t tls_dynamic_address;
@@ -893,10 +889,6 @@ bool XThread::Save(ByteStream* stream) {
state.stack_alloc_size = stack_alloc_size_;
if (running_) {
- state.tick_count_ = Clock::QueryGuestTickCount();
- state.system_time_ =
- Clock::QueryGuestSystemTime() - Clock::guest_system_time_base();
-
// Context information
auto context = thread_state_->context();
state.context.lr = context->lr;
@@ -1006,10 +998,6 @@ object_ref<XThread> XThread::Restore(KernelState* kernel_state,
// Profiler needs to know about the thread.
xe::Profiler::ThreadEnter(thread->name().c_str());
- // Setup the time now that we're in the thread.
- Clock::SetGuestTickCount(state.tick_count_);
- Clock::SetGuestSystemTime(state.system_time_);
-
current_xthread_tls_ = thread;
current_thread_ = thread;