Merge branch 'master' into feature/savestates-2

This commit is contained in:
Hamish Milne 2020-04-16 19:03:49 +01:00
commit 9cd669db84
14 changed files with 130 additions and 106 deletions

View file

@ -15,6 +15,10 @@
#include "core/core_timing.h"
#include "core/memory.h"
namespace Memory {
struct PageTable;
};
/// Generic ARM11 CPU interface
class ARM_Interface : NonCopyable {
public:

View file

@ -74,6 +74,7 @@ void KernelSystem::SetCurrentProcessForCPU(std::shared_ptr<Process> process, u32
SetCurrentMemoryPageTable(process->vm_manager.page_table);
} else {
stored_processes[core_id] = process;
thread_managers[core_id]->cpu->SetPageTable(process->vm_manager.page_table);
}
}

View file

@ -104,11 +104,13 @@ void Thread::Stop() {
void ThreadManager::SwitchContext(Thread* new_thread) {
Thread* previous_thread = GetCurrentThread();
std::shared_ptr<Process> previous_process = nullptr;
Core::Timing& timing = kernel.timing;
// Save context for previous thread
if (previous_thread) {
previous_process = previous_thread->owner_process;
previous_thread->last_running_ticks = timing.GetGlobalTicks();
cpu->SaveContext(previous_thread->context);
@ -128,8 +130,6 @@ void ThreadManager::SwitchContext(Thread* new_thread) {
// Cancel any outstanding wakeup events for this thread
timing.UnscheduleEvent(ThreadWakeupEventType, new_thread->thread_id);
auto previous_process = kernel.GetCurrentProcess();
current_thread = SharedFrom(new_thread);
ready_queue.remove(new_thread->current_priority, new_thread);

View file

@ -338,10 +338,12 @@ void Module::SyncTagState() {
// detected on Scanning->TagInRange?
nfc_tag_state = TagState::TagInRange;
tag_in_range_event->Signal();
} else if (!amiibo_in_range && nfc_tag_state == TagState::TagInRange) {
nfc_tag_state = TagState::TagOutOfRange;
} else if (!amiibo_in_range &&
(nfc_tag_state == TagState::TagInRange || nfc_tag_state == TagState::TagDataLoaded ||
nfc_tag_state == TagState::Unknown6)) {
// TODO (wwylele): If a tag is removed during TagDataLoaded/Unknown6, should this event
// signals early?
nfc_tag_state = TagState::TagOutOfRange;
tag_out_of_range_event->Signal();
}
}