Merge remote-tracking branch 'randprint/ThreadDistribution' into canary

This commit is contained in:
illusion98 2019-09-04 06:20:02 -05:00 committed by illusion
parent 99dade0a31
commit 77ac9c8010
1 changed files with 6 additions and 4 deletions

View File

@ -156,10 +156,12 @@ void XThread::set_name(const std::string& name) {
} }
uint8_t next_cpu = 0; uint8_t next_cpu = 0;
uint8_t fakedhwthreads[6] = {0, 2, 4, 1, 3, 5};
uint8_t GetFakeCpuNumber(uint8_t proc_mask) { uint8_t GetFakeCpuNumber(uint8_t proc_mask) {
if (!proc_mask) { if (!proc_mask) {
next_cpu = (next_cpu + 1) % 6; next_cpu++;
return next_cpu; // is this reasonable? if (next_cpu == 6) next_cpu = 0;
return fakedhwthreads[next_cpu];
} }
assert_false(proc_mask & 0xC0); assert_false(proc_mask & 0xC0);
@ -339,8 +341,8 @@ X_STATUS XThread::Create() {
// This is thread safe. // This is thread safe.
thread_state_ = new cpu::ThreadState(kernel_state()->processor(), thread_id_, thread_state_ = new cpu::ThreadState(kernel_state()->processor(), thread_id_,
stack_base_, pcr_address_); stack_base_, pcr_address_);
XELOGI("XThread%08X (%X) Stack: %.8X-%.8X", handle(), thread_id_, XELOGI("XThread%08X (%X) Stack: %.8X-%.8X FakeHWThread: (%X)", handle(),
stack_limit_, stack_base_); thread_id_, stack_limit_, stack_base_, fakedhwthreads[next_cpu]);
// Exports use this to get the kernel. // Exports use this to get the kernel.
thread_state_->context()->kernel_state = kernel_state_; thread_state_->context()->kernel_state = kernel_state_;